Video:
Today Exotel gives status callbacks when the call reaches terminal event when used for Outbound connecting two numbers and when used in Connect Applet Exotel gives status callback for Dial and Terminal event. Now Exotel powers Answered and Ringing event as an intermediate state when the agent/customer is ringing or picking up the call so that more definitive action can be taken on the call in the CRMs ( Like assigning a ticket to the agent etc..)
How to get answered event in CRM
1. Using Connect Applet
The agent pass-through is a part of the 'Connect' applet.
When configured with a URL, Exotel will pass on to that URL details of the agent who is currently being called. It makes a GET request to the URL with the following query parameters:
PARAMETER NAME | VALUE |
---|---|
CallSid | string; unique identifier of the call |
CallFrom | string; the number of the calling party |
CallTo | string; The callerID the customer had called to. This will be the Exotel VN associated with the flow |
Direction | string; This is the direction of the call. For connect applet, this shall say "outbound-dial" |
Created | Time; The time when the event created |
From | string; the number of the calling party |
To | string; The callerID the customer had called to. This will be the Exotel VN associated with the flow |
CurrentTime | Time; Time when the event was fired |
DialWhomNumber | string; This is the agent's number being dialed by Exotel for this attempt |
Status | busy/free. This is sent as 'busy' when the above agent is being called. It is sent as 'free' when the call to the above agent ends (either the call ends, the call didn't go through, or the agent didn't pick up the phone). |
EventType | string, This shall have values of " Dial", "Ringing", "Answered", "Terminal" . |
NOTE:- To get answered event in the connect applet, this needs to be enabled by Exotel for your account
2. Using Outbound API connecting agent to customer
NOTE:- Please refer to this to understand the connect API in detail https://developer.exotel.com/api/#call-agent
While using the API, one can subscribe now for more event types and specify in the below parameter in the API request
StatusCallback | Optional | String; An HTTP POST request will be made to this URL depending on what events are subscribed using ‘StatusCallbackEvents’. Refer here to the complete list of parameters that will be sent to your endpoint |
StatusCallbackEvents New | Optional | Array; Call events for which we will send details to the URL as set in the ‘StatusCallback’ parameter. Can be:
If no event is specified, we will send the default parameters as specified here. |
When the answered event is subscribed, the Exotel platform shall send a POST request to the status callback URL.
A sample request for connecting two numbers via API with the answered event:
curl -X POST 'https://<your_API_KEY>:<YOUR_API_TOKEN>@api.exotel.com/v1/Accounts/<Your_account_sid>/Calls/connect.json?From=<From No>&To=<To Number>&StatusCallback=<Your URL Endpoint>&StatusCallbackEvents\[0\]=terminal&StatusCallbackEvents\[1\]=answered'
A sample post request when the first leg is answered:
{
"CallSid": "XXXXXXXXXXXXXXXX",
"EventType": “answered",
"DateCreated": "2019-04-08 03:17:59",
"DateUpdated": "2019-04-08 03:18:35",
"EventTime": "2019-04-08 03:18:35",
"Status": "no-answer",
"To": "+91886799XXXX",
"From": "+91941374XXXX",
"PhoneNumberSid": "0113083XXXX",
"StartTime": "2019-04-08 03:17:59",
"EndTime": "null",
"Direction": "outbound-api",
"RecordingUrl": null,
"ConversationDuration": 32,
"Legs": [
{
"OnCallDuration": null,
"Status": "in-progress"
},
{
"OnCallDuration": null,
"Status": "null"
}
]
}
A sample example when the second leg is answered:
{
"CallSid": "XXXXXXXXXXXXXXXXXXXXX",
"EventType": “answered",
"DateCreated": "2019-04-08 03:17:59",
"DateUpdated": "2019-04-08 03:18:35",
"EventTime": "2019-04-08 03:18:35",
"Status": "no-answer",
"To": "+91886799XXXX",
"From": "+91941374XXXX",
"PhoneNumberSid": "0113083XXXX",
"StartTime": "2019-04-08 03:17:59",
"EndTime": "null",
"Direction": "outbound-api",
"RecordingUrl": null,
"ConversationDuration": 32,
"Legs": [
{
"OnCallDuration": null,
"Status": "in-progress"
},
{
"OnCallDuration": null,
"Status": "in-progress"
}
]
}
A sample request for connecting two numbers via API with a ringing event:
curl -X POST 'https://<your_API_KEY>:<YOUR_API_TOKEN>@api.exotel.com/v1/Accounts/<Your_account_sid>/Calls/connect.json?From=<From No>&To=<To Number>&StatusCallback=<Your URL Endpoint>&StatusCallbackEvents\[0\]=terminal&StatusCallbackEvents\[1\]=ringing'
A sample example is when the first leg is ringing:
{
"CallSid": "09c14403fb2a31097ba5ed64f9251646",
"EventType": "ringing",
"DateCreated": "2022-04-06 10:44:40",
"DateUpdated": "2022-04-06 10:44:41",
"Status": "in-progress",
"To": "08780296135",
"From": "07874762218",
"PhoneNumberSid": "08044556678",
"StartTime": "2022-04-06 10:44:41",
"EndTime": null,
"EventTime": "2022-04-06 10:44:41",
"Direction": "outbound-api",
"RecordingUrl": null,
"ConversationDuration": null,
"Legs": [
{
"OnCallDuration": null,
"Status": "in-progress"
},
{
"OnCallDuration": null,
"Status": null
}
]
A sample example is when the second leg is ringing:
{
"CallSid": "09c14403fb2a31097ba5ed64f9251646",
"EventType": "ringing",
"DateCreated": "2022-04-06 10:44:40",
"DateUpdated": "2022-04-06 10:44:46",
"Status": "in-progress",
"To": "08780296135",
"From": "07874762218",
"PhoneNumberSid": "08044556678",
"StartTime": "2022-04-06 10:44:44",
"EndTime": null,
"EventTime": "2022-04-06 10:44:46",
"Direction": "outbound-api",
"RecordingUrl": null,
"ConversationDuration": null,
"Legs": [
{
"OnCallDuration": null,
"Status": "in-progress"
},
{
"OnCallDuration": null,
"Status": "in-progress"
}
]
A sample example of Terminal statuscallback with Ringing Duration:
{
"CallSid": "054cfcd8910389ff64882d8e25211646",
"EventType": "terminal",
"DateCreated": "2022-04-06 10:48:00",
"DateUpdated": "2022-04-06 10:48:16",
"Status": "completed",
"To": "08780296135",
"From": "07874762218",
"PhoneNumberSid": "08044556678",
"StartTime": "2022-04-06 10:48:04",
"EndTime": "2022-04-06 10:48:16",
"EventTime": "2022-04-06 10:48:16",
"Direction": "outbound-api",
"RecordingUrl": "https://s3-us-west-2.amazonaws.com/exotel-us3- recordings/ree5e1us3/054cfcd8910389ff64882d8e25211646.mp3",
"ConversationDuration": 6,
"Legs": [
{
"OnCallDuration": 12,
"RingingDuration": 4,
"Status": "completed"
},
{
"OnCallDuration": 6,
"RingingDuration": 3,
"Status": "completed"
}
]
Note: The ringing event is dependent on the operator and it may not be reported if the operator doesn't provide it in certain cases. If the ringing event is not available then the RingDuration is set as 0.
How to get this enabled for an account?
You can raise a request with hello@exotel.com or reach out to your account managers in Exotel to enable this feature
in your account