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

Know which customer record the gateway is requesting

The survey message as described in the introduction section:

"Hi, this is ACME car service calling [customer name]. We have provided your [maker of the car] for maintenance service on [date of the service] , please rate our service by number 1 to 5, with 5 being the best. Thank you for your time."

When the gateway is calling one customer, it will get the dynamically generated VXML file through the URL that is specified in the starturl parameter. When we send our call request to the gateway, we really do not know when the gateway will call back for the VXML file. And if we are using multi-line system, there will be concurrent access to the starturl.

To solve this problem, for example, you can embedded a customer ID in the starturl string. So when the gateway calling back, it will submit the customer ID back to the starturl. The updated start.jsp file is listed below:

<?xml version="1.0"?>
<vxml version="1.0">
<% 
    String ans = request.getParameter("ans");
    boolean isAnsweringMachine = ("t".equals(ans));
    String customer_name = request.getParameter("customer_name");
    String car_maker = request.getParameter("car_maker");
    String service_date = request.getParameter("service_date");
%>
<form id="td">
<% if (isAnsweringMachine) {
    int anstotal = 1;
    Integer AnsTotal = (Integer) application.getAttribute("anstotal");
    if (AnsTotal != null)
        anstotal = AnsTotal.intValue() + 1;
    application.setAttribute("anstotal", new Integer(anstotal));
%>
  <block>
    <audio src="audio/acme.wav"/>
    <%=customer_name%>
    <audio src="audio/we_provide.wav"/>
    <%=car_maker%>
    <audio src="audio/maintenance.wav"/>
    <%=service_date%>
    <audio src="audio/thanks.wav"/>
  </block>
<% } else { %>
  <field name="rating">
    <prompt timeout="10s">
      <block>
        <audio src="audio/acme.wav"/>
        <%=customer_name%>
        <audio src="audio/we_provide.wav"/>
        <%=car_maker%>
        <audio src="audio/maintenance.wav"/>
        <%=service_date%>
        <audio src="audio/please_press_15.wav"/>
      </block>
    </prompt>
    <dtmf>
      1 | 2 | 3 | 4 | 5
    </dtmf>
    <filled>
      <submit next="recordrating.jsp" namelist="rating"/>
    </filled>
  </field>
<% } %>
</form>
</vxml>

Once the gateway get the VXML file through the starturl with the necessary parameter, the VXML file could look like this:
 

<?xml version="1.0"?>
<vxml version="1.0">
<form id="td">
  <field name="rating">
    <prompt timeout="10s">
      <block>
        <audio src="audio/acme.wav"/>
        John Smith
        <audio src="audio/we_provide.wav"/>
        Honda Accord
        <audio src="audio/maintenance.wav"/>
        Monday Jan 20
        <audio src="audio/please_press_15.wav"/>
      </block>
    </prompt>
    <dtmf>
      1 | 2 | 3 | 4 | 5
    </dtmf>
    <filled>
      <submit next="recordrating.jsp" namelist="rating"/>
    </filled>
  </field>
</form>
</vxml>

 

Developer Network Table of Content << Previous >> Next