Skip to main content
Question

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

  • July 27, 2021
  • 1 reply
  • 228 views

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?




1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • August 5, 2021

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"