Exotel allows you to make outbound calls to DND numbers which have been whitelisted. To check if a number has been whitelisted or not, you will need to make a HTTP GET request to

GET

https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/<number>

  • 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
    1. <subdomain> of Singapore cluster is @api.exotel.com
    2. <subdomain> of Mumbai cluster is @api.in.exotel.com

<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard

curl https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240
            
var request = require('request');

var dataString = 'From=XXXXX30240&To=9415540682&CallerId=0XXXXXX4890';

var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240',
    method: 'POST',
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$data = array(
    'From' => 'XXXXX30240',
    'To' => '9415540682',
    'CallerId' => '0XXXXXX4890'
);
$response = Requests::post('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240', $headers, $data);
import requests

data = {
  'From': 'XXXXX30240',
  'To': '9415540682',
  'CallerId': '0XXXXXX4890'
}

requests.post('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240', data=data)
require 'net/http'
require 'uri'

uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240")
request = Net::HTTP::Post.new(uri)
request.set_form_data(
  "From" => "XXXXX30240",
  "To" => "9415540682",
  "CallerId" => "0XXXXXX4890",
)

req_options = {
  use_ssl: uri.scheme == "https",
}

response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end

# response.code
# response.body

HTTP Response:

  • On success, the HTTP response status code will be 200
  • the HTTP body will contain an XML/JSON similar to the one below
<Result>
    <Status>(Whitelist|Blacklist|Neutral)</Status>
    <Type>(Customer|Agent|API|<empty>)</Type>
    <Expiry>(-1|<seconds>)</Expiry>
</Result>

Description of parameters mentioned in the above response:

Parameter Name

Type & Value

Result/Status

  • Whitelist - The number has been whitelisted. You can make outbound calls to this number.
  • Blacklist - The number has been blacklisted. The number has explicitly unsubscribed from getting your calls.
  • Neutral - You cannot make outbound calls to this number.

Result/Type

  • Customer - The customer had made an inbound call to your ExoPhone and has automatically been whitelisted.
  • Agent - This number belongs to your co-worker (Exotel user). All co-workers numbers are automatically whitelisted.
  • API - You have used the customer whitelisting API to whitelist this number.

Result/Expiry

Contains the number of seconds after which the number will not be in this state (typically whitelist).

  • -1 - There is no expiry. The number remains in this state forever.