question

Greg Rossi avatar image
Greg Rossi asked Phong Vu answered

Getting Call Session Status for Call Log records

I have an application that downloads call logs. I would like to get the Call Session Status for each call log record. However, I get 404s when accessing the telephony/sessions endpoint. No doubt this is something simple; I'm hoping that someone can give me a pointer.

The app is provisioned with Call Control and Read Call Log permissions.

In the API explorer, I authenticate with the app in the sandbox. Issuing a request against the call-log endpoint returns records like this:

{
  ...
  "records": [
    {
      "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/297618004/extension/297618004/call-log/AiIqKidyZEHuzUA?view=Simple",
      "id": "AiIqKidyZEHuzUA",
      "sessionId": "25791899004",
      "startTime": "2021-06-29T18:14:30.968Z",
      "duration": 19,
      "type": "Voice",
      "internalType": "LongDistance",
      "direction": "Outbound",
      "action": "RingOut PC",
      "result": "Call connected",
      "to": {
        "phoneNumber": "+1512587XXXX",
        "location": "Austin, TX"
      },
      "from": {
        "name": "Mike XXXX",
        "phoneNumber": "+1424316XXXX",
        "extensionId": "29761XXXX"
      },
      "extension": {
        "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/297618004/extension/297618004",
        "id": 29761XXXX
      },
      "telephonySessionId": "s-3e9b01063b6042548ba69b8f4975800b"
    },
    ...
  ],
  ...
}

If I drop the telephonySessionId value from the above response into the API explorer and hit the telephony/sessions endpoint, I get a 404. The curl command from API explorer:

curl --request GET \
  --url 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/telephony/sessions/s-3e9b01063b6042548ba69b8f4975800b' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer ...

The response is:

HTTP/1.1 404 Not Found

Server: nginx
Date: Tue, 29 Jun 2021 19:55:51 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
X-Rate-Limit-Group: light
X-Rate-Limit-Limit: 50
X-Rate-Limit-Remaining: 49
X-Rate-Limit-Window: 60
RoutingKey: SJC11P01
RCRequestId: 017a339e-d914-11eb-aa39-005056bb4bfe
Connection: keep-alive

It would appear that the telephonyStatusId is incorrect and thus causes a 404.

What is the correct way to do this? If the telephonySessionId from the call log is not the correct value, where do I find it?

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

This is totally incorrect and 404 response is expected.

A call session status exists only when a call is active. When you read the call log, you read completed calls info. Thus, the active call is no longer existed.

Try again with the get user or company active calls API to read active calls, get the telephonySessionId of that active call and call the get call session status.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys