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
<your_api_token>with the API key and token created by you.
<your_sid>with your “Account sid”
<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_sid> are available on the API settings page of your Exotel Dashboard
The following are the POST parameters:
The Agent's phone # that will be called first
Your customer's phone number.
This is your Exotel Number (pick one from the 'Company Numbers' page)
"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)|
The time (in seconds) to ring the called parties (both first and second call leg)
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)
- 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"?>|
- 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.
<Message>No matching results</Message>
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.