question

andrey-demenev247 avatar image
andrey-demenev247 asked ·

Ringout quirks

I am expierencing strange behavior of Ringout APIs

I make a Ringout call, with a subscription to /restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true. When the call, is initiated, I receive a notification where activeCalls has one entry:

[   {    direction: "Outbound",    from: "12296386813",    sessionId: "777723541012",    telephonyStatus: "Ringing",    to: "18008768533"   }  ]  
so far, soo good

when softpfone rings, another notofication comes, with 2 entries in activeCalls:

[    {      direction: "Inbound",      from: "18008768533",      id: "f7a273c803be43f59b3d76927f43e2a2",      sessionId: "777723542012",      telephonyStatus: "Ringing",      to: "12296386813"    },    {      direction: "Outbound",      from: "12296386813",      id: "7fded2188141416b88b6c9355069e991",      sessionId: "777723541012",      telephonyStatus: "CallConnected",      to: "18008768533"    }  ]  

Inbound? And outbound connected ?

After the call is finished, I request call log. And here is what I see:

[    {      "uri":"https://platform.ringcentral.com/restapi/v1.0/account/2547887012/extension/2547889012/call-log/QFTvxOsxQ4xoEcE?view=Simple",      "id":"QFTvxOsxQ4xoEcE",      "sessionId":"777723542012",      "startTime":"2015-11-11T06:19:53.000Z",      "duration":31,      "type":"Voice",      "direction":"Inbound",      "action": "Phone Call",      "result":"Missed",      "to": {"phoneNumber":"+12296386813", "name":"Michael Whitehead", "location":"Albany, GA"},      "from": {"phoneNumber":"+18008768533"}    },    {      "uri":"https://platform.ringcentral.com/restapi/v1.0/account/2547887012/extension/2547889012/call-log/QFTvw4fryy7eEcA?view=Simple",      "id":"QFTvw4fryy7eEcA",      "sessionId":"777723541012",      "startTime":"2015-11-11T06:19:52.000Z",      "duration":32,      "type":"Voice",      "direction":"Outbound",      "action":"RingOut Web",      "result":"No Answer",      "to":{"phoneNumber":"+12296386813","name":"Michael Whitehead","location":"Albany, GA"},      "from":{"name":"Michael Whitehead"}    }  ]    
I understand these are 2 legs of same call, but how do I figure that out?

Now I look at the calls log at  https://service.ringcentral.com



Same info, very misleading

And same in Mac app:



Interestingly, when using sandbox, the call log at  https://service.devtest.ringcentral.com only has one record per call, and so does call log returned from API call

Also, API docs say that call log records should contain information about call legs - but that info is never returned.

This makes the API absolutely unusable for me. What I am doing wrong?

topic-default
1 |1000 characters needed characters left characters exceeded

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

andrey-demenev247 avatar image
andrey-demenev247 answered ·
And one more thing. The docs state that /restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log accepts view parameter. When I set it to "Detailed", the API returns 501 (Not Implemented)
Share
1 |1000 characters needed characters left characters exceeded

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

vb avatar image
vb answered ·
As your app is a public app, we donot allow you to fetch detailed call-log ( you cannot use the detailed filter via  call-log api) . 

With the first part of the question, I assume you are logged in as an Admin when making presence API call. 

Here is a overview of how Ringout works:

If you are making a ringout within your account  to make calls between A and B;

Assuming you set your play prompt flag to true;

1. RingCentral initiates the First-leg of the call to A ( You see the presence for A when ringing) 
2. When A is connected,  it rings B ( You see presence for A showing "Connected", B showing "Ringing". When B picks up the call you see presence for B showing "Connected" )

These are the 2 legs of the call you see in the service-web when you choose "Detailed View".

A's callerID sees B's phone number and B's callerId see RingCentral phone number.


Some ringout questions are being answered here: 

https://devcommunity.ringcentral.com/ringcentraldev/topics/how-can-you-configure-the-first-leg-of-ri...

https://devcommunity.ringcentral.com/ringcentraldev/topics/here-is-how-you-can-make-an-outgoing-call...



Share
1 |1000 characters needed characters left characters exceeded

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

