×

To get the details of a call, you will need to make an HTTP GET request to

GET

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

Example (For Singapore Stamp)-

GET

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

Example (For Mumbai Stamp)

GET

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

  • 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://:/v3/accounts//calls/ 
  -H 'content-type: application/json'
var request = require("request");

var options = { method: 'GET',
  url: 'https://:/v3/accounts//calls/',
  headers: 
   { 'content-type': 'application/json' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
‘content-type’ => ‘application/json’,
));

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}

 
import requests

url = "https://:/v3/accounts//calls/"

headers = {
'content-type': "application/json"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://:/v3/accounts//calls/"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("content-type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}

 

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 user device record matching the request URI. 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).
  • call_details - This block will contain the information corresponding to the response array element and will contain the fields for a user record as explained below. 

 

Description of parameters under 'call_details' block:

Parameter

Value/Description

sid

string; an alpha-numeric unique identifier of the call

direction

  • inbound - Incoming call
  • outbound-dial - Outbound calls from Exotel dashboard
  • outbound-api - All other Outbound calls (API, campaign etc.)

virtual_number

This is your ExoPhone/Exotel Virtual Number

state

  • active: The call is not yet over OR post call processing data is yet to be processed
  • terminal: The call is over and the data is processed against it

status

Overall call status, could be one of:

  • completed: The call was answered and has ended normally
  • from_leg_unanswered: User (From leg) was unanswered due to various reasons such as switched off, not reachable, no-answer, busy, connection failed etc.
  • to_leg_unanswered: Customer (To leg) was unanswered due to various reasons such as switched off, not reachable, no-answer, busy, connection failed etc.
  • from_leg_cancelled - User (From leg) canceled the call while the customer was dialed. This could happen during ringing, blank calls or during an operator message such as switched off, no-answer, busy etc.
  • to_leg_no_dial - There was no dial initiated to customer (rare scenario)
  • from_leg_no_dial - There was no dial initiated to user (rare scenario)

legs

This URL can be used as a GET API to fetch the legs information of a given call_sid

created_time

Time in format YYYY-MM-DD HH:mm:ss+|–hh:mm; Date and time (along with the offset) at which the user initiated the API

updated_time

Time in format YYYY-MM-DD HH:mm:ss+|–hh:mm; Date and time (along with the offset) at which the status of the call was last updated in our system

start_time

Time in format YYYY-MM-DD HH:mm:ss+|–hh:mm; Date and time (along with the offset) when the call request was initiated to the operator

end_time

Time in format YYYY-MM-DD HH:mm:ss+|–hh:mm; Date and time (along with the offset) when the call was completed

total_duration

Total call duration in seconds (From start_time to end_time)

total_talk _time

Total time a customer was on call. If there were more than one conversation, it would be the sum of all conversations.

 

Eg- User 1 spoke to Customer for 5 minutes and transferred to User 2 and spoke to customer for 10 minutes, total_talk_time for the call would be 15 minutes

custom_field

The value that was passed in the custom_field parameter of the API (if set during the request) will be populated here.

app_id

Flow ID which was used at the start of the call. Null if flow was not used.

app_name

Flow Name which was used at the start of the call. Null if flow was not used

digits

DTMF digits pressed during the call separated by “-” for different applets. Similar to how it is represented in Call Reports

recordings

Array; It will contain all recordings associated with the call. Each array will contain

  • url - This will represent the playable URL for the corresponding recording

 

{
  "request_id": "62bd4015e8c04ecea3a5fbd7272f95ae",
  "method": "GET",
  "http_code": 200,
  "metadata": null,
  "response": {
    "code": 200,
    "error_data": null,
    "status": "success",
    "call_details": {
      "sid": "cabfb1dfa8c5e1c7f2c458423b7716b3",
      "direction": "outbound",
      "virtual_number": "+911414941199",
      "state": "active",
      "status": null,
      "legs": "/v3/accounts/Exotel/calls/cabfb1dfa8c5e1c7f2c458423b7716b3/legs",
      "created_time": "2022-11-03 22:54:40+05:30",
      "updated_time": "2022-11-03 22:54:58+05:30",
      "start_time": "2022-11-03 22:54:57+05:30",
      "end_time": "1970-01-01 05:30:00+05:30",
      "total_duration": null,
      "total_talk_time": null,
      "custom_field": null,
      "app_id": null,
      "app_name": null,
      "digits": null,
      "recordings": null
    }
  }
}
{
  "request_id": "9107ba6bdfc5493e806b7ea82706f2e0",
  "method": "GET",
  "http_code": 200,
  "metadata": null,
  "response": {
    "code": 200,
    "error_data": null,
    "status": "success",
    "call_details": {
      "sid": "cabfb1dfa8c5e1c7f2c458423b7716b3",
      "direction": "outbound",
      "virtual_number": "+911414941199",
      "state": "terminal",
      "status": "completed",
      "legs": "/v3/accounts/Exotel/calls/cabfb1dfa8c5e1c7f2c458423b7716b3/legs",
      "created_time": "2022-11-03 22:54:40+05:30",
      "updated_time": "2022-11-03 22:56:05+05:30",
      "start_time": "2022-11-03 22:54:57+05:30",
      "end_time": "2022-11-03 22:56:04+05:30",
      "total_duration": null,
      "total_talk_time": 59,
      "custom_field": null,
      "app_id": null,
      "app_name": null,
      "digits": null,
      "recordings": [
        {
          "url": "https://s3-ap-south-1.amazonaws.com/exotel-mum1-recordings/Exotel/cabfb1dfa8c5e1c7f2c458423b7716b3.mp3"
        }
      ]
    }
  }
}