Video:
This API will connect the two numbers given for an agent and the customer. It will connect the ‘From’ number first. Once the person at the ‘From’ end picks up the phone, it will connect to the number provided in the ‘To’. You can choose which number to be connected first by giving that number in the ‘From’ field.
An HTTP POST request to https://<your_api_key>:<your_api_token>@<subdomain>/v1/Accounts/<your_sid>/Calls/connect has to be made
- Replace
<your_api_key>
and<your_api_token>
with the API key and token created by you. - Replace
<your_sid>
with your “Account sid” - Replace
<subdomain>
with the region of your account- <subdomain> of Singapore cluster is api.exotel.com
- <subdomain> of Mumbai cluster is api.in.exotel.com
<your_api_key>
, <your_api_token>
and <your_sid>
are available on the API settings page of your Exotel Dashboard
The following are the POST parameters:
PARAMETER NAME | MANDATORY/OPTIONAL | VALUE |
From | Mandatory | The Agent's phone # that will be called first |
To | Mandatory | Your customer's phone number. |
CallerId | Mandatory | This is your Exotel Number (pick one from the 'Company Numbers' page) |
CallType | Mandatory | "trans" - for Transactional Calls |
TimeLimit | Optional | The time limit (in seconds) that you want this call to last. The call will be cut after this time. (max. 14400 i.e. 4 hours) |
TimeOut | Optional | The time (in seconds) to ring the called parties (both first and second call leg) |
StatusCallback | Optional | When the call completes, an HTTP POST will be made to the URL mentioned with the following four parameters: |
MaxRetries | Optional | The number of times the call should be retried if we get failed or no-answer status from 1st leg. (Default value: 3) |
On success,
- the HTTP response status code will be 200
- the HTTP body will contain an XML similar to the one below. The "Sid" is the unique identifier of the call and it will be useful to log this for future debugging purposes.
<?xml version="1.0" encoding="UTF-8"?> <TwilioResponse> <Call><Sid>xxxxxxxxxxxxxxxxxxxx</Sid> <ParentCallSid/><DateCreated>2012-08-17 12:31:49</DateCreated> <DateUpdated>2012-08-17 12:31:49</DateUpdated> <AccountSid>xxxxxxxxx</AccountSid> <To>09052161119</To> <From>09739761117</From> <PhoneNumberSid>xxxxxxx</PhoneNumberSid> <Status>in-progress</Status> <StartTime>2012-08-17 12:31:49</StartTime> <EndTime>2012-08-17 12:32:57</EndTime> <Duration></Duration> <Price></Price> <Direction>outbound-api</Direction> <AnsweredBy/> <ForwardedFrom/> <CallerName/> <RecordingUrl/><Uri>/v1/Accounts/xxxxxxxx/Calls/xxxxxxxxxxxxxx</Uri> </Call> </TwilioResponse> |
On failure,
- the HTTP response status code will be non-200.
- the HTTP body will contain an XML (such as the one below) with details of why the request failed.
<TwilioResponse> <RestException> <Status>404</Status> <Message>No matching results</Message> </RestException> </TwilioResponse> |
Rate Limit:
This API is rate limited to 200 calls per minute. Once this limit has been crossed, your requests will be rejected with an HTTP 429 'Too Many Requests' code.
Sample PHP Code:
An example PHP code for this is available on Github
Sample Ruby Code:
Sample code is available at Github and Ruby Gem available at rubygems.org
_____________________________________________________________________________________________________
If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888.