×

To get details of a call (including Status, Price, etc.), you will need to make a HTTP GET request to

GET

https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/<CallSid>

Where <CallSid> is an alpha-numeric unique identifier generated for all the calls made via Exotel.

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you.
  • Replace <your_sid> with your “Account sid”
  • Replace <subdomain> with the region of your account
    1. <subdomain> of Singapore cluster is @api.exotel.com
    2. <subdomain> of Mumbai cluster is @api.in.exotel.com

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

In the case of an outbound call originated via the API, the Sid parameter is as returned in the XML/JSON response to your request. In the case of inbound calls, you can get the Sid by using the Passthru applet.

curl https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25
 
var request = require('request');

var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25'
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$response = Requests::get('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25', $headers);
import requests

requests.get('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25')
require 'net/http'
require 'uri'

uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25")
response = Net::HTTP.get_response(uri)

# response.code
# response.body

HTTP Response:

  • On success, the HTTP response status code will be 200
  • the HTTP body will contain an XML similar to the one below
{
  "Call": {
    "Sid": "b6cfaf5f5cef3ca0fc937749ef960e25",
    "ParentCallSid": "",
    "DateCreated": "2016-11-29 15:58:45",
    "DateUpdated": "2016-11-29 16:00:09",
    "AccountSid": "Exotel",
    "To": "0XXXXX20000",
    "From": "0XXXXX30240",
    "PhoneNumberSid": "0XXXXXX4890",
    "Status": "completed",
    "StartTime": "2016-11-29 15:59:10",
    "EndTime": "2016-11-29 15:59:27",
    "Duration": "17",
    "Price": "1.500",
    "Direction": "outbound-api",
    "AnsweredBy": "human",
    "ForwardedFrom": "",
    "CallerName": "",
    "Uri": "/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25",
    "RecordingUrl": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/<your_sid>/b6cfaf5f5cef3ca0fc937749ef960e25.mp3"
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
 <Call>
  <Sid>b6cfaf5f5cef3ca0fc937749ef960e25</Sid>
  <ParentCallSid></ParentCallSid>
  <DateCreated>2017-02-17 14:16:03</DateCreated>
  <DateUpdated>2017-02-17 14:17:32</DateUpdated>
  <AccountSid>Exotel</AccountSid>
  <To>0XXXXX20000</To>
  <From>0XXXXX30240</From>
  <PhoneNumberSid>0XXXXXX4890</PhoneNumberSid>
  <Status>completed</Status>
  <StartTime>2017-02-17 14:16:03</StartTime>
  <EndTime>2017-02-17 14:16:20</EndTime>
  <Duration>17</Duration>
  <Price>0.750</Price>
  <Direction>inbound</Direction>
  <AnsweredBy>human</AnsweredBy>
  <ForwardedFrom></ForwardedFrom>
  <CallerName></CallerName>
  <Uri>/v1/Accounts/<your_sid>/Calls/b6cfaf5f5cef3ca0fc937749ef960e25</Uri>
  <RecordingUrl>https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/<your_sid>/b6cfaf5f5cef3ca0fc937749ef960e25.mp3</RecordingUrl>
 </Call>
</TwilioResponse>

Description of parameters mentioned in the above response:

Parameter Name Type & Value
Sid string; an alpha-numeric unique identifier of the call
DateCreated Date and time at which the user initiated the API
DateUpdated Date and time at which the status of the call was last updated in our system
AccountSid Your account SID
To Your customer's phone number
From The phone number that will be called first
PhoneNumberSid This is your ExoPhone/Exotel Virtual Number
Status

Overall call status, which could be one of:

  • queued - The call is ready and waiting in line before going out
  • ringing - The call is currently in-flight
  • in-progress - The call was answered and is currently in progress
  • completed - The call was answered and has ended normally
  • failed - The call could not be completed as dialled, most likely because the phone number was non-existent
  • busy - The caller received a busy signal
  • no-answer - The call ended without being answered
StartTime Time in format YYYY-MM-DD HH:mm:ss; Date and time when the call request was initiated to the operator
EndTime Time in format YYYY-MM-DD HH:mm:ss; Date and time when the call was completed
Duration Call duration in seconds
Price Double; If present, this will be the amount (in INR or USD) you have been charged for the call
Direction
  • inbound
  • outbound-dial - Outbound calls from Exotel dashboard
  • outbound-api - All other Outbound calls (API, campaign etc.)
AnsweredBy human
Uri Uri is the path of the CallSid
RecordingUrl Link to the call recording

If status of both the call legs are required incase of an outbound call, you will need to make an HTTP GET request to

GET

https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/<CallSid>?details=true

HTTP Response:

  • On success, the HTTP response status code will be 200
  • the HTTP body will contain an XML similar to the one below
{
  "Call": {
    "Sid": "b6cfaf5f5cef3ca0fc937749ef96d245",
    "ParentCallSid": "",
    "DateCreated": "2016-11-29 15:58:45",
    "DateUpdated": "2016-11-29 16:00:09",
    "AccountSid": "Exotel",
    "To": "0XXXXX30240",
    "From": "0XXXXX85175",
    "PhoneNumberSid": "0XXXXXX4890",
    "Status": "completed",
    "StartTime": "2016-11-29 15:59:10",
    "EndTime": "2016-11-29 15:59:27",
    "Duration": "17",
    "Price": "1.500",
    "Direction": "outbound-api",
    "AnsweredBy": "human",
    "ForwardedFrom": "",
    "CallerName": "",
    "Uri": "/v1/Accounts/Exotel/Calls/b6cfaf5f5cef3ca0fc937749ef96d245",
    "RecordingUrl": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/Exotel/b6cfaf5f5cef3ca0fc937749ef96d245.mp3",
    "Details": {
      "ConversationDuration": 8,
      "Leg1Status": "completed",
      "Leg2Status": "completed"
      "Legs": [
        {    "Leg": {
              "Id": "1",
              "OnCallDuration": 21
             }
        },
        {    "Leg": {
             "Id": "2",
             "OnCallDuration": 8
             }
        }
      ]
    }
  }
}

<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
    <Call>
        <Sid>b6cfaf5f5cef3ca0fc937749ef96d245</Sid>
        <ParentCallSid></ParentCallSid>
        <DateCreated>2016-11-29 15:58:45</DateCreated>
        <DateUpdated>2016-11-29 16:00:09</DateUpdated>
        <AccountSid>Exotel</AccountSid>
        <To>0XXXXX30240</To>
        <From>0XXXXX85175</From>
        <PhoneNumberSid>0XXXXXX4890</PhoneNumberSid>
        <Status>completed</Status>
        <StartTime>2016-11-29 15:59:10</StartTime>
        <EndTime>2016-11-29 15:59:27</EndTime>
        <Duration>17</Duration>
        <Price>1.500</Price>
        <Direction>outbound-api</Direction>
        <AnsweredBy>human</AnsweredBy>
        <ForwardedFrom></ForwardedFrom>
        <CallerName></CallerName>
        <Uri>/v1/Accounts/Exotel/Calls/b6cfaf5f5cef3ca0fc937749ef96d245</Uri>
        <RecordingUrl>https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/Exotel/b6cfaf5f5cef3ca0fc937749ef96d245.mp3</RecordingUrl>
        <Details>
            <ConversationDuration>8</ConversationDuration>
            <Leg1Status>completed</Leg1Status>
            <Leg2Status>completed</Leg2Status>
            <Legs>
                <Leg>
                    <Id>1</Id>
                    <OnCallDuration>21</OnCallDuration>
                </Leg>
                <Leg>
                    <Id>2</Id>
                    <OnCallDuration>8</OnCallDuration>
                </Leg>
            </Legs>
        </Details>
    </Call>
</TwilioResponse>

Description of parameters mentioned in the above response:

Parameter Name Value
ConversationDuration The duration for the From and To phone numbers on call in seconds
Leg1Status

Status of the first leg of the call. Can be one of

  • queued - The call is ready and waiting in line before going out
  • ringing - The call is currently in-flight
  • in-progress - The call was answered and is currently in progress
  • completed - The call was answered and has ended normally
  • busy - The caller received a busy signal
  • failed - The call could not be completed as dialled, most likely because the phone number was non-existent
  • no-answer - The call ended without being answered
  • canceled - The call was canceled while queued or ringing
Leg2Status

Status of the second leg of the call. Can be one of

  • completed - The call was answered and has ended normally
  • busy - The caller received a busy signal
  • no-answer - The call ended without being answered
  • failed - The call could not be completed as dialed, most likely because the phone number was non-existent
  • canceled - The call was canceled while queued or ringing
  • null (empty) - The call did not have a second leg
Legs

Status of individual legs of the call. Contains the following information (per leg):

  • Id - Indicates the leg. Can be 1 or 2.
  • OnCallDuration - Indicates the duration that this leg was on a call (see below for more information on how this is calculated).

The following diagram illustrates how the call duration is calculated for a call and its constituent legs.