Skip to main content
The First Step
June 16, 2026
Solved

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

## 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.

PhongVu
PhongVuAnswer
Community Manager
June 18, 2026

​@PhongVu 

The user active calls API provides response like:
 

{
"uri":"https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/active-calls?view=Simple&page=1&perPage=100"
"records":[
0:{
"uri":"https://platform.ringcentral.com/restapi/v1.0/account/123318033/extension/1234352/call-log/GSbrwP..."
"id":"GSbwerwPldcwIOswP"
"sessionId":"31243523123"
"startTime":"2026-06-18T15:32:07.000Z"
"duration":185
"durationMs":185000
"type":"Voice"
"internalType":"LocalNumber"
"direction":"Inbound"
"action":"Phone Call"
"result":"Accepted"
"to":{
"name":"Bibek chaulagain"
"phoneNumber":"+44123456782"
}
"from":{
"name":"AI Receptionist"
"phoneNumber":"+4412322345"
}
"recording":{
"uri":""
"id":"100033003404"
"type":"Automatic"
"contentUri":""
}
"extension":{
"uri":""
"id":132456784
}
"reason":"Accepted"
"reasonDescription":"The call was connected to and was accepted by this number."
"telephonySessionId":"s-w120msa235023231203213123"
"partyId":"p-w120msa235023231203213123-1"
}

The sample response you provided was from the subscribing to the presence event.
Could you please look into this?

My bad, call this API to get the call Id of an active call. Remember to set the “detailedTelephonyState=true”

17 replies

PhongVu
Community Manager
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.

The First Step
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?
PhongVu
Community Manager
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.

The First Step
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?

PhongVu
Community Manager
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.

The First Step
June 18, 2026

​@PhongVu Thank you for your reply.

  1. When the subscription becomes invalid or blacklisted which we are able to renew/re-create after 10 minutes of blacklisted, then can we recover the logs in between that 10 minutes?
  2. Can you suggest approach to automatically renew or recreate subscriptions to ensure call logging continues without interruption?

If we use Active Calls API, what is the throttle limit for that API? As we can sometimes have 10/12 calls within a minute, we have to hit Active Calls API 10/12 times per minute, which could lead to threshold limit error.

Does Active Calls API provide both call-Id header value from SIP phone and telephonySessionId so we can correlate with internal logs store with the call-Id header value from SIP phone?

PhongVu
Community Manager
Community Manager
June 18, 2026

​@PhongVu Thank you for your reply.

  1. When the subscription becomes invalid or blacklisted which we are able to renew/re-create after 10 minutes of blacklisted, then can we recover the logs in between that 10 minutes?
  2. Can you suggest approach to automatically renew or recreate subscriptions to ensure call logging continues without interruption?

If we use Active Calls API, what is the throttle limit for that API? As we can sometimes have 10/12 calls within a minute, we have to hit Active Calls API 10/12 times per minute, which could lead to threshold limit error.

Does Active Calls API provide both call-Id header value from SIP phone and telephonySessionId so we can correlate with internal logs store with the call-Id header value from SIP phone?

The answers to these questions can be found from my previous answers. Please click the dev guide article and the API reference links I provided above.

The First Step
June 18, 2026

​@PhongVu 
Does Active Calls API provide both call-Id header value from SIP phone and telephonySessionId so we can correlate with internal logs store with the call-Id header value from SIP phone?

I could not find any ID that matches the call-Id header value from SIP phone, however Active Call API mentioned that we get a sipUuidInfo which is Call session identifier, required for Telephony REST API. But when I checked I could not find sipUuidInfo in the API response.

PhongVu
Community Manager
Community Manager
June 18, 2026

​@PhongVu 
Does Active Calls API provide both call-Id header value from SIP phone and telephonySessionId so we can correlate with internal logs store with the call-Id header value from SIP phone?

I could not find any ID that matches the call-Id header value from SIP phone, however Active Call API mentioned that we get a sipUuidInfo which is Call session identifier, required for Telephony REST API. But when I checked I could not find sipUuidInfo in the API response.

This was the answer!


“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.”

Sample response
 

{
"extensionId": 5958xxxx,
"telephonyStatus": "CallConnected",
"activeCalls": [
{
"id": "b56d82b9-8311-4482-8e8d-13d19eb73e9e",
"direction": "Inbound",
"fromName": "...",
"from": "+1650XXXXXX",
"toName": "Agent 1",
"to": "11XXX",
"telephonyStatus": "CallConnected",
"sessionId": "113625875XXX",
"startTime": "2026-06-17T14:53:33.787Z",
"partyId": "p-a78c620287a9ez19ed6127181z3c07e40000-3",
"telephonySessionId": "s-a78c620287a9ez19ed6127181z3c07e40000"
}
],

 

The First Step
June 18, 2026

​@PhongVu 

The user active calls API provides response like:
 

{
"uri":"https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/active-calls?view=Simple&page=1&perPage=100"
"records":[
0:{
"uri":"https://platform.ringcentral.com/restapi/v1.0/account/123318033/extension/1234352/call-log/GSbrwP..."
"id":"GSbwerwPldcwIOswP"
"sessionId":"31243523123"
"startTime":"2026-06-18T15:32:07.000Z"
"duration":185
"durationMs":185000
"type":"Voice"
"internalType":"LocalNumber"
"direction":"Inbound"
"action":"Phone Call"
"result":"Accepted"
"to":{
"name":"Bibek chaulagain"
"phoneNumber":"+44123456782"
}
"from":{
"name":"AI Receptionist"
"phoneNumber":"+4412322345"
}
"recording":{
"uri":""
"id":"100033003404"
"type":"Automatic"
"contentUri":""
}
"extension":{
"uri":""
"id":132456784
}
"reason":"Accepted"
"reasonDescription":"The call was connected to and was accepted by this number."
"telephonySessionId":"s-w120msa235023231203213123"
"partyId":"p-w120msa235023231203213123-1"
}

The sample response you provided was from the subscribing to the presence event.
Could you please look into this?