×

To get the different call legs associated with a call, you need to make an HTTP GET request to

GET

https://<your_api_key>:<your_api_token><subdomain>/v3/accounts/<your_sid>/calls/<call_sid>/legs

Example (For Singapore Stamp)-

GET

https://<your_api_key<your_api_token>@ccm-api.exotel.com/v3/accounts/<your_sid>/calls/<call_sid>/legs

Example (For Mumbai Stamp)

GET

https://<your_api_key<your_api_token>@ccm-api.in.exotel.com/v3/accounts/<your_sid>/calls/<call_sid>/legs

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you OR use Basic Authentication.
  • Replace <your_sid> with your “Account sid”
  • Replace <subdomain> with the region of your account
    1. <subdomain> of Singapore cluster is @ccm-api.exotel.com
    2. <subdomain> of Mumbai cluster is @ccm-api.in.exotel.com
  • Replace <call_sid> with the Call Sid provided during Click to Call API request.

<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard

curl -X GET

https://<your_api_key@ccm-api.exotel.com/v3/accounts//calls//legs

-H 'content-type: application/json'

 

HTTP Response:

  • On success, the HTTP response status code will be 200

 

Response Parameter Description

Parameter Name

Type & Value

request_id

This indicates the unique id of the request. Useful for debugging and tracing purposes.

method

This indicates the HTTP method for the request such as GET/POST/PUT etc.

http_code

This indicates the HTTP code for the request such as 200, 400, 500 etc.

response

Response block contains the leg details for call sid passed in the path parameter. The block contains

  • code - This indicates the http code for the particular record in the response array like 200, 400 etc.
  • error_data - This block will be null if there is no error else contain error information for the response with following fields
    • code - This would be the error code useful for Exotel's team to debug and can be highlighted in case of unexpected errors.
    • description - This describes the details of the error.
    • message - This is the error message corresponding to the error code useful for Exotel's team to debug and can be highlighted in case of unexpected errors.
  • status - This field would indicate status of the response (success/failure).
  • leg_details - This block will contain the information corresponding to the response array element and will contain the fields for a call leg record as explained below. 

 

Description of parameters under 'leg_details' block:

Parameter Name

Description

sid

string; an alpha-numeric unique identifier of the call

from

Array of JSON blocks containing information about the 'from' leg. For outgoing calls, this array will contain all the user call leg (s) information. For incoming calls, this array will contain the customer call leg information. The JSON block contains:

 

  • sid - string; an alpha-numeric unique identifier of the leg,
  • name - string; name of user (can be null if not agent)
  • contact_uri - string; contact number associated with the leg
  • date_created - string, date time when this leg was created
  • date_updated - string, date time when this leg was last updated
  • status - string; (in-progress/ completed/failed/no-answer)

to

Array of JSON blocks containing information about the 'to' leg. For outgoing calls, this array will contain the customer call leg information. For incoming calls, this array will contain all the user call leg (s) information. The JSON block contains:

 

  • sid - string; an alpha-numeric unique identifier of the leg,
  • name - string; name of user (can be null if not user)
  • contact_uri - string; contact number associated with the leg
  • date_created - string, date time when this leg was created
  • date_updated - string, date time when this leg was last updated
  • status - string; (in-progress/ completed/failed/no-answer)
  • group_id - associated group id for the user (if applicable)
  • group_name - associated group name for the user (if applicable)

 

{
  "request_id": "faf6d9fd87eb4dd6aef3967c40e369ed",
  "method": "GET",
  "http_code": 200,
  "metadata": null,
  "response": {
    "code": 200,
    "error_data": null,
    "status": "success",
    "leg_details": {
      "call_sid": "f1ca1057692d586b23b4e7ffcc3216mk",
      "account_sid": "exotel",
      "from": [
        {
          "sid": "213f2560d153d744cd61eb81a98616ak",
          "name": "Aditya Sharma",
          "contact_uri": "0987xxxxxxx",
          "date_created": "2020-09-15 11:01:20+05:30",
          "date_updated": "2020-09-15 11:02:20+05:30",
          "status": "completed"
        },
        {
          "sid": "813f2660d153d744cd61eb81a98616ak",
          "name": null,
          "contact_uri": "09976xxxxxx",
          "date_created": "2020-09-15 11:03:20+05:30",
          "date_updated": "2020-09-15 11:04:20+05:30",
          "status": "completed"
        }
      ],
      "to": [
        {
          "sid": "922g2560d153d744cd61eb81a92616am",
          "name": "Vikas Sharma",
          "contact_uri": "sip:vikassffbbfc17",
          "date_created": "2020-09-15 11:01:20+05:30",
          "date_updated": "2020-09-15 11:02:20+05:30",
          "status": "no-answer",
          "group_id": 123456,
          "group_name": "test_group"
        },
        {
          "sid": "544r1560d153d754cd61tb83a77616ak",
          "name": "Sanjay Mishra",
          "contact_uri": "08887xxxxxx",
          "date_created": "2020-09-15 11:03:20+05:30",
          "date_updated": "2020-09-15 11:04:20+05:30",
          "status": "completed",
          "group_id": null,
          "group_name": null
        }
      ]
    }
  }
}

 

Possible error scenarios in case of this GET API

Http Code

Error Code

Description

500

-

Internal Server Error

500

10743

Legs not found

500

10715

Error retrieving leg details

429

10724

Too many requests (from Mavrix)

404

10744

Call not found

404

1017

Tenant not found

401

1010

Authentication failed