Can't Answer call via API

I tried using the API to answer incoming calls through IVR, but as you can see, I received a 202 Accepted response, yet the system did not answer the call.

However, when I changed the state to Disconnected and executed it, the call was disconnected and forwarded to the next agent.

patch
/api/v2/conversations/calls/{conversationId}/participants/{participantId}
Body:
{
"state": "connected"
}



Hello,

You can have a look at the following blog - Clarifying call control support to answer a call or to make a call using Platform API .
It covers different type of phones and setup - and what can be done or can't be done via API to answer a call.

Regards,

Hi @Jerome.Saint-Marc

Do I need to use an Authorization Code Grant level token?
The Client Credentials Grant cannot be used to answer calls. Did I understand correctly?

That's correct. You cannot use a Client Credentials Grant token.
It must be a token associated to the user receiving the call and wishing to answer the call (obtained via an Authorization Code Grant, or PKCE Grant, or Implicit Grant, or SAML2 Bearer Grant flow).

Regards,

Hi @Jerome.Saint-Marc

Using an Authorization Code Grant requires an application to support it, right? Or how can it be tested?
Please advise me.

I am not totally sure I understand what you mean with "application to support it".
If you mean creating a web page with javascript to invoke the Authorization Endpoint, that is correct.

What you can also do if you want to test your API request, and which is much simpler, is to use the API Explorer and log into your account. And you can invoke the PATCH /api/v2/conversations/calls/{conversationId}/participants/{participantId} from there.
Here is some explanations on using API Explorer.
The API Explorer transparently requests a user oriented token for the logged in user when you sign in your Genesys Cloud org (Account Selection drop down at the top right of the page - adding account correcponding to your Genesys Cloud org region).

Regards,

Hi @Jerome.Saint-Marc

I tried using Postman to auth type OAuth 2.0 and got the token back.
But when I try using it with url PATCH /api/v2/conversations/calls/{conversationId}/participants/{participantId}
The result is that if you select "state": "connected" you will get 202 back but nothing happens and "state": "disconnected" will return 202 and the call will be disconnected from that agent.
But if "state": "terminated" the call is not disconnected.
So I'm wondering where the mistake is because I already use oauth at the authorize level.

"disconnected" is what to use to disconnect the call.
As of "connected" to answer the call, I suggest you have a look at the blog article I mentioned. Based on the phone you are using, it will tell you what is possible and what is not. Being able to answer the call via API is function of different factors and may not be possible in some situations (highlighted in the blog). The PATCH request will reply with a 202, saying that the request has been taken into account. But the call may not be answered (e.g. WebRTC Phone with no persistent connection enabled, and no active connection).

@Jerome.Saint-Marc

I've found a reason why I can't receive calls through the API.
Because there must be Call first to allow WebRTC to continue connecting to the system by maintaining a persistent connection.
I just tested it and got good results.

I just saw that you wrote the article Clarifying call control support to answer a call or to make a call using Platform API. It's really good.
Thank you for sharing information.

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