question

Louis-Philippe Perron avatar image
Louis-Philippe Perron asked ·

Answer Call Javascript SDK

Hi,


Already using the Javascript SDK to query for Account, Directory, Presence, Call Status, etc. Also successfully using the SDK to do CallOut sessions.


When trying to Answer calls, the API always answer with 400 or 404 responses.

What would be the SDK usage to answer a call, using the telephonySessionId, partyId & deviceId?


regards,

Thanks!

apisdkvoicejavascript
1 |1000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

In order to answer a call programmatically, you need the telephoneSessionId and the partyId. You can get those ids from an active call. The best way to get ac active call info is to implement push notification and subscribe for the presence notification with the detailedTelephonyState set to true, or subscribe for the telephony session notification

7 comments Share
1 |1000 characters needed characters left characters exceeded

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

Hi, Sorry I was not clear in my question...

The notification already work ok, and the telephonySessionId + partyId are known and used to proceed with the "Answer".

What I'd like to confirm:

- when I receive the "telephony session" notification for an incoming call, is Answer Call Party the right API to answer the call right away?

- Using the telephonySessionId and callParty from the notification, is that right?

- why am I receiving 400 or 404 responses?

- is there a way to debug further to investigate the problem source?


regards,

0 Likes 0 · ·
Phong Vu avatar image Phong Vu ♦♦ Louis-Philippe Perron ·

Can you share some code and also print the error message?

0 Likes 0 · ·
function answer({telephonySessionId, deviceId, partyId}) {
  sdk.platform()
    .post(`/restapi/v1.0/account/~/telephony/sessions/${telephonySessionId}/parties/${partyId}/answer`, {deviceId})
    .then(resp=> {
    console.log("response: ", resp);
  })
    .catch(error=>{
    console.log("error: ", error);
  });
}

assuming the telephonySessionId + partyId received by telephonySession notification and proper deviceId. Does the call needs to be at a specific initialization stage to be ready to be answered?

0 Likes 0 · ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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