Unable to accept incoming call via API

Hi!

I read a lot of topics here for the theme, but still didn't get answer.
I'm trying to accept incoming call by API, here is my code snippet

  const platformClient = require('purecloud-platform-client-v2');
  const client = platformClient.ApiClient.instance;
  
  client.setAccessToken(accessToken);
  ////// here is an incoming call notification handler, callId provided 
  const callsApi = new platformClient.ConversationsApi();

  return callsApi.getConversationsCall(callId).then((callResponse) => {
        const holdAllQueue = callResponse.participants.map((participant) => {
            return callsApi.patchConversationsCallParticipant(callId, participant.id, {"state": "connected"});
        });

    return Promise.all(holdAllQueue)

I got success and empty responses [{},{}] for each query, but call still stayed ringing.

Do you have a correlation id for that request?

and is this being done with a implicit/code auth grant type?

Hi!
I used access token obtain by "OAuth Grant - Authorization Code"
https://developer.mypurecloud.com/api/rest/authorization/use-authorization-code.html

For the first participant

 'inin-correlation-id': '20e04121-7c44-4a90-a414-1eb9a69d7bf1',
    'inin-ratelimit-count': '2',
    'inin-ratelimit-allowed': '300',
    'inin-ratelimit-reset': '60',
    'cache-control': 'no-cache, no-store, must-revalidate',
    pragma: 'no-cache',
    expires: '0',
    'x-cache': 'Miss from cloudfront',
    via: '1.1 48e3cf3ee71856983cda4c8805113c56.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'axDmAg7ceUgD8PEZfKhdk1zzx7ZR_bWotqtqX__6N_OpYywAbEZxBA==' },

method: 'PATCH',
     path: '/api/v2/conversations/calls/a7637067-d207-44b8-ae12-5cb7c22adc94/participants/e5789e59-228b-454e-a165-c8a4a9d0686d',

For the second participant

headers: 
      { 'content-type': 'application/json',
        'content-length': '2',
        connection: 'close',
        date: 'Tue, 06 Mar 2018 09:56:52 GMT',
        'inin-ratelimit-count': '3',
        'inin-ratelimit-allowed': '300',
        'inin-ratelimit-reset': '60',
        'inin-correlation-id': '20c6fd1f-a827-4ec1-b447-f3e3e36e0f26',
        'cache-control': 'no-cache, no-store, must-revalidate',
        pragma: 'no-cache',
        expires: '0',
        'x-cache': 'Miss from cloudfront',
        via: '1.1 48e3cf3ee71856983cda4c8805113c56.cloudfront.net (CloudFront)',
        'x-amz-cf-id': '_EpLGhzMCHnca7ooPJSaIPej3gzQ-_WZ0or6mq6WRDgrekTmdJWtrQ==' },

method: 'PATCH',
     url: 'https://api.mypurecloud.com/api/v2/conversations/calls/a7637067-d207-44b8-ae12-5cb7c22adc94/participants/b5af2f5c-404d-4ff5-b371-ce23dff73360',

is this a webrtc station? if so this probably applies https://developer.mypurecloud.com/forum/t/product-feature-place-calls-via-api-with-webrtc-phone/848

It doesn't matter WebRTC or default PureCloud's calller under the "Calls" tab.
I'm using https://github.com/MyPureCloud/platform-client-sdk-javascript latest version 19.0.2

I have 2 accounts, let's say User1 and User2.
I logged in with User1 under Chromes Anonymous mode window
I logged in with User2 unde Chromes normal mode window

Both users have "Placing calls with another app?" turned OFF

In User1 page (https://apps.mypurecloud.com/directory/#) in call tab I press button
"Call" to User2

On my service i have configured callback with "call event" provided

{
  "topicName": "v2.users.22384787-8a7f-47b7-99ba-951083c5a1dc.conversations.calls",
  "version": "2",
  "eventBody": {
    "recordingState": "none",
    "participants": [
      {
        "muted": false,
        "confined": false,
        "recording": false,
        "recordingState": "none",
        "id": "ed168a9d-31d9-4383-b411-e531ab32853f",
        "address": "sip:5a9015a04cd4101e11be37bd+tenfolddemo.orgspan.com@localhost",
        "connectedTime": "2018-03-07T09:52:16.148Z",
        "purpose": "user",
        "state": "connected",
        "direction": "outbound",
        "held": false,
        "wrapupRequired": false,
        "user": {
          "id": "22384787-8a7f-47b7-99ba-951083c5a1dc"
        },
        "attributes": {},
        "provider": "Edge"
      },
      {
        "muted": false,
        "confined": false,
        "recording": false,
        "recordingState": "none",
        "id": "88748f6d-ab49-4b09-92ef-69477c8c851e",
        "address": "sip:5a8d8f20b9544e1def0caaf8+tenfolddemo.orgspan.com;tgrp=7a5fb3f0-4879-4f96-96ba-c4272091b534;trunk-context=tenfoldDemo@localhost",
        "endTime": "2018-03-07T09:52:16.070Z",
        "purpose": "user",
        "state": "disconnected",
        "direction": "inbound",
        "disconnectType": "transfer.noanswer",
        "held": false,
        "wrapupRequired": false,
        "user": {
          "id": "0527c0b4-4b3b-41d1-b7bc-51af7f438c56"
        },
        "attributes": {},
        "provider": "Edge",
        "peer": "3cb97957-a18e-46f5-8e96-253cc8ee0958"
      },
      {
        "muted": false,
        "confined": false,
        "recording": false,
        "recordingState": "none",
        "id": "cbbac5c4-e9e7-465c-8013-b574d3526604",
        "address": "sip:5a8d8f20b9544e1def0caaf8+tenfolddemo.orgspan.com@127.0.0.1;language=en-US;user=voicemail",
        "connectedTime": "2018-03-07T09:52:16.142Z",
        "purpose": "voicemail",
        "state": "connected",
        "direction": "inbound",
        "held": false,
        "wrapupRequired": false,
        "user": {
          "id": "0527c0b4-4b3b-41d1-b7bc-51af7f438c56"
        },
        "attributes": {},
        "provider": "Edge",
        "peer": "3cb97957-a18e-46f5-8e96-253cc8ee0958"
      }
    ],
    "id": "4d7bbac9-4872-4f11-ae61-c69bf1fd91ee"
  }
}

i trigger the code pasted here https://developer.mypurecloud.com/forum/t/unable-to-accept-incoming-call-via-api/2559?u=dmitriy_gusev
Got callback status 200, and empty bodies for all [{},{},{}]

BUT on both User1 and User2 UI nothing chages. User2 still has state with answer and decline call buttons

Please also take a look at this question

Please provide a correlation ID from the response to trying to answer the call.

User1

    headers: 
  { 'content-type': 'application/json',
    'content-length': '2',
    connection: 'close',
    date: 'Wed, 07 Mar 2018 16:02:29 GMT',
    'inin-correlation-id': '6262cdc8-9681-4dcf-9be0-0082bfa265b4',
    'inin-ratelimit-count': '2',
    'inin-ratelimit-allowed': '300',
    'inin-ratelimit-reset': '60',
    'cache-control': 'no-cache, no-store, must-revalidate',
    pragma: 'no-cache',
    expires: '0',
    'x-cache': 'Miss from cloudfront',
    via: '1.1 55ee6ea70e0823309f10db2e4b8f119f.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'dwt6IFQpa7LRVTAExJ-73-O0BOYEfOoBDZc0L3UJGif1PTmyP1W8cg==' },

PATCH /api/v2/conversations/calls/7bbc3788-dc5c-495c-9192-4e52a09571b6/participants/50d1447d-e107-46db-95c1-958fb79a61c5

User2

headers: 
      { 'content-type': 'application/json',
        'content-length': '2',
        connection: 'close',
        date: 'Wed, 07 Mar 2018 16:02:30 GMT',
        'inin-correlation-id': '628afe7b-8565-4051-9f9a-818d3282054f',
        'inin-ratelimit-count': '3',
        'inin-ratelimit-allowed': '300',
        'inin-ratelimit-reset': '60',
        'cache-control': 'no-cache, no-store, must-revalidate',
        pragma: 'no-cache',
        expires: '0',
        'x-cache': 'Miss from cloudfront',
        via: '1.1 c438f26ccd08e3dcd1f5cc4a61417fde.cloudfront.net (CloudFront)',
        'x-amz-cf-id': 'OgyZYLEYN8hH24PLwEBzWmOM9shwF0IHgIPmSAHOG_9bZXscc7uBRA==' },

PATCH /api/v2/conversations/calls/7bbc3788-dc5c-495c-9192-4e52a09571b6/participants/0811f007-26cc-4f18-ae04-6a229eb92374

The API requests are being accepted and sent to the edge for processing. That's as far as I can investigate via the forum. You'll need to open a ticket with PureCloud Support to investigate further.

However, note that you cannot answer calls via the API when using a WebRTC station. If this only happens when using a WebRTC station, that's why. If this is happening with physical stations, as you seemed to indicate above, please proceed to open a ticket with PureCloud Support.

Is this a WebRTC station?

32

Call came from here
27

API doesn't work even with native pure cloud's UI.

How can i open a ticket with PureCloud Support ?

I can't tell. Your screenshots don't show the station information. You can find more information about using WebRTC phones here: https://help.mypurecloud.com/articles/select-purecloud-webrtc-phone-as-your-phone/

Information is here: https://help.mypurecloud.com/articles/contact-purecloud-care/

Now i got you. Thanks.
There was WebRTC phone configured even for PureClouds UI.

So, for other cases provided code snippet should work, is that correct?

I tried to setup PureCloud Softphone, got some issues with Phone provisioning server.
Is there any manuals, where can i get "Phone provisioning server" fields value?

So, for other cases provided code snippet should work, is that correct?

Yes, you can use the API to answer calls using other station types, just not WebRTC.

Is there any manuals

Information about the softphone can be found on the resource center: https://help.mypurecloud.com/articles/about-purecloud-softphone/

If you have further questions about configuring or using the softphone, those questions would be best suited for the PureCloud Community Forum, which is focused on product questions/support.

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