Gateway Outbound Application Tutorial Table of Content << Previous >> Next

The Survey Start Page

Now we have the application VXML files developed, we can start implement the survey controls and report features. The survey start page is shown below:

To simplify the sample, the start page only takes a list of comma separated phone numbers. On the server side, the application will randomly assign other necessary values, such as car maker and date of service provided. In a real survey application, the start page is likely to take some database queries and perform the operation accordingly. But the key feature related to Voicent Gateway should be exactly the same.

<html>
<head>
  <meta http-equiv="Content-Language" content="en-us">
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Customer Satisfactory Survey</title>
</head>
<body>

<form method="POST" action="surveyHandler.jsp">
  <font face="Lucida Console"><b>Customer Satisfactory Survey</b></font></p>
  <p><font face="Lucida Console" size="2">Please enter a comma separated phone list:</font></p>
  <p><input type="text" name="phonelist" size="94"></p>
  <p><input type="submit" value="Start Survey" name="B1"></p>
</form>

</body>
</html>

The form is processed by surveyHandler.jsp. For each phone number in the list, a CallRecord is created. It then sends the call request to the gateway through sendCallRequest() method. The CallID is saved in the CallRecord.
 

...
String phonelist = request.getParameter("phonelist");
StringTokenizer tkz = new StringTokenizer(phonelist, ",");
String phoneno;
while (tkz.hasMoreTokens()) {
    phoneno = tkz.nextToken();
    CallRecord rec = new CallRecord(phoneno);
    sendCallRequest(rec);
    m_callRecords.add(rec);
}
...

void sendCallRequest(CallRecord rec)
{
  // setting the required http post string
  String poststr = "info=";
  poststr += URLEncoder.encode("Survey Call " + rec.m_phoneno);
  poststr += "&phoneno=";
  poststr += rec.m_phoneno;
  poststr += "&firstocc=120";
  poststr += "&starturl=";
  poststr += URLEncoder.encode("http://localhost:8155/ocall/myapp/start.jsp");

  // now the generic parameters for parameterized VXML
  // The name must match the one used in the VXML file

  poststr += "&customer_name=";
  poststr += URLEncoder.encode(rec.m_name);
  poststr += "&service_date=";
  poststr += URLEncoder.encode(rec.m_date);
  poststr += "&car_maker=";
  poststr += URLEncoder.encode(rec.m_carmaker);

  // Send Call Request
  String rcstr = postToGateway("/ocall/callreqHandler.jsp", poststr);
  rec.m_callId = getReqId(rcstr);
}
 

 

Developer Network Table of Content << Previous >> Next