FAQs‎ > ‎

Web Responder

Overview

WebResponder can be invoked in two ways: incoming calls and outgoing calls.

When Nms posts back to your WebResponder application (inbound or outbound), the url always contains at least the following parameters:

NmsAni 
caller, e.g., "1001"
NmsDnis 
callee e.g., "2125551212"
AccountUser 
Account User
AccountDomain 
Acount Domain
AccountLastDial 
Last Dialed Digits by the Account User
Digits 
Received Digits
OrigCallID 
(1-1188b)
TermCallID 
(1-1188b)
ToUser 
User Part input to the Respondner
ToDomain 
Domain Part input to the Responder
RecordingUrl 
URL to place recordings ?

Inbound Calls

There is a new dial translation application called "To-Web". The To-Web application takes a single parameter: the url of the WebResponder application. When the To-Web application is invoked, IVR control is passed to the WebResponder application at the given url.

For inbound calls, configure a dial translation w/application="To-Web" and specify the url of the WebResponder application. When an inbound call arrives, IVR control is passed to the WebResponder application at the given url.

Outbound Calls

For outbound calls, submit a new callrequest_config (via api) with request="Call-Web" and message=url. When the call is connected, the WebResponder application specified by "message" is invoked.

e.g.,

POST /tac2/callrequest_config?request=Call-Web&orig_address=2125551212&request_address=1001@example.com&message=http://www.example.com/handle-connected.php HTTP/1.0

(requires at least tacserver 1.0.123)

Note- orig_address is really "1st leg".

Verbs

All verbs take a "action" attribute. If the "action" attribute is present then control is returned to the url given by the "action" attribute. If not present then the application ends.

<Play>

Plays the given .wav file and posts back to the given action url.

e.g.,

<Play action='continue.php'>
 http://www.example.com/hello-world.wav
</Play>

plays the .wav file and posts back (i.e., returns control) to continue.php.

to end the call, omit the action parameter

<Gather>

Gathers the given number of DTMF digits and posts back to the given action url, optionally playing the given .wav file.

numDigits 
the number of digits to gather, e.g., '1' (default=20)

e.g.,

<Gather numDigits='3' action='handle-account-number.php'>
 <Play>
  http://www.example.com/what-is-your-account-number.wav
 </Play>
<Gather>

gathers 3 digits and posts back the relative url "handle-account-number.php?Digits=555".

The <Gather> verb posts back to the given action url with the following parameters:

Digits 
the gathered digits, e.g., "123"

<Record>

Records a recording and posts back to the given action url, optionally playing the given .wav file.

e.g.,

<Record action='handle-account-number.php'>
 <Play>
  http://www.example.com/please-leave-a-message.wav
 </Play>
<Record>

The <Record> verb posts back to the given action url with the following parameters:

  • RecordingUrl - the public url of the recording

<Forward>

TODO THIS EXPLANATION IS NOT QUITE RIGHT

Forwards to the given destination. The <Forward> verb does NOT take a "action" parameter. The <Forward> verb is effectively a "goto".

e.g.,

<Forward>
 2125551212
</Forward>

TODO IS THIS TRUE?

Example

This is an example of a "math" application. The application prompts the caller for two numbers and says the sum. The application demonstrates (a) a multi step application and (b) storing state in a server side php session.

<?php
session_start();
header("Content-Type: text/xml");
if (strlen($_REQUEST["case"]) == 0) {
       echo "<Play action='add.php?case=1'>
        http://localhost/tts.php?q=Welcome+to+the+math+application
       </Play>";
} else if ($_REQUEST["case"] == "1") {
       echo "<Gather numDigits='1' action='add.php?case=2'>
        <Play>
         http://localhost/tts.php?q=What+is+the+first+number
        </Play>
       </Gather>";
} else if ($_REQUEST["case"] == "2") {
       $_SESSION["first_number"] = $_REQUEST["Digits"];
       echo "<Gather numDigits='1' action='add.php?case=3'>
        <Play>
         http://localhost/tts.php?q=What+is+the+second+number
        </Play>
       </Gather>";
} else if ($_REQUEST["case"] == "3") {
       $first_number = $_SESSION["first_number"];
       $second_number = $_REQUEST["Digits"];
       $sum = $first_number + $second_number;
       echo "<Play>
        http://localhost/tts.php?q=holy+cow+$first_number+and+$second_number+is+$sum"
       </Play>";
}
?>
<pre>

Comments