question

Inisoft API avatar image
Inisoft API asked Phong Vu answered

Receiving event that call connected before taking the phone at outbound call

I made outbound call.
I received presence event with telephonyStatus:"CallConnected " before answer the phone.
This event data is same with event data when I answer the phone.

My event subscription:

"/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&sipData=true",

"/restapi/v1.0/account/~/extension/~/telephony/sessions?statusCode=Disconnected",


How to avoid 1st wrong event that comes when I not pick up the phone?




sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

Are you calling between extensions under the same account? If so, It is the known issue and cannot be detected by using the presence notification with the detailedTelephonyStatus event.

For internal call, you can use the /telephony/sessions event filter and detect the call status of the "Inbound" event. It is a bit complicated but can be detected with some extra code to parse the event payloads.

{...,"body":{"sequence":4,"sessionId":"653868854016","telephonySessionId":"s-81f3840ab25e4a5fae29057cd81d9757","serverId":"10.13.123.215.TAM","eventTime":"2021-08-05T16:05:27.799Z","parties":[{"accountId":"80964xxxx","extensionId":"6228832xxxx","id":"p-81f3840ab25e4a5fae29057cd81d9757-1","direction":"Outbound","to":{"phoneNumber":"+1209248xxxx","name":"Agent 120","extensionId":"59586xxxx"},"from":{"phoneNumber":"+1720386xxxx","name":"Paco","extensionId":"6228832xxxx","deviceId":"802636634016"},"status":{"code":"Answered",}}
======
{...,"body":{"sequence":5,"sessionId":"653868854016","telephonySessionId":"s-81f3840ab25e4a5fae29057cd81d9757","serverId":"10.13.123.215.TAM","eventTime":"2021-08-05T16:05:31.048Z","parties":[{"accountId":"80964xxxx","extensionId":"59586xxxx","id":"p-81f3840ab25e4a5fae29057cd81d9757-2","direction":"Inbound","to":{"phoneNumber":"+1209248xxxx","name":"Agent 120","extensionId":"59586xxxx"},"from":{"phoneNumber":"11119","name":"Paco","extensionId":"6228832xxxx","deviceId":"802636634016"},"status":{"code":"Proceeding",...}}
======
{...,"body":{"sequence":6,"sessionId":"653868854016","telephonySessionId":"s-81f3840ab25e4a5fae29057cd81d9757","serverId":"10.13.123.215.TAM","eventTime":"2021-08-05T16:05:36.519Z","parties":[{"accountId":"80964xxxx","extensionId":"59586xxxx","id":"p-81f3840ab25e4a5fae29057cd81d9757-2","direction":"Inbound","to":{"phoneNumber":"+1209248xxxx","name":"Agent 120","extensionId":"59586xxxx"},"from":{"phoneNumber":"11119","name":"Paco","extensionId":"6228832xxxx","deviceId":"802636634016"},"status":{"code":"Answered",...}}

You can use the acountId inside the parties array to identify an internal call, then parse the payload accordingly.

"parties":[{"accountId":"80964xxxx"
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys