RingOut creating Outbound and Inbound calls

  • 1
  • Problem
  • Updated 10 months ago
  • (Edited)
I'm using the RingOut API to initiate calls for my customers and I'm monitoring the events. When I initiate a call to a number A, 2 calls are being created and I'm receiving events of both of them.

I'm sending the following body:
{
from: {phoneNumber: "NUMBER_A"},
to: {phoneNumber: "NUMBER_B"},
playPrompt: true
}
Then I start receiving the following events:
[{ 
       telephonyStatus: 'Ringing',
       from: 'NUMBER_A',
       id: '',
       to: 'NUMBER_B',
       sessionId: '35393577028',
       direction: 'Outbound' 
}]
The one above is ok, but then I receive these:
 [{
       telephonyStatus: 'Ringing',
       from: 'NUMBER_B',
       id: 'b536df52145149d6af765f47a2ec6ed9',
       to: 'NUMBER_A',
       sessionId: '35393581028',
       direction: 'Inbound'
},{
       telephonyStatus: 'CallConnected',
       from: 'NUMBER_A',
       id: 'c4e45991e1d84caa9dccd6e9b76d1e10',
       to: 'NUMBER_B',
       sessionId: '35393577028',
       direction: 'Outbound'
}]
See the call log below:

I'd like to know if I'm doing something wrong or if I could relate both events because I don't believe it's reliable to correlate the "from" and "to" properties from the events, or even if I could change the way I'm doing the RingOut and make it stop creating two calls, when it was suppose to just create an Outbound call. Any guidance here will be really appreciated!

Let me know if you need further information.
Photo of Rhaylander Almeida

Rhaylander Almeida

  • 90 Points 75 badge 2x thumb
  • confused

Posted 10 months ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,342 Points 5k badge 2x thumb
I confirm that RingOut does generate two call log records. Let me know if you have any questions.
Photo of Rhaylander Almeida

Rhaylander Almeida

  • 90 Points 75 badge 2x thumb
The issue I'm experiencing is the same as this guy did: https://devcommunity.ringcentral.com/ringcentraldev/topics/ringout-quirks

After the last response, I'm not sure if I understood what was the solution or what the guy had to do.

Let me know if really there isn't anything else to do.
Photo of Rhaylander Almeida

Rhaylander Almeida

  • 90 Points 75 badge 2x thumb
Hi Tyler, have you had the chance to take a look at the reference I've sent?
It's really important for us to receive an answer from you guys before we take the next step, otherwise we could just waste time going into the wrong direction.
Photo of AK

AK, Official Rep

  • 4,372 Points 4k badge 2x thumb
There would be two call logs or rather two records within the active calls object of the API response when you receive a Presence notification as below:

{
  "uuid": "3219598113702261466-7473112250947924986",
  "timestamp": "2017-07-14T17:29:10.968Z",
  "subscriptionId": "103a9249-a0d9-420c-a545-fecc97ff6782",
  "body": {
    "extensionId": 734191020,
    "telephonyStatus": "Ringing",
    "activeCalls": [
      {
        "id": "9834152a1f624655b8e9065d3accb384",
        "direction": "Inbound",
        "fromName": "xxxx xxxx     ",
        "from": "RingCentral Number (ext number)",
        "toName": "Anil Digital Line Only",
        "to": "Customer Number",
        "telephonyStatus": "Ringing",
        "startTime": "2017-07-14T17:28:59.314Z"
      },
      {
        "id": "a3945590afb8496c8d0a5553842a042a",
        "direction": "Outbound",
        "fromName": "Anil Digital Line Only",
        "from": "RingCentral Number",
        "toName": "Customer Name",
        "to": "Customer Number",
        "telephonyStatus": "CallConnected",
        "sessionId": "158674552020",
        "startTime": "2017-07-14T17:28:59.220Z"
      }
    ],
    "sequence": 555006,
    "presenceStatus": "Available",
    "userStatus": "Available",
    "dndStatus": "TakeAllCalls",
    "allowSeeMyPresence": true,
    "ringOnMonitoredCall": false,
    "pickUpCallsOnHold": false
  }
}
As you are initiating a Ringout between one of the numbers on your account and an external number / Internal number you would see the active calls for the two legs. 

If you would like to just refer to a single call log record then you could refer to the records with the direction: "Outbound"

As the sessionID remains the same for this leg ( direction: " Outbound / Inbound " ) across all the three events:

1.) Ringing
2.) Call Connected
3.) No Call 
Photo of karthika r

karthika r

  • 60 Points
@AK But what if another incoming call comes at the same time when the number A is talking to number B . We may miss that particular call log from our side if we refer only direction as Outbound.
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,342 Points 5k badge 2x thumb
I did lots of investigation. And our internal development team also faces this issue and there is no perfect solution yet.

There is a solution which works most of the time (maybe 99%):
Outbound fromNumber = inbound toNumber 
&& 
Math.abs(outbound sessionId – inbound sessionId) is one of 1000, 2000, 3000, 4000.

Then you can assert that they are actually two legs of the same call instead of two separate calls.
(Edited)