Today Exotel gives status callbacks when 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 event as an intermediate state when the agent / customer has picked the call so that more definitive action can be taken on the call in the CRMs ( Like assigning 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 NAMEVALUE
CallSidstring; unique identifier of the call
CallFromstring; the number of the calling party
CallTostring; The callerID the customer had called to . This will be the Exotel VN associated with the flow
Directionstring ; This is the direction of the call . For connect applet this shall say "outbound-dial"
CreatedTime ;The time when the event created 
Fromstring; the number of the calling party
Tostring; The callerID the customer had called to . This will be the Exotel VN associated with the flow
CurrentTimeTime ;Time when the event was fired 
DialWhomNumberstring ; This is the agents 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, or the call didn't go through, or the agent didn't pick up the phone).

EventType
string, This shall have values of  " Dial" , "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 for 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 type 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 for complete list of parameters which will be sent to your endpoint

StatusCallbackEvents New
Optional

Array; Call events for which we will send details to the URL as set in ‘StatusCallback’ parameter. Can be:

  • terminal - This event will be triggered once the call is over.
  • answered - This event will be triggered for each leg of the call. 

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 POST request to the statuscallback URL .



A sample request for connect two numbers via API 


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"

    }

  ]

}


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