News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
call legs logic
Tags: getting started
Dec 4, 2017 at 5:48am   •   4 replies  •  0 likes
gaash-granot

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

}

}

]

},




4 Answers
answered on Mar 2, 2024 at 7:04pm  

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 ?


 0
answered on Feb 9, 2021 at 7:10am  

 0
answered on Dec 4, 2017 at 5:08pm  
Thanks Phong. 

Hi Gaash,

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




 0
on Feb 8, 2021 at 11:48am   •  0 likes

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).

answered on Dec 4, 2017 at 4:51pm  
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

 1



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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us