Voice Broadcast API

Voice API
Quick Start Guides
Methods
Types
FAQ

NotifyPhoneAdvanced

This method calls any phone number and read aloud the contents of TextToSay. Use NotifyMultiplePhoneAdvanced to call multiple phone numbers.

Syntax

NotifyPhoneAdvanced(Request)

Request Parameters

Parameter NameDescriptionData TypeRequiredSample Value
PhoneNumberToDialThe phone number to call. It can be in any format, as long as there are 10 digits. To dial an extension, add x followed by the extension.StringTrue7575559999
TransferNumberThe phone number that the call will be transferred to if the call recipient presses 0. Transfer behavior can be further modified with TextToSay commands.StringFalse7575558888
VoiceIDThe text-to-speech voice ID.IntegerTrue2
CallerIDNumberThe number to display on the receiving party’s Caller ID.StringFalse7575550000
CallerIDNameThe name to display on the receiving party’s Caller ID. (Most carriers ignore this and use their own directory assistance to display name information.)StringFalseEsendex Services
TextToSayThe text-to-speech text or combination of text-to-speech and script to be read to the receiving party.StringTrueHello, this is a sample call from Phone Notify.
LicenseKeyYour license key.StringTrue00000000-0000-0000-0000-000000000000
TryCountThe number of times to attempt dialing if the initial call is unanswered or busy. The maximum is 3.IntegerTrue2
NextTryInSecondsThe number of seconds to wait until the next retry is performed if the original call is unanswered or busy. We recommend waiting at least 60 seconds.IntegerTrue180
UTCScheduledDateTimeThe date and time at which to send the call, specified as Coordinated Universal Time (UTC).DateTimeTrue2020-11-17T08:25:08.336Z
TTSrateThe speed that text-to-speech (TTS) will use when speaking the text. The value ranges from 0 to 20 (10 being normal). This can also be controlled within the TextToSay parameter.ByteTrue10
TTSvolumeThe volume that text-to-speech (TTS) will use when speaking the text. The value ranges from 0 to 100 (100 being the default). This can also be controlled within the TextToSay parameter.ByteTrue100
MaxCallLengthThe maximum time duration of the call, in seconds. We recommend you do not change this unless you absolutely need to.IntegerTrue80
StatusChangePostUrlThe URL to post call status changes to. The URL must be in lowercase. The system posts OutgoingPostback data for outgoing calls and IncomingPostback data for incoming calls.StringFalsehttps://example.com/callprogress.aspx
ReferenceIDAn optional ID to help you identify the call.StringFalsenotify1

Response

Returns: NotifyReturn object

Code Samples

You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.

C#

/* https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Service Reference and given the name WSDL */

using WSDL;

var client = new PhoneNotifySoapClient(PhoneNotifySoapClient.EndpointConfiguration.PhoneNotifySoap);

var request = new AdvancedNotifyRequest
{
    PhoneNumberToDial = YOUR_TO_NUMBER,
    TextToSay = "Hello, this is a test call.",
    UTCScheduledDateTime = DateTime.UtcNow,
    LicenseKey = YOUR_LICENSE_KEY
};

var response = await client.NotifyPhoneAdvancedAsync(request);

Console.WriteLine(
    "QueueID: " + response.QueueID + Environment.NewLine +
    "Response Code: " + response.ResponseCode + Environment.NewLine +
    "Response Text: " + response.ResponseText
);

Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;

public final class NotifyPhoneAdvanced {
    public static void main(String[] args) throws Exception {
        String responseContent = "";
        String response = "";

        URL url = new URL("https://ws.esendex.us/NotifyWS/PhoneNotify.asmx");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        StringBuilder sb = new StringBuilder("<?xml version='1.0' encoding='utf-8'?>");
        sb.append(
                "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
        sb.append("<soap:Body>");
        sb.append("<NotifyPhoneAdvanced xmlns=\"https://ws.esendex.us/NotifyWS/\">");
        sb.append("<anr>");
        sb.append("<TransferNumber>17575449510</TransferNumber>");
        sb.append("<PhoneNumberToDial>17575449510</PhoneNumberToDial>");
        sb.append("<VoiceID>1</VoiceID>");
        sb.append("<CallerIDNumber>18009843710</CallerIDNumber>");
        sb.append("<CallerIDName>Test</CallerIDName>");
        sb.append("<TextToSay>Hello this is a test.</TextToSay>");
        sb.append("<LicenseKey>00000000-0000-0000-0000-000000000000</LicenseKey>");
        sb.append("<NextTryInSeconds>5</NextTryInSeconds>");
        sb.append("<TryCount>5</TryCount>");
        sb.append("<UTCScheduledDateTime>2013-01-15T20:53:00.608Z</UTCScheduledDateTime>");
        sb.append("<StatusChangePostUrl>http://esendex.us/postback/notify/2015</StatusChangePostUrl>");
        sb.append("</anr>");
        sb.append("</NotifyPhoneAdvanced>");
        sb.append("</soap:Body>");
        sb.append("</soap:Envelope>");

        connection.setRequestProperty("Content-Length", String.valueOf(sb.toString().length()));
        connection.setRequestProperty("Content-Type", "text/xml");
        connection.setRequestProperty("Connection", "Close");
        connection.setRequestProperty("SoapAction", "https://ws.esendex.us/NotifyWS/NotifyPhoneAdvanced");
        connection.setDoInput(true);
        connection.setDoOutput(true);

        PrintWriter pw = new PrintWriter(connection.getOutputStream());
        pw.write(sb.toString());
        pw.flush();

        connection.connect();

        System.out.println(sb.toString());

        BufferedReader br;

        if (connection.getResponseCode() == 200) {
            br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        } else {
            br = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
        }

        // BufferedReader br = new BufferedReader(new
        // InputStreamReader(connection.getInputStream()));

        while ((responseContent = br.readLine()) != null) {
            response += responseContent;
        }
        System.out.println(response);
    }
}

Python

from datetime import datetime, timedelta
import zeep

client = zeep.Client(wsdl="https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl")

dt = datetime.utcnow() + timedelta(minutes=1)
scheduled_utc_date_time = f"{dt.isoformat()}Z"

request = {
    "PhoneNumberToDial": "17575559999",
    "VoiceID": 1,
    "CallerIDNumber": "7575550000",
    "CallerIDName": "Esendex Services",
    "TextToSay": "Hello, this call was sent with Python.",
    "LicenseKey": "00000000-0000-0000-0000-000000000000",
    "TryCount": 2,
    "NextTryInSeconds": 180,
    "UTCScheduledDateTime": dt,
    "TTSrate": 10,
    "TTSvolume": 100,
    "MaxCallLength": 0,
}

result = client.service.NotifyPhoneAdvanced(request)

print(result)

SOAP 1.1 Request

POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://ws.esendex.us/NotifyWS/NotifyPhoneAdvanced"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NotifyPhoneAdvanced xmlns="https://ws.esendex.us/NotifyWS/">
      <anr>
        <PhoneNumberToDial>string</PhoneNumberToDial>
        <TransferNumber>string</TransferNumber>
        <VoiceID>int</VoiceID>
        <CallerIDNumber>string</CallerIDNumber>
        <CallerIDName>string</CallerIDName>
        <TextToSay>string</TextToSay>
        <LicenseKey>string</LicenseKey>
        <TryCount>int</TryCount>
        <NextTryInSeconds>int</NextTryInSeconds>
        <UTCScheduledDateTime>dateTime</UTCScheduledDateTime>
        <TTSrate>unsignedByte</TTSrate>
        <TTSvolume>unsignedByte</TTSvolume>
        <MaxCallLength>int</MaxCallLength>
        <StatusChangePostUrl>string</StatusChangePostUrl>
        <ReferenceID>string</ReferenceID>
      </anr>
    </NotifyPhoneAdvanced>
  </soap:Body>
</soap:Envelope>

SOAP 1.1 Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NotifyPhoneAdvancedResponse xmlns="https://ws.esendex.us/NotifyWS/">
      <NotifyPhoneAdvancedResult>
        <ResponseCode>int</ResponseCode>
        <ResponseText>string</ResponseText>
        <CallAnswered>boolean</CallAnswered>
        <QueueID>long</QueueID>
        <TryCount>int</TryCount>
        <Demo>boolean</Demo>
        <DigitsPressed>string</DigitsPressed>
        <MachineDetection>string</MachineDetection>
        <Duration>int</Duration>
        <StartTime>dateTime</StartTime>
        <EndTime>dateTime</EndTime>
        <MinuteRate>decimal</MinuteRate>
        <Country>string</Country>
        <CallComplete>boolean</CallComplete>
        <TextToSay>string</TextToSay>
        <VariableArray>
          <Variable>
            <VariableName>string</VariableName>
            <VariableValue>string</VariableValue>
          </Variable>
          <Variable>
            <VariableName>string</VariableName>
            <VariableValue>string</VariableValue>
          </Variable>
        </VariableArray>
      </NotifyPhoneAdvancedResult>
    </NotifyPhoneAdvancedResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2 Request

POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <NotifyPhoneAdvanced xmlns="https://ws.esendex.us/NotifyWS/">
      <anr>
        <PhoneNumberToDial>string</PhoneNumberToDial>
        <TransferNumber>string</TransferNumber>
        <VoiceID>int</VoiceID>
        <CallerIDNumber>string</CallerIDNumber>
        <CallerIDName>string</CallerIDName>
        <TextToSay>string</TextToSay>
        <LicenseKey>string</LicenseKey>
        <TryCount>int</TryCount>
        <NextTryInSeconds>int</NextTryInSeconds>
        <UTCScheduledDateTime>dateTime</UTCScheduledDateTime>
        <TTSrate>unsignedByte</TTSrate>
        <TTSvolume>unsignedByte</TTSvolume>
        <MaxCallLength>int</MaxCallLength>
        <StatusChangePostUrl>string</StatusChangePostUrl>
        <ReferenceID>string</ReferenceID>
      </anr>
    </NotifyPhoneAdvanced>
  </soap12:Body>
</soap12:Envelope>

SOAP 1.2 Response

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <NotifyPhoneAdvancedResponse xmlns="https://ws.esendex.us/NotifyWS/">
      <NotifyPhoneAdvancedResult>
        <ResponseCode>int</ResponseCode>
        <ResponseText>string</ResponseText>
        <CallAnswered>boolean</CallAnswered>
        <QueueID>long</QueueID>
        <TryCount>int</TryCount>
        <Demo>boolean</Demo>
        <DigitsPressed>string</DigitsPressed>
        <MachineDetection>string</MachineDetection>
        <Duration>int</Duration>
        <StartTime>dateTime</StartTime>
        <EndTime>dateTime</EndTime>
        <MinuteRate>decimal</MinuteRate>
        <Country>string</Country>
        <CallComplete>boolean</CallComplete>
        <TextToSay>string</TextToSay>
        <VariableArray>
          <Variable>
            <VariableName>string</VariableName>
            <VariableValue>string</VariableValue>
          </Variable>
          <Variable>
            <VariableName>string</VariableName>
            <VariableValue>string</VariableValue>
          </Variable>
        </VariableArray>
      </NotifyPhoneAdvancedResult>
    </NotifyPhoneAdvancedResponse>
  </soap12:Body>
</soap12:Envelope>

Let’s start sending, together.