Stan | 2016-11-29 02:18:35 UTC | #1
How to receive an incoming call?
KevinGlinski | 2016-11-29 13:32:28 UTC | #2
can you be a little more specific with your question?
Stan | 2016-11-30 01:45:03 UTC | #3
I used this notification ["id": "v2.users.{id}.conversations.calls"] and then when it callback notify me , which API could I used to pick up the incoming call.By the way,I used C# API.
KevinGlinski | 2016-11-30 11:43:49 UTC | #4
PATCH /api/v2/conversations/{conversationId}/participants/{participantId} and set the state to 'connected"
This tutorial might also help https://developer.mypurecloud.com/api/tutorials/calls/
Stan | 2016-12-01 02:08:18 UTC | #5
thank you Kevin , it's useful.
BenjaminRamsay | 2016-12-02 04:30:15 UTC | #6
I've been trying to accomplish this same thing: answering an alerting incoming call via the Conversations API. I read through the documentation and the tutorial you mention above. In my case I'm using the C# SDK. I can disconnect the alerting call, but cannot seem to connect the call. Something I'm doing wrong?
var convApi = new ConversationsApi();
CallConversationEntityListing calls = convApi.GetCalls(); foreach (CallConversation call in calls.Entities) { MediaParticipantRequest callStatus = new MediaParticipantRequest(); callStatus.State = MediaParticipantRequest.StateEnum.Connected; convApi.PatchCallsCallIdParticipantsParticipantId(call.Id, call.Participants[0].Id, callStatus); }
I wasn't sure which Participant I should be updating, so I tried both [0] and [1]. No luck.
tim.smith | 2016-12-02 17:45:15 UTC | #7
You need to inspect the participant to find your user's participant ID; if you try to act on another participant, it won't work. Your user's participant will be the participant where purpose is agent (ACD) or user (non-ACD). Also make sure that the participant's endTime is not set. If you participate in a conversation multiple times (e.g. handle a call, transfer back to queue, handle it again), you will have multiple participants that are your user. You should also validate that the participant is not another agent/user by checking user.id on the participant against your user's ID.
BenjaminRamsay | 2016-12-02 17:54:20 UTC | #8
Good advice, thanks. I'll do all those things before this goes into production. So far I'm just testing the concept, and in my test case there are only 2 participants. Outside caller making the test call, and my PureCloud user receiving the test call. So there are 2 participants, [0] and [1]. I tried the code above on both without success.
I'm wondering if its something specific to the C# SDK, so I'm going to try it using raw API calls in Postman next. I'll let you know the result.
Stan, were you able to successfully answer an alerting incoming call using the API?
tim.smith | 2016-12-02 17:59:10 UTC | #9
BenjaminRamsay, post:8, topic:675
try it using raw API calls in Postman
If you're unfamiliar, there's also the developer tools that you can use to test API calls: https://developer.mypurecloud.com/developer-tools/
I also remembered that there is still a bug with that method in the SDK. Make sure you set all of the bool? properties on MediaParticipantRequest to null before sending the request. It defaults to false for all of those properties, which actually instructs the server to unhold, unmute, etc.
BenjaminRamsay | 2016-12-02 18:16:04 UTC | #10
Ah yes, I almost forgot about the developer tools option! I just tried it in dev tools, and unfortunately I'm seeing the same behavior. I first use /api/v2/conversations/calls to get the proper Call ID and Participant ID. Then I use /api/v2/conversations/calls/{callId}/participants/{participantId} to send the following body update to the "alerting" participant:
{ "state": "connected" }
It works with "disconnected", I can hang up on the alerting call. But "connected" does not make the call answer. Are you able to make it work successfully on your end in dev tools?
tim.smith | 2016-12-02 18:28:59 UTC | #11
Are you using a WebRTC station by chance? There's currently a limitation where WebRTC stations don't respond to external API requests. The fix for that is in progress.
BenjaminRamsay | 2016-12-02 18:33:40 UTC | #12
Ahh, yes I sure am, almost all our users are. So if WebRTC doesn't respond to API requests, why am I able to use the API to do other things like disconnect, put on hold, take off hold, etc? The only one of those not working is state: connected.
tim.smith | 2016-12-02 18:37:53 UTC | #13
BenjaminRamsay, post:12, topic:675
So if WebRTC doesn't respond to API requests, why am I able to use the API to do other things like disconnect, put on hold, take off hold, etc? The only one of those not working is state: connected.
The technical limitation is actually more nuanced than "doesn't respond to API requests". It's a rather lengthy explanation. The short answer is that hold/mute/disconnect are handled by the server; the WebRTC station doesn't actually take any action for those operations. But to pick up a call, the station has to connect the media, which is what it will not do. If you try to make outbound calls through the API, those calls will never connect to the WebRTC station either.
For now, the only workaround is to use physical phones. Once PCDWEBK-3709 is implemented to fix the behavior of the WebRTC station, this limitation will be resolved.
BenjaminRamsay | 2016-12-02 18:42:51 UTC | #14
Ok thanks for the info. This may be a rookie question, but I'm new to the product. Is there an issue tracking site where I can monitor the status of PCDWEBK-3709?
You're exactly right too, if I switch my station to a polycom it works fine.
Thanks again
tim.smith | 2016-12-02 18:58:37 UTC | #15
BenjaminRamsay, post:14, topic:675
Is there an issue tracking site where I can monitor the status of PCDWEBK-3709?
Unfortunately, no. Issues in the API project will show their status here on the forum (like API-1234), but other projects will not. However, keep an eye on the PureCloud release notes. The current target for this is mid Q1 2017.
OleMobekk | 2017-07-20 13:14:53 UTC | #16
Is this issue fixed? Cause im trying to answer a call from my app using the API and i cant get it to work. I have checked the API call from my app and from Purecloud using fiddler and the API calls looks the same.
tim.smith | 2017-07-20 16:38:14 UTC | #17
This was announced in January: https://developer.mypurecloud.com/forum/t/product-feature-place-calls-via-api-with-webrtc-phone/848
tim.smith | 2017-07-20 16:38:19 UTC | #18
This post was migrated from the old Developer Forum.
ref: 675