|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IVR IntroductionInteractive Voice Response (IVR) applications enable callers to interact with any software, such as query and modify database information, over their telephone. Callers can use their touch-tone pad to input requests or just say what they want to do, such as requesting account balance information. IVR systems usually employ text-to-speech software to read information back. Voicent Gateway BackgroundVoicent Gateway is ideal for developing interactive telephony applications such as Voicent AutoReminder and Voicent BroadcastByPhone. Based on the W3C VoiceXML standard, Voicent Gateway enables interactive voice access to the web and enterprise systems from any telephone. Voicent Gateway can be deployed on any Windows 2000/2003/XP/Vista PC, making it possible to develop and deploy Voicent based solutions at a cost most small business and organizations can afford. The gateway also support multiple phone lines by using multiple modems on a single computer. For large scale applications, multiple gateways in different locations can be networked together through the web interface. Voicent Gateway requires no additional hardware when used with Skype. Calls are made over the Internet to landline or cell phones. The gateway also support regular analog phone lines through the use of a voice modem. You can combine Skype and voice modems together to easily increase system capacity. Voicent Gateway contains an outbound call scheduler which can be accessed through its HTTP interface. This interface enables easy integration with almost any application and with almost any programming language. VoiceXML tutorial and samples are provided under the developer section of this website. For setup and options, please see Voicent Gateway User Guide. A free version of the product is also available for download. You can also use IVR Studio to develop your IVR applications. This tool enables flexible application development without any knowledge of VoiceXML. All you need is point and click to draw a call flow diagram. Using the IVR APISince all these functions are implemented as a HTTP client communicating directly with Voicent Gateway, they can be run on any machine that has a connection to the host running the gateway. The Java interface source code is included at the end of this section. This Java Simple Interface is developed based on Voicent Gateway Simple Outbound Call Interface. SynopsisString callText(String phoneno, String text, boolean selfdelete)
DescriptionMake a phone call and play the specified text message. The text message is convert to voice by Voicent Gateway's text-to-speech engine. The options are:
The return value is the call request id <reqId>. ExamplecallText("123-4567", "Hello, how are you doing", 1); Make a call to phone number '123-4567' and say 'Hello, how are you doing'. Since the selfdelete bit is set, the call request record in the gateway will be removed automatically after the call. String reqId = callText("123-4567", "Hello, how are you", 0);
Make a call to phone number '123-4567' and say 'Hello, how are you'. Since the selfdelete bit is not set, the call request record in the gateway will not be removed after the call. You can then use SynopsisString callAudio(String phoneno, String audiofile, boolean selfdelete)
DescriptionMake a phone call and play the specified audio message. The options are:
The return value is the call request id <reqId>. ExamplecallAudio("123-4567", "C:\my audios\hello.wav", 1);
Make a call to phone number '123-4567' and play the hello.wav file. Since the selfdelete bit is set, the call request record in the gateway will be removed automatically after the call. String reqId = callAudio("123-4567", "C:\my audios\hello.wav", 0);
Make a call to phone number '123-4567' and play the hello.wav file. Since the selfdelete bit is not set, the call request record in the gateway will not be removed after the call. You can then use callStatus to get the call status, or use callRemove to remove the call record. SynopsisString callStatus(String reqId)
DescriptionCheck the call status of the call with <reqId>. If the call is made, the return value is 'Call Made', or if the call is failed, the return value is 'Call Failed', or if the call will retry, the return value is "Call Will Retry", and for any other status, the return value is "". Please note that an empty string is returned if the call is still in progress. You'll need to wait and then poll the status again. ExampleString status = callStatus("11234035434");
Synopsisvoid callRemove(String reqId)
DescriptionRemove the call record of the call with reqId. If the call is not made yet, it will be removed also. ExampleallRemove("11234035434");
Synopsisvoid callTillConfirm(String vcastexe, String vocfile, String wavfile, String ccode)
DescriptionKeep calling a list of people until anyone enters the confirmation code. The message is the specified audio file. This is ideal for using it in a phone notification escalation process. To use this feature, Voicent BroadcastByPhone Professional version has to be installed. This function is similar to the command line interface BroadcastByPhone has. But since the command cannot be invoke over a remote machine, this perl function uses the gateway to schedule an event, which in turn invokes the command on the gateway host. The options are:
ExampleCallTillConfirm(
"C:\Program Files\Voicent\BroadcastByPhone\bin\vcast.exe",
"C:\My calllist\escalation.voc",
"C:\My calllist\escalation.wav",This will invoke BroadcastByPhone program on the gateway host and start calling everyone one the call list defined in 'C:\My calllist\escalation.voc'. The audio message played is 'C:\My calllist\escalation.wav'. And as soon as anyone on the list enters the confirmation code '911911', the call will stop automatically. Source Code ------------------
File Voicent.java:
------------------
import java.net.URL;
import java.net.URLEncoder;
import java.net.HttpURLConnection;
import java.io.PrintWriter;
import java.io.InputStream;
public class Voicent
{
/**
* Constructor with default localhost:8155
*/
public Voicent()
{
host_ = "localhost";
port_ = 8155;
}
/**
* Constructor with Voicent gateway hostname and port.
* @param host Voicent gateway host machine
* @param port Voicent gateway port number
*/
public Voicent(String host, int
port)
{
host_ = host;
port_ = port;
}
/**
* Make a call to the number specified and play the text message
* using text-to-speech engine.
*
* @param phoneno Phone number to call, exactly as it should be
dialed
* @param text Text to play over the phone using text-to-speech
* @param selfdelete After the call, delete the call request
automatically if set to 1
* @return Call request ID
*/
public String callText(String
phoneno, String text, boolean selfdelete)
{
// call request url
String urlstr = "/ocall/callreqHandler.jsp";
// setting the http post string
String poststr = "info=";
poststr += URLEncoder.encode("Simple Text Call " + phoneno);
poststr += "&phoneno=";
poststr += phoneno;
poststr += "&firstocc=10";
poststr += "&selfdelete=";
poststr += (selfdelete ? "1" : "0");
poststr += "&txt=";
poststr += URLEncoder.encode(text);
// Send Call Request
String rcstr = postToGateway(urlstr, poststr);
return getReqId(rcstr);
}
/**
* Make a call to the number specified and play the audio file. The
* audio file should be of PCM 8KHz, 16bit, mono.
*
* @param phoneno Phone number to call, exactly as it should be
dialed
* @param audiofile Audio file path name
* @param selfdelete After the call, delete the call request
automatically if set to 1
* @return Call request ID
*/
public String callAudio(String
phoneno, String audiofile, boolean selfdelete)
{
// call request url
String urlstr = "/ocall/callreqHandler.jsp";
// setting the http post string
String poststr = "info=";
poststr += URLEncoder.encode("Simple Audio Call " + phoneno);
poststr += "&phoneno=";
poststr += phoneno;
poststr += "&firstocc=10";
poststr += "&selfdelete=";
poststr += (selfdelete ? "1" : "0");
poststr += "&audiofile=";
poststr += URLEncoder.encode(audiofile);
// Send Call Request
String rcstr = postToGateway(urlstr, poststr);
return getReqId(rcstr);
}
/**
* Get call status of the call with the reqID.
*
* @param reqID Call request ID on the gateway
* @return call status
*/
public String callStatus(String
reqID)
{
// call status url
String urlstr = "/ocall/callstatusHandler.jsp";
// setting the http post string
String poststr = "reqid=";
poststr += URLEncoder.encode(reqID);
// Send Call Request
String rcstr = postToGateway(urlstr, poststr);
return getCallStatus(rcstr);
}
/**
* Remove all request from the gateway
*
* @param reqID Call request ID on the gateway
* @return call status
*/
public void callRemove(String reqID)
{
// call status url
String urlstr = "/ocall/callremoveHandler.jsp";
// setting the http post string
String poststr = "reqid=";
poststr += URLEncoder.encode(reqID);
// Send Call remove post
postToGateway(urlstr, poststr);
}
/**
* Invoke BroadcastByPhone and start the call-till-confirm process
*
* @param vcastexe Executable file vcast.exe, BroadcastByPhone path
name
* @param vocfile BroadcastByPhone call list file
* @param wavfile Audio file used for the broadcast
* @param ccode Confirmation code
*/
public void callTillConfirm(String
vcastexe, String vocfile, String wavfile, String ccode)
{
// call request url
String urlstr = "/ocall/callreqHandler.jsp";
// setting the http post string
String poststr = "info=";
poststr += URLEncoder.encode("Simple Call till Confirm");
poststr += "&phoneno=1111111"; // any number
poststr += "&firstocc=10";
poststr += "&selfdelete=0";
poststr += "&startexec=";
poststr += URLEncoder.encode(vcastexe);
String cmdline = "\"";
cmdline += vocfile;
cmdline += "\"";
cmdline += " -startnow";
cmdline += " -confirmcode ";
cmdline += ccode;
cmdline += " -wavfile ";
cmdline += "\"";
cmdline += wavfile;
cmdline += "\"";
// add -cleanstatus if necessary
poststr += "&cmdline=";
poststr += URLEncoder.encode(cmdline);
// Send like a Call Request
postToGateway(urlstr, poststr);
}
private String postToGateway(String
urlstr, String poststr)
{
try {
URL url = new URL("http", host_, port_, urlstr);
HttpURLConnection conn = (HttpURLConnection)
url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
PrintWriter out = new
PrintWriter(conn.getOutputStream());
out.print(poststr);
out.close();
InputStream in = conn.getInputStream();
StringBuffer rcstr = new StringBuffer();
byte[] b = new byte[4096];
int len;
while ((len = in.read(b)) != -1)
rcstr.append(new String(b, 0, len));
return rcstr.toString();
}
catch (Exception e) {
e.printStackTrace();
return "";
}
}
private String getReqId(String
rcstr)
{
int index1 = rcstr.indexOf("[ReqId=");
if (index1 == -1)
return "";
index1 += 7;
int index2 = rcstr.indexOf("]", index1);
if (index2 == -1)
return "";
return rcstr.substring(index1, index2);
}
private String getCallStatus(String
rcstr)
{
if (rcstr.indexOf("^made^") != -1)
return "Call Made";
if (rcstr.indexOf("^failed^") != -1)
return "Call Failed";
if (rcstr.indexOf("^retry^") != -1)
return "Call Will Retry";
return "";
}
/* test usage */
public static void main(String args[])
throws InterruptedException
{
String mynumber = "1112222"; // replace with your own
Voicent voicent = new Voicent();
String reqId = voicent.callText(mynumber,
"hello, how are you", true);
System.out.println("callText: " + reqId);
reqId = voicent.callAudio(mynumber,
"C:/Program Files/Voicent/MyRecordings/sample_message.wav",
false);
System.out.println("callAudio: " + reqId);
while (true) {
Thread.currentThread().sleep(30000);
String status = voicent.callStatus(reqId);
if (status.length() > 0) {
System.out.println(status);
voicent.callRemove(reqId);
break;
}
}
voicent.callTillConfirm("C:/Program
Files/Voicent/BroadcastByPhone/bin/vcast.exe",
"C:/temp/testctf.voc",
"C:/Program
Files/Voicent/MyRecordings/sample_message.wav",
"1234");
}
private String host_;
private int port_;
}
Points of Interest about IVRIdeal inbound & Outbound IVR solution
Inbound & Outbound IVR Solution Key Features
IVR HistoryNone.
|
||||||||||||||||||||||||||||||||||||||||||