Skip to main content
Question

How to obtain the telephonySessionId for an inbound call answered by the softphone in case of multi-softphones in a single-queue case?

  • June 16, 2026
  • 5 replies
  • 20 views

## Setup

We use `ringcentral-softphone` to answer inbound calls that are routed through a single RingCentral **call queue** to one of several **agent softphones**.
- **4 softphones** sit behind one queue, each a distinct RC user/extension with its own SIP credentials.

## What we're trying to do

For every call we need to capture two kinds of data and store them under **one phone call record**, then display them together for a single call in our own UI:

1. **Internal logs** (from the Node softphone process): a small set of details we write to our database when the call starts, against a unique identifier.
2. **Telephony lifecycle**: the full call history — transfer → answered/rejected → transferred again → ended — which we obtain from an **account-level `telephony/sessions` webhook subscription** (or any better approach you'd recommend).

**The core question: how can we tie these two records together with the same identifier?**

## The problem

From the SIP connection in `ringcentral-softphone(-ts)`, the only identifier we get is the SIP **`Call-ID`** — we cannot obtain the **`telephonySessionId`**, which is the key the telephony webhook (and the Call Log API) use.

We tried your suggestion of subscribing to extension/account `telephony/sessions` events via webhook, and we *can* see a matching session id inside **`sipData`** — but with a catch:

- `sipData` is only present for the softphone whose **own credentials** were used
  to create the subscription.
- To get `sipData` for every call in the queue, we'd have to create a separate
  subscription **per softphone**, each using that softphone's own client
  ID/secret/credentials.

That approach is hard to maintain and debug (one subscription and credential set per softphone), and every softphone's subscription also receives **all** account events, which adds a lot of duplicate noise.

## Questions

What is the recommended, maintainable way to obtain or correlate the `telephonySessionId` for a call answered by one of several softphones in a single queue — ideally without creating and managing a separate subscription per softphone?

Specifically:
- Is the `telephonySessionId` (or `partyId`) available to the softphone in any SIP header on the INVITE that we could read? If so, could `ringcentral-softphone` expose it on the `CallSession` (e.g. `callSession.telephonySessionId`)?
- If not, is there a better correlation strategy than one subscription per softphone?

Thanks for the library — any guidance on this multi-softphone / single-queue case
would be a big help.

5 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • June 16, 2026

You can subscribe to the presence event notification instead of the telephony session event.

var eventFilters = [
'/restapi/v1.0/account/~/extension/AgentExt1ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt2ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt3ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt4ID/presence?detailedTelephonyState=true'
]

When a call is answered by an agent, you will get the event with the "telephonyStatus": "CallConnected" and an active call object which contains the call Id.

{
"extensionId": Agent4ExtId,
"telephonyStatus": "CallConnected",
"activeCalls": [
{
"id": "e9d2b7f8-0d9f-4dde-b0f3-a93596b7425c",
"direction": "Inbound",
"fromName": "...",
"from": "+1...",
"toName": "Agent 4",
"to": "+1...",
"telephonyStatus": "CallConnected",
"sessionId": "211010xxxx",
"startTime": "2026-06-....",
"partyId": "p-a0d7bc9041c98z19ed138595dz69b29d0000-2",
"telephonySessionId": "s-a0d7bc9041c98z19ed138595dz69b29d0000"
}
],
...

The active call Id “e9d2b7f8-0d9f-4dde-b0f3-a93596b7425c” can be used to match with the call-Id header value from your SIP phone. And thus you can use the partyId and the telephonySessionId values for your call log.


@PhongVu Thank you for your reply.

 

We store internal logs associating the call-Id header value from SIP phone.
And we have to track and save all Telephony lifecycle: the full call history —call answered → transfer → answered/rejected → transferred again → ended — which we obtain only from an account-level `telephony/sessions` webhook subscription.
The extension level webhook subscription does not seem to provide event after the call is transferred to another extension.

  1. How can we obtain full Telephony lifecycle and correlate with the internal logs (stored with call-Id header value from SIP phone) using your approach?
  2. And is there anyway we can achieve this without maintaining four subscription for each softphone users?

If we create subscriptions for all softphone users:

  1. Can we control the subscription expiration time ourselves? What is the maximum expiration period allowed?
  2. Are there any scenarios where a subscription could become invalid or stop delivering events? If so, what is the recommended approach to automatically renew or recreate subscriptions to ensure call logging continues without interruption?
  3. If we create a new subscription without revoking the existing one, will both subscriptions continue receiving the same events, or will only the most recently created subscription receive them?

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • June 17, 2026

@PhongVu Thank you for your reply.

 

We store internal logs associating the call-Id header value from SIP phone.
And we have to track and save all Telephony lifecycle: the full call history —call answered → transfer → answered/rejected → transferred again → ended — which we obtain only from an account-level `telephony/sessions` webhook subscription.
The extension level webhook subscription does not seem to provide event after the call is transferred to another extension.

  1. How can we obtain full Telephony lifecycle and correlate with the internal logs (stored with call-Id header value from SIP phone) using your approach?
  2. And is there anyway we can achieve this without maintaining four subscription for each softphone users?

If we create subscriptions for all softphone users:

  1. Can we control the subscription expiration time ourselves? What is the maximum expiration period allowed?
  2. Are there any scenarios where a subscription could become invalid or stop delivering events? If so, what is the recommended approach to automatically renew or recreate subscriptions to ensure call logging continues without interruption?
  3. If we create a new subscription without revoking the existing one, will both subscriptions continue receiving the same events, or will only the most recently created subscription receive them?

In your case, you will need to use that workaround solution by subscribe to both telephony session event and user presence?detailedTelephonyState=true event. You can use the telephony event payload to create your call log. The presence event payload is only for getting the call-Id to match with the agent’s SIP phone as you were asking in your previous question. Since the call queue is small (4 members) and if the queue is not very busy, you can call the user active calls API to read active call data instead of subscribing to the presence? event. Remember that the call-Id is only available in the active call object after the call is answered/connected.

Since you have only 4 agents, the best approach is to use a super admin user to subscribe to event notifications for all 4 agents.

var eventFilters = [
'/restapi/v1.0/account/~/extension/AgentExt1ID/telephony/sessions',
'/restapi/v1.0/account/~/extension/AgentExt1ID/telephony/sessions',
'/restapi/v1.0/account/~/extension/AgentExt1ID/telephony/sessions',
'/restapi/v1.0/account/~/extension/AgentExt1ID/telephony/sessions',
'/restapi/v1.0/account/~/extension/AgentExt1ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt2ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt3ID/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/~/extension/AgentExt4ID/presence?detailedTelephonyState=true'
]

Q/ Can we control the subscription expiration time ourselves? What is the maximum expiration period allowed?

A/ Set the expiresIn parameter when you create the subscription

Q/ Are there any scenarios where a subscription could become invalid or stop delivering events? If so, what is the recommended approach to automatically renew or recreate subscriptions to ensure call logging continues without interruption?

A/ If your server becomes unreachable, the subscription will be blacklisted. Read this dev guide article for details.

Q/ If we create a new subscription without revoking the existing one, will both subscriptions continue receiving the same events, or will only the most recently created subscription receive them?

A/ Multiple subscriptions will work. Each user can have max 20 active subscriptions. Avoid multiple subscriptions if you don’t really need them. Use update instead of revoke and create new one.


@PhongVu 

Thank you for your reply.

How can we detect when a subscription has been blacklisted or when event delivery has stopped, so that we can automatically renew the subscription or create a new one?

Additionally, if a subscription becomes blacklisted, what is the recommended approach: should we attempt to renew the existing blacklisted subscription, or should we delete it and create a new subscription instead?


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • June 17, 2026

@PhongVu 

Thank you for your reply.

How can we detect when a subscription has been blacklisted or when event delivery has stopped, so that we can automatically renew the subscription or create a new one?

Additionally, if a subscription becomes blacklisted, what is the recommended approach: should we attempt to renew the existing blacklisted subscription, or should we delete it and create a new subscription instead?

No notification if the subscription is blacklisted!

You need to make sure that the deliver address is always publicly accessible.

You should return 200 Ok for every notification event.

You can create a subscription with the expiresIn = 87000 (over a day) and renew it daily.

Once the subscription is blacklisted, delete and create a new one.