Volume 1, Issue 5 - May 2001
   
   
 

More Ways to Order Pizza

By Rob Marchand

(Continued from Part 1)

Failing Gracefully

Let's go back to our original structure of using defined grammars for DTMF and speech, and try to make our application a little more usable. The first stage is implementing tapered prompts. We can use tapered prompts to enhance the user experience, and to recover gracefully from problems encountered while collecting input from the user. VoiceXML prompts and events have a count attribute associated with them in order to support this feature. The count attribute specifies when we should play a particular prompt. So how is the count managed and used?

During processing of a VoiceXML form or menu, the VoiceXML interpreter makes use of the Form Interpretation Algorithm, or FIA, to determine which form or menu element should be dealt with next. The FIA goes through three phases: selection, where the FIA determines which form element to visit; collection, where the interpreter attempts to collect information for that element (such as a field); and processing, where the interpreter acts on the results of the collection.

As part of the collection phase, prompt selection is undertaken. When a form or menu is initially entered, the prompt counters for any subordinate elements are initialized to one. Whenever a prompt is used, the prompt counter for that element is incremented. When selecting a prompt for playback, the prompt with the highest count attribute less than or equal to the current prompt counter is used. So, depending upon how many times you've prompted the user, you can tailor the prompt that is played.

Here's an example of a possible interaction:

Computer: Please say or enter your credit card number:
Human: (silence)
Computer: Card number please?
..etc…

Although tapered prompts typically refer to using shorter prompts as the conversation progresses, you can also use longer prompts to provide the user with more guidance:

Computer: Please say or enter your credit card number:
Human: (silence)
Computer: I'm asking for your credit card number, so that we can order your pizza. I'll also need the expiry date. Card number?

Here's an example of how we can use this functionality in our pizza application to enhance the user experience.

<field name="orderItem">

      <grammar>
        pizza | drinks | salad | wings
      </grammar>

      <dtmf>
        1 {pizza} | 2 {drinks} | 3 {salad} | 4 {wings}
      </dtmf>

      <prompt count="1">
        What would you like to order?
        We have pizza, drinks, salad or wings.
      </prompt>

      <prompt count="2">
        Say pizza, drinks, salad or wings.
      </prompt>
      
      <prompt count="3">
        Perhaps you should use your telephone keypad.
        Press 1 for pizza; 2 for drinks; 3 for salad;
        or 4 for wings
      </prompt>       <noinput>         <reprompt/>       </noinput>       <nomatch>         <reprompt/>       </nomatch>       <help>         <reprompt/>       </help> </field> 

 

Here's how the conversation might go:

Computer: What would you like to order? Say pizza, drinks, salad or wings
Human: (silence)
Computer: Please say pizza, drinks, salad or wings
Human: (silence)
Computer: Perhaps you should use your telephone keypad. Press 1 for pizza, 2 for drinks, 3 for salad, or 4 for wings.
..etc…

There are a few interesting things here:

  • By instructing the user to fall back to DTMF, we are providing a way forward in the event of a call from a very noisy environment;

  • We are routing both noinput and nomatch events to the tapered prompts using the reprompt tag.

We could also use the count attribute on the event handlers for these events, and customize the prompts for each event. Here is a code snippet that does this:

<prompt>
What would you like to order?
We have pizza, drinks, salad or wings.
</prompt>

<noinput count="1">
  Please say something.
  <reprompt/>
</noinput>

<noinput count="2">
  Anyone home?
  <reprompt/>
</noinput>

<noinput count="3">
  I surrender.
  <reprompt/>
</noinput>


In this case, we provide custom prompts for the case when the user has provided no response at all, and eventually disconnect.

Hopefully these samples have given you a taste of how you can tailor your prompts to provide a more pleasant and versatile application.

What's Next

We'll be adding some nifty features to our pizza application next month (but still not making any money), so stay tuned! We'll also look at what is involved on the server-side to handle our pizza form.

Watch future issues of VoiceXML Review for more articles about getting started with VoiceXML.

back to the top

 

Copyright © 2001 VoiceXML Forum. All rights reserved.
The VoiceXML Forum is a program of the
IEEE Industry Standards and Technology Organization (IEEE-ISTO).