StatusCallBack delivery may be delayed or have failures due to multiple reasons like – network connectivity, customer web hook uptime, server failures, etc. Customers are advised to implement fallback to call details API for fetching the call status.
Exotel will perform an asynchronous HTTP request to the StatusCallback URL you have specified in your request (if any) once the call completes. List of parameters which will be sent as part of StatusCallback:
Parameter Name | Type & Value |
CallSid | string; an alpha-numeric unique identifier of the call |
DateUpdated | Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the status of the call was last updated in our system |
Status | Overall call status, which could be one of: 'completed', 'failed', 'busy' or 'no-answer' |
RecordingUrl | Link to the call recording if present. |
List of additional fields which will be sent if 'terminal' and/or ‘answered’ event is subscribed using 'StatusCallbackEvents' in the request:
Parameter Name | Type & Value |
EventType |
String; This will be the type of event for which 'StatusCallback' is triggered for and subscribed using 'StatusCallbackEvents'. Currently, only ‘terminal’ and ‘answered’ as an event is supported which is triggered once the call is over. However, more events can be added in the future. |
DateCreated | Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the user initiated the API |
To | Your customer's phone number as set in the API request. This number will be connected after `From`. |
From | The phone number that was attempted to be called first. |
PhoneNumberSid | This is your ExoPhone's unique identifier. |
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 |
ConversationDuration | The duration for the time `From` and `To` phone numbers were on call in seconds. |
Direction |
Can be:
|
CustomField | The value that was passed in the CustomField parameter of the API (if set during the request) will be populated here. |
Legs |
An array which will denote detailed information about each leg attempt involved in the call.
For understanding more about leg-wise call status, refer here. Sample: |
Additional StatusCallback fields are currently only supported if both ‘From’ and ‘To’ are set. StatusCallbackEvents parameter is not applicable for this case i.e. if ‘VoiceUrl’ is used. However, passthru applet can be utilised if ‘VoiceUrl’ is used.
curl -XPOST https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Calls/connect \ -d "From=+91941374XXXX" \ -d "To=+91886799XXXX" \ -d "CallerId=0113083XXXX" \ -d "StatusCallback=http://your-application.com/exotel-callback" \ -d "StatusCallbackEvents[0]=terminal" \ -d "StatusCallbackContentType=application/json"
{ "CallSid": "492205107c5fb48f4ac25d1f77759339", "EventType": "terminal", "DateCreated": "2019-04-08 03:17:59", "DateUpdated": "2019-04-08 03:18:35", "Status": "no-answer", "To": "+91886799XXXX", "From": "+91941374XXXX", "PhoneNumberSid": "0113083XXXX", "StartTime": "2019-04-08 03:17:59", "EndTime": "2019-04-08 03:18:36", "Direction": "outbound-api", "RecordingUrl": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings/<your_sid>/492205107c5fb48f4ac25d1f77759339.mp3", "ConversationDuration": 32, "Legs": [ { "OnCallDuration": 41, "Status": "completed" }, { "OnCallDuration": 32, "Status": "completed" } ] }
CallSid: 492205107c5fb48f4ac25d1f77759339 EventType: terminal From: +91941374XXXX To: +91886799XXXX PhoneNumberSid: 0113083XXXX Status: no-answer Direction: outbound-api DateCreated: 2019-04-08 03:10:55 DateUpdated: 2019-04-08 03:11:28 StartTime: 2019-04-08 03:10:55 EndTime: 2019-04-08 03:11:30 RecordingUrl: ConversationDuration: 0 Legs[0][Status]: no-answer Legs[0][OnCallDuration]: 0 Legs[1][Status]: Legs[1][OnCallDuration]: 0