Answering inbound calls via JS SDK with WebRTC Station

Hi all,

I've been experiencing some issues connecting to inbound calls via the JS SDK.

I'm using the endpoint of /api/v2/conversations/calls/{callId}/participants/{participantId} with the body of

{
"state": "connected"
}

I've got my account configured with a WebRTC station which after searching around on this forum I understand that in 2017 it wasn't possible to accept inbound calls via the API.

After digging deeper I found the reference issue of "PURE-1848" however I've been unable to find any mention of this since. I'm looking to find out what the current state of this issue is as this is a key feature which is pretty crucial for the project we're developing here.

Trailing this forum even more found a reference to "PCDWEBK-3709" which was meant to be the implemented fix to allow the WebRTC stations to both accept and outbound via the API. Yet I don't seem to have any success with this?

Below are all the sources I've found about this issue/limitation:
Unable to answer call via .NET SDK
Answer incoming call using the API

Due to new user restrictions I will be posting more links as a reply.

Hi Will,

We got it working , had to do 2 things:

  1. enable setting "Placing calls with another app"
    image

  2. Activate the WebRtc by placing a dummy call.
    to start the phone Icon on the left menu in purecloud will look like this: image

when WebRtc is active it will look like this: image

we achieve this by placing a dummy call to an internal number.

When using the softphone you also need to have purecloud active (desktop client or web app).

The WebRtc connection als expires after a while. We have it persisted for 10hours, after that the WebRtc is closed and a new dummy call is needed. I am not sure where this setting is (was setup for us). This is important if user keep the application open for more than 10hours.

hope this helps a bit!

kr,

Stefan

3 Likes

That's referring to the feature Stefan posted.

1 Like

Hi Stefan,

Thanks for this! After following your steps I was able to accept inbound calls.

However I have encountered another case where I can't accept calls... When I'm currently on another call and someone else phones in I'm unable to accept it via the API however I can accept it via the purecloud client....

Any thoughts/ideas? The API request returns a 202 and looks successful however it never picks it up.

Thanks again!

If you open a case with PureCloud Care, they can help diagnose why your station isn't connecting the audio.

Can you copy/paste the code here that you are using to call the API?

In general we got our application working the way we want to with the API. That being said, I also still need to contact Purecloud care to get to the bottom of why sometimes we lose WebRtc connection and to check if there is a way to make some sort of ping and automatically reinitialize the webRTC when connection is lost.

Sure :slight_smile: I'm using the following code (JS SDK) to set the state to connected for the inbound call... Perhaps it's not working due to me currently being on a call and that needing to be set to held first? I would've expected the API to handle that for me to be honest...

const body = { state: 'connected' };
await this.pcConversationsApi.patchConversationsCallParticipant(CALLID, PARTICIPANTID, body);

Thanks for helping me out with this strange issue :slight_smile:

I've just done a test where I put the current call on hold first before sending the above request ^

However it was the same outcome... I was unable to accept the new inbound call whilst on another call. Strange how the PC client/web app seems able to accept it with no issues.

just a question: the 2e call, is it also a routed call or a call made directly from another agent in purecloud to your extension? keep in mind that by default you can only accept 1 routed call at a time (can be configured I think).

So when you say cannot answer, is it not being presented to you or is it presented, but you cannot answer?

The second inbound call is made directly from another agent to my extension in PC.

Is option to answer is presented to me and I'm able to execute the above request. I can see the request made in the network inspector and I receive a 202 back. However past that nothing seems to happen... The status of the call never updates.

Thanks for helping me get to the bottom of this :+1:

no worries, have been cursing myself sometimes haha.

The 202 means your request got accepted in a proper manner, but the API will never sent a 200 status code.

are you a 100% sure you have the correct conversationId and participantID? I made the mistake in the beginning of passing the userId as the participant ID.

How are you retrieving the participant ID? how are you being notified of the incoming call? through a conversationNotification?

I'm pretty sure I've got the right IDs. I'm subscribing to the conversation notifications as you've mentioned and then pulling out the ids from that notification... I made the same mistake as you earlier in developing this application ahaha.

I am able to accept an inbound call that comes in over a queue and over PC with this function without any issues... Just seems to not work when I already have an ongoing call.

In our setup the internal calls are being handled by the purecloud webinterface/desptop client so I am afraid we do not have the same situation as you have. Only routed incoming calls are being picked up by our internal application.

What also helps it accepting the internal call through the purecloud web interface and check which calls are being made to the purecloud API (+ the information sent)I in the networktab when pressing F12. Perhaps you need to perform an intermediate action or pass some more information.

1 Like

and if that doesn't help the best action is to contact the helpdesk as Tim mentioned....

Hi Stefan, Thanks for all the suggestions. I did have a look at the web inspector on the web application for PC however it seems like they're using the WRTC SDK within the application to accept the call and NOT the API...

I've been trying a few methods of getting this to work today and I haven't got anywhere yet... I'll go and contact their support team and see what the outcome of that is :slight_smile:

Thanks again for all your help trying to figure this out. :+1:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.