question

gaash-granot6752 avatar image
gaash-granot6752 asked Vineskills Team commented

call legs logic

what is the logic of the call legs?

i mean - what's the rationale behind the creation of each leg?


i need to download call recordings. some times, the call has a few legs, each one has a recording element inside it. since i need to use the name of the caller and the called, how can

i decide, programmatically, which leg to use?

the names in the call's data ("to" \ "from" elements), most of the time if not in all cases, doesn't match the names in the legs' data ("leg.to" \ "leg.from" elements).


for instance, in the following call, there are 3 legs with recording elements.

what's the difference between them?


thanks,





{


"uri": URI,

"id": ID,

"sessionId": ID,

"startTime": "2017-10-18T16:00:44.059Z",

"duration": 60,

"type": "Voice",

"direction": "Inbound",

"action": "Phone Call",

"result": "Accepted",

"to": {


"phoneNumber": SOME_NUMBER

},

"from": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME,

"location": SOME_LOCATION

},

"recording": {


"uri": CALL_URI,

"id": ID,

"type": "Automatic",

"contentUri": CONTENT_URI

},

"transport": "PSTN",

"lastModifiedTime": "2017-10-18T16:00:44.059Z",

"billing": {


"costIncluded": 0,

"costPurchased": 0

},

"legs": [

{


"startTime": "2017-10-18T16:00:44.059Z",

"duration": 60,

"type": "Voice",

"direction": "Inbound",

"action": "Phone Call",

"result": "Accepted",

"to": {


"phoneNumber": SOME_NUMBER

},

"from": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME,

"location": SOME_LOCATION

},

"recording": {


"uri": SOME_URI,

"id": ID,

"type": "Automatic",

"contentUri": CONTENT_URI

},

"transport": "PSTN",

"billing": {


"costIncluded": 0,

"costPurchased": 0

},

"legType": "Accept"

},

{


"startTime": "2017-10-18T16:00:44.059Z",

"duration": 60,

"type": "Voice",

"direction": "Inbound",

"action": "Phone Call",

"result": "Accepted",

"to": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME

},

"from": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME,

"location": SOME_LOCATION

},

"recording": {


"uri": CALL_URI,

"id": ID,

"type": "Automatic",

"contentUri": CONTENT_URI

},

"transport": "PSTN",

"legType": "Accept",

"extension": {


"uri": SOME_URI,

"id": ID

}

},

{


"startTime": "2017-10-18T16:00:44.059Z",

"duration": 42,

"type": "Voice",

"direction": "Outbound",

"action": "FindMe",

"result": "Accepted",

"to": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME,

"location": SOME_LOCATION

},

"from": {


"phoneNumber": SOME_NUMBER,

"name": SOME_NAME,

"device": {


"uri": ID,

"id": ID

}

},

"recording": {


"uri": CALL_URI,

"id": ID,

"type": "Automatic",

"contentUri": CONTENT_URI

},

"transport": "PSTN",

"legType": "FindMe",

"extension": {


"uri": ID,

"id": ID

}

}

]

},




getting started
1 |3000

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

Phong Vu avatar image
Phong Vu answered Phong Vu commented
Hi Gaash,

This doc should give you an overall about call legs.  https://www.hh.se/download/18.70cf2e49129168da015800092965/4_1_Call_Establishment_Principles.pdf.

Or the short description of call legs:
A voice call over a packet network is segmented into discrete call legs. Each call leg is associated with a dial peer. A call leg is a logical connection between two voice gateways or between a gateway and an IP telephony device.

Hope this helps,
+ Phong
3 comments
1 |3000

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

gaash-granot6752 avatar image gaash-granot6752 commented ·
thanks! i'll read it in depth later on, but a first glimpse show that it's exactly what i needed!
:)

0 Likes 0 ·
Eric Wetterstroem avatar image Eric Wetterstroem gaash-granot6752 commented ·

Link to document is broken

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Eric Wetterstroem commented ·

Not sure why the document was taken down. But you can easily google for call legs specs.

0 Likes 0 ·
ak avatar image
ak answered Helgi Sigurdsson commented
Thanks Phong. 

Hi Gaash,

To add to Phong's answer, you can also look at the FAQ below on:
Using Detailed Call Log Data



1 comment
1 |3000

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

Helgi Sigurdsson avatar image Helgi Sigurdsson commented ·

that link is also broken. Ringcentral seems to mess up the data if I look at it. You would think that a block

"from":{
                "name":"WIRELESS CALLER",
                "phoneNumber":"+1404xxxxxxx",
                "location":"Atlanta, GA"

should retain the same, but the queues in the Ring Central system replace the name (not the number).

0 Likes 0 ·
Muhammad Anwar avatar image
Muhammad Anwar answered
1 |3000

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

Vineskills Team avatar image
Vineskills Team answered Vineskills Team commented

Hey everyone. After going down a rabbit hole trying to figure out how to write a SQL query to condense a Detailed Call Log into a Simplified Call Log where each call is a single row...

Is it safe to say that if you ONLY pull the leg where Master = 'True' from a detailed Call Log, it will give you the same results as a simplified call log? Is that it?

Or is there some other logic on how to get to a 1 Call = 1 row ?

2 comments
1 |3000

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

Phong Vu avatar image Phong Vu ♦♦ commented ·

Yes, the Simple view returns no legs data. The Detailed view returns legs data including the 'master' leg which is the same as the data in the first level of the response in both view modes.

1 Like 1 ·
Vineskills Team avatar image Vineskills Team Phong Vu ♦♦ commented ·

Thank you, Phong; the issue I've found is this:
If a "receptionist" answered an Inbound call and then transferred to an extension (agent_123), the master leg will show the "to_name" as the "receptionist" who answered the call and not the final agent who handled the call. Is that correct?
I want to know the final person who handled the call and not the first person to answered the call.
How could I do that systematically?
Thank you for your help!

0 Likes 0 ·

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