andrey-demenev247 avatar image
andrey-demenev247 answered ·
1. RingCentral initiates the First-leg of the call to A ( You see the presence for A when ringing) 2. When A is connected,  it rings B ( You see presence for A showing "Connected", B showing "Ringing". When B picks up the call you see presence for B showing "Connected" 

From application user's POV, he (A) is making a call to B. And when a presence event arrives, I should be able to show to user that he is making an outgoing call to B. 

How can I interpret this?

[   {     direction: "Inbound",     from: "18008768533",     id: "f7a273c803be43f59b3d76927f43e2a2",     sessionId: "777723542012",     telephonyStatus: "Ringing",     to: "12296386813"   },   {     direction: "Outbound",     from: "12296386813",     id: "7fded2188141416b88b6c9355069e991",     sessionId: "777723541012",     telephonyStatus: "CallConnected",     to: "18008768533"   } ]
It says that my outbound call is connected, and at the same time time I have an inbound call from the same number I am calling. I could understand if these 2 records were returned as 2 legs of same call, because they in fact are such legs. But they are separate in the server reply. Of course, I can match them using from and to fields, but I think this is not going to be very reliable
Share
1 |1000 characters needed characters left characters exceeded

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

benjamin-dean avatar image
benjamin-dean answered ·
Hey Andrey,

The sessionId is a unique identifier which could be used to map a single call and the logic to identify the related "inbound" and "outbound" directions for the call-legs in conjunction with the value of the "from" field.

Since you know the values of your organization's "from", it can be used to distinguish between the various legs of the call.

Does this make sense?
Share
1 |1000 characters needed characters left characters exceeded

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

andrey-demenev247 avatar image
andrey-demenev247 answered ·
How can I use sessionId in the situation above? We have 2 records with 2 different sessionId's. The only way to match the records is using from and to.

 Since you know the values of your organization's "from"
I don't. That's not my organization, that's my client using my app. What if call forwarding happens? 

By the way, the situation described here is kinda marginal. I have found out that it only happens when user has no phones associated with him. I had a user without any phones associated with his account. I ran softphone, logged in as that user, and API calls were made on behalf of that user. Once I added softphone to the user, the presense notifications only have one record per call. So far, so good

The problem now is what is returned in call log if I make a ringout call, and press "Ignore" button in softphone
{    "uri":"https://platform.ringcentral.com/restapi/v1.0/account/2547887012/extension/2547889012/call-log/QHPmDSxLws7nq-U?view=Simple",    "id":"QHPmDSxLws7nq-U",    "sessionId":"779185683012",    "startTime":"2015-11-13T00:19:57.000Z",    "duration":11,    "type":"Voice",    "direction":"Outbound",    "action":"RingOut Web",    "result":"Busy",    "to": { "phoneNumber":"+12296386813", "name":"Michael Whitehead","location":"Albany, GA" },    "from":{"name":"Michael Whitehead"}  }  
How can I interpret this? Outbound call to my own phone number? From what number? Where is other party's number? 
Share
1 |1000 characters needed characters left characters exceeded

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

benjamin-dean avatar image
benjamin-dean answered ·
Hey Andrey,

/*** Session ID Case ***/
OK, you're right...those values are not identical (they're off by a single digit which I didn't catch visually).

Hrm...that's a problem indeed. I was under the assumption that sessionId was supposed to be a unique identifier across multiple legs of a cal (and at first glance the numbers are nearly identical except for a single digit).

So I went to our engineering team and here is the answer they provided me:
Usually RingOut has just one presence event when "from" number is 1) either external PSTN number 2) or direct device (DL) number associated with extension.

In this particular case, there are really two sessions because you have specified your own RC phone number as a "from" number.
/*** Call Forwarding Case ***/
If call forwarding happens, then the presence events will no longer be emitted. Presence events are only associated to a User/Extension (not a device).
Share
1 |1000 characters needed characters left characters exceeded

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

Tyler Liu avatar image
Tyler Liu answered ·
The following workaround works most of the time:
Outbound fromNumber = inbound toNumber 
&&
Math.abs(outbound sessionId inbound sessionId) is one of 1000, 2000, 3000, 4000.
Then you can assert that they are two legs of the same call instead of two separate calls.

However it is not official and I won't say it will always work.
Share
1 |1000 characters needed characters left characters exceeded

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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