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?
Outbound fromNumber = inbound toNumberThen you can assert that they are two legs of the same call instead of two separate calls.
&&
Math.abs(outbound sessionId inbound sessionId) is one of 1000, 2000, 3000, 4000.
However it is not official and I won't say it will always work.
/*** 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./*** Call Forwarding Case ***/
In this particular case, there are really two sessions because you have specified your own RC phone number as a "from" number.
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).
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?
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?
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
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...
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder