Herlander_Pires | 2017-09-05 10:14:48 UTC | #1
Hello,
How can i accept a incoming call using the JS api?
The notifications send the conversation with the participants list, but i don't know how to pick up the call.
Thank you Best Regards.
Herlander Pires
tim.smith | 2017-09-05 16:31:54 UTC | #2
Use PATCH /api/v2/conversations/calls/{conversationId}/participants/{participantId} to answer a call. There's also a tutorial on call handling, though it's still using the old JavaScript SDK so the API calls won't match up exactly with the latest version.
Herlander_Pires | 2017-09-05 17:12:08 UTC | #3
Hello Tim.
Thank u for answering.
I forgot to mention that we were trying to accept a callback. Is it the same but using /api/v2/conversations/callbacks (...) ?
The tutorial mentions the accept in the "disconnect the call" section. That's why we miss it.
Also, in the tutorial, the participant id is obtained assuming a given index. When changing the call state for a participant that corresponds to the "agent" can we assume an index? Or do we have to traverse the list until we find a participant that matches our user id?
Thanks again.
Regards, Herlander
tim.smith | 2017-09-05 17:17:09 UTC | #4
I forgot to mention that we were trying to accept a callback. Is it the same but using /api/v2/conversations/callbacks (...) ?
Yes.
Also, in the tutorial, the participant id is obtained assuming a given index. When changing the call state for a participant that corresponds to the "agent" can we assume an index? Or do we have to traverse the list until we find a participant that matches our user id?
There is no guarantee that the order of the participants will be the same in all situations; the tutorial is making an assumption because it only expects to encounter a single scenario. As a best practice, you should iterate through the list of participants until you find the one you're looking for.
Herlander_Pires | 2017-09-06 10:49:43 UTC | #5
Thanks.
Regards, Herlander
system | 2017-10-07 10:49:44 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1755