To get call details of a CCM call, you will need to make an HTTP GET request to
https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid>
Example (For Singapore Stamp)-
https://<your_api_key>:<your_api_token>@ccm-api.exotel.com/v2/accounts/<your_sid>/calls/<call_sid>
Example (For Mumbai Stamp)
https://<your_api_key>:<your_api_token>@ccm-api.in.exotel.com/v2/accounts/<your_sid>/calls/<call_sid>
<your_api_key>
and <your_api_token>
with the API key and token created by you OR use Basic Authentication.<your_sid>
with your “Account sid”<subdomain>
with the region of your account<call_sid>
with the Call Sid provided during CCM Make 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>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid> -H 'content-type: application/json'
var request = require("request"); var options = { method: 'GET', url: 'https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid>', headers: { 'content-type': 'application/json' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
<?php $request = new HttpRequest(); $request->setUrl('https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid>'); $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://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid>" 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://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/calls/<call_sid>" 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:
{ "request_id": "57ba69db00c0432e88a5ca6d644bbd40", "method": "GET", "http_code": 200, "metadata": null, "response": { "code": 200, "error_data": null, "status": "success", "data": { "call_sid": "72827ead13a355d334338f53af71157s", "direction": "outbound", "virtual_number": "+91804568XXXX", "call_state": "terminal", "call_status": "completed", "assigned_agent_details": { "user_id": "12898c52573645739e64864ad308f0a9", "user_name": "Sarthak XXXX", "contact_uri": "+9199531XXXXX", "group_id": null, "group_name": null, "status": "completed" }, "customer_details": { "contact_name": "Sarthak XXXXX", "contact_uri": "+9199531XXXXX", "status": "completed" }, "created_time": "2021-07-28T03:07:12+05:30", "updated_time": "2021-07-28T03:07:33+05:30", "start_time": "2021-07-28T03:07:18+05:30", "end_time": "2021-07-28T03:07:32+05:30", "total_duration": null, "total_talk_time": 7, "custom_field": "12130y124b2f142", "app_id": null, "app_name": null, "digits": null, "recordings": [ { "url": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/XXXXX/72827ead13a355d334338fXXXXXX.mp3" } ] } } }
Currently the GET API is powering data for CCM Outgoing Calls triggered via the Make Call CCM API only. Incoming / Outgoing calls connecting via flow is not yet available.
Details of GET API response-
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
|
Description of parameters under 'data' block:
Parameter Name | Description |
call_sid |
string; an alpha-numeric unique identifier of the call |
direction |
|
virtual_number |
The virtual number (ExoPhone) where the call landed (Incoming) or was used to initiate the call (Outgoing) |
call_state |
|
call_status |
|
assigned_agent_details |
assigned_agent_details will be the details of the agent who is the primary agent assigned for the call. In case of-
Fields
|
customer_details |
This is the number the caller called from (for inbound calls), or the number the call was placed to (for outbound calls), and is equal to
Fields-
|
created_time |
DateTime as per ISO 8601 date format at which the user initiated the call via API. |
updated_time | DateTime as per ISO 8601 date format at which the call data was last updated in our system Eg- 2021-07-28T02:59:34+05:30 |
start_time | DateTime as per ISO 8601 date format when the call request was initiated to the operator Eg- 2021-07-28T02:59:34+05:30 |
end_time | DateTime as per ISO 8601 date format when the call ended Eg- 2021-07-28T02:59:34+05:30 |
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. |
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
|
*Some of the above parameters would be null if not applicable for that call.
Possible error scenarios in case of this GET API -
Http Code | Error Code | Description |
404 | 3043 | Call not found / unsupported in this API |
404 | 3044 | Call not found / unsupported in this API |
404 | 3045 | Call not found / unsupported in this API |
500 | 1100 | Internal Server Error |
500 | 3042 | Internal Server Error |
500 | 3046 | Internal Server Error |
500 | 3075 | Internal Server Error |
*These will be populated under the `error_data` block of response