NotifyPhoneAdvanced
Use this method to call any phone number in the US/Canada and read the value of TextToSay
to that phone number. Use this method if you need to define detailed options for your message.
Syntax
NotifyPhoneAdvanced(AdvancedNotifyRequest)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
AdvancedNotifyRequest |
The notify you want to send. |
AdvancedNotifyRequest object
|
True |
Response
Returns: NotifyReturn
object
Code Samples
/* https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Reflection;
using NotifyPhoneAdvanced.WSDL;
namespace NotifyPhoneAdvanced
{
class Program
{
static void Main(string[] args)
{
WSDL.PhoneNotify PN = new WSDL.PhoneNotify();
WSDL.AdvancedNotifyRequest ANR = new WSDL.AdvancedNotifyRequest();
ANR.CallerIDName = "Esendex";
ANR.CallerIDNumber = "18009843710";
ANR.PhoneNumberToDial = "17575449510";
ANR.TextToSay = "Hello. This is a test call.";
ANR.VoiceID = 1;
ANR.StatusChangePostUrl = "http://www.yourpostbackurl.com"; //Optional
ANR.UTCScheduledDateTime = DateTime.UtcNow;
// ANR.UTCScheduledDateTime = new DateTime(2012, 12, 18, 11, 36, 0).ToUniversalTime();
// If scheduling calls, the local time will automatically be converted to UTC time when using the line of code above.
ANR.LicenseKey = "YOUR LICENSE KEY";
WSDL.NotifyReturn NR = PN.NotifyPhoneAdvanced(ANR);
Console.WriteLine(
"QueueID: " + NR.QueueID + "\n" +
"Response Code: " + NR.ResponseCode + "\n" +
"Response Text: " + NR.ResponseText
);
Console.ReadLine();
}
}
}
/*
Additional parameters you may include within your request.
ANR.TransferNumber
ANR.TryCount
ANR.NextTryInSeconds
ANR.TTSrate
ANR.TTSvolume
ANR.MaxCallLength
ANR.ReferenceID
*/
' https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL
Imports NotifyPhoneAdvanced.WSDL
Module Module1
Sub Main()
Dim PN As New WSDL.PhoneNotify
Dim ANR As New WSDL.AdvancedNotifyRequest
Dim NR As WSDL.NotifyReturn
ANR.CallerIDName = "Esendex"
ANR.CallerIDNumber = "18009843710"
ANR.PhoneNumberToDial = "17575449510x3132"
ANR.TextToSay = "Hello. This is a test call."
ANR.VoiceID = 1
ANR.StatusChangePostUrl = "http://www.yourpostbackurl.com" 'Optional
ANR.UTCScheduledDateTime = DateTime.UtcNow
'ANR.UTCScheduledDateTime = new DateTime(2012, 12, 18, 11, 36, 0).ToUniversalTime()
'If scheduling calls, the local time will automatically be converted to UTC time when using the line of code above.
ANR.LicenseKey = "YOUR LICENSE KEY"
NR = PN.NotifyPhoneAdvanced(ANR)
Console.WriteLine("QueueID: " & NR.QueueID & vbLf &
"Response Code: " & NR.ResponseCode & vbLf &
"Response Text: " & NR.ResponseText & vbLf)
Console.ReadLine()
End Sub
End Module
'Additional parameters you may include within your request.
'ANR.TransferNumber
'ANR.TryCount
'ANR.NextTryInSeconds
'ANR.TTSrate
'ANR.TTSvolume
'ANR.MaxCallLength
'ANR.ReferenceID
Dim request, oXMLHttp, url
url = "http://ws.esendex.us/NotifyWS/PhoneNotify.asmx"
request = "<?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=""http://ws.esendex.us/NotifyWS/"">" & _
"<anr>" & _
"<PhoneNumberToDial>17575449510</PhoneNumberToDial>" & _
"<VoiceID>1</VoiceID>" & _
"<CallerIDNumber>18009843710</CallerIDNumber>" & _
"<CallerIDName>CDYNE</CallerIDName>" & _
"<TextToSay>Hello, this is a test.</TextToSay>" & _
"<LicenseKey>YOUR LICENSE KEY</LicenseKey>" & _
"<UTCScheduledDateTime>2013-07-29T17:25:06.608Z</UTCScheduledDateTime>" & _
"</anr>" & _
"</NotifyPhoneAdvanced>" & _
"</soap:Body>" & _
"</soap:Envelope>"
Set oXMLHttp = CreateObject("MSXML2.ServerXMLHTTP")
oXMLHttp.open "POST", url, False
oXMLHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
oXMLHttp.send request
response = oXMLHttp.responseText
MsgBox oXMLHTTP.responseText
define("ALERTD_CDYNE_LICENSE_KEY", 'secretKeyHere');
define("ALERTD_POST_STATUS_URL", 'https://www.example.com/callback-URL/');
define("ALERTD_CALLER_ID_NUMBER", '6175551212'); // caller id "from" number
define("ALERTD_CALLER_ID_NAME", 'Example.com');
try {
$queueID = phone_notify_queueCall('6175551234', 'Test');
print "OK QueueID=$queueID";
}
catch (Exception $e) {
print "ERROR " . $e->getMessage();
}
/** Queue a phone call to a given number. Returns the Esendex queue ID, or throws an exception if the call is not queued successfully. */
function phone_notify_queueCall($phoneNumber, $message) {
$message = "~\SetVar(maxcallseconds|120)~
~\StatusChangePostURL(" . ALERTD_POST_STATUS_URL . ")~ "
. $message .
" Press any key to confirm you have received this message.
~\GetDigits(UserConfirmation|4)~
Thank you. Goodbye.
~\EndCall()~
";
try {
$client = new SoapClient(' https://ws.esendex.us/NotifyWS/PhoneNotify.asmx?wsdl');
$result = $client->NotifyPhoneAdvanced( new CallRequestData($phoneNumber, $message) );
$ResponseCode = $result->NotifyPhoneAdvancedResult->ResponseCode;
$ResponseText = $result->NotifyPhoneAdvancedResult->ResponseText;
$queueID = $result->NotifyPhoneAdvancedResult->QueueID;
if ($ResponseCode == '0' || $ResponseText == 'Queued') {
var_dump( $client->GetQueueIDStatusWithAdvancedInfo( new GetQueueIDStatusData($queueID) ) );
return $queueID;
}
throw new Exception("Service returned queueing error: ResponseCode=$ResponseCode; ResponseText=$ResponseText");
} catch (Exception $e) {
// This will catch SOAP exceptions as well.
throw new Exception("Unable to queue call: " . $e->getMessage());
}
}
/** Parameters for Esendex CallRequestData call */
class CallRequestData {
public $anr;
function CallRequestData($number,$text) {
$this->anr = array();
$this->anr['PhoneNumberToDial'] = $number;
$this->anr['TextToSay'] = $text;
$this->anr['LicenseKey'] = ALERTD_CDYNE_LICENSE_KEY;
$this->anr['CallerIDNumber'] = ALERTD_CALLER_ID_NUMBER;
$this->anr['CallerIDName'] = ALERTD_CALLER_ID_NAME;
$this->anr['StatusChangePostUrl'] = ALERTD_POST_STATUS_URL;
$this->anr['TransferNumber'] = '';
$this->anr['NextTryInSeconds'] = 180;
$this->anr['MaxCallLength'] = 120;
$this->anr['TryCount'] = 5;
$this->anr['TTSvolume'] = 100;
$this->anr['TTSrate'] = 25;
$this->anr['UTCScheduledDateTime'] = '1970-01-01T00:00:00Z';
$this->anr['VoiceID'] = 1;
}
}
/** Parameters for Esendex GetQueueIDStatus call */
class GetQueueIDStatusData {
public $QueueID;
public $LicenseKey;
function GetQueueIDStatusData($id) {
$this->QueueID = $id;
$this->LicenseKey = ALERTD_CDYNE_LICENSE_KEY;
}
}
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("http://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=\"http://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>f01d89fd-5155-5455-5585-e84ab8de8591</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", "http://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);
}
}
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://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="http://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>
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="http://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>
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="http://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>
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="http://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>