February 28, 2021
Hot Topics:

Excerpt: Early Adopter VoiceXML: VoiceXML with XSLT (HTML and WML), Part 2

  • By Developer.com Staff
  • Send Email »
  • More Articles »
<assign name="form_pointer" expr="'mainMenu'"/>
<field name="userSaid">     
<prompt bargein="true" timeout="3s">
This is the main menu.       
<break msecs="500"/>  
You can say product list to hear a list of products.
<break msecs="500"/> 
You can say order status to check your order status.
<break msecs="500"/>       
You can say frequently asked questions to get more
<break msecs="500"/>       
You can always say main menu to return to this
menu, or help for additional help.     
<grammar type="application/x-jsgf"> 
product list |       
more information |       
frequently asked questions |       
questions |       
order status     

In order to keep track of the currently active form, the global variable form_pointer is set. This could be used to implement specific navigation logic, for example, by changing the behavior of a command slightly depending on where the command originated. Once the prompt has been played, and the user has responded with an utterance matching the inline grammar, the <filled> handler for this <field> is entered. This copies the value returned by the grammar to the global variable user_command, which is used by the navigator form to direct control flow to the required form. We could also use <subdialog> and pass a parameter, but this is simpler, and sufficient for this application.

<assign name="user_command" expr="userSaid"/>       
<goto next="#navigator"/>     
Now our main menu form is finished, we can start to implement the dialogs that provide the application's basic functionality. First up is the orderStatus form that makes the most extensive use of dynamic content generation:
<form id="orderStatus">   
<assign name="user_command" expr="'main menu'"/>

Page 4 of 5

This article was originally published on February 14, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date