Menus

A menu is essentially a simplified form with a single field. Menus present the user with a list of choices, and associate with each choice either a URI identifying a VoiceXML page or element to visit or an event which will occur if the user selects that choice. The grammar for a menu is constructed dynamically from the menu entries, which you specify using the <choice> element, text or an external grammar reference. You can use the <menu> element's scope attribute to control the scope of the grammar.

Note: The <enumerate> element instructs the VoiceXML browser to speak the text of each menu <choice> element when presenting the list of available selections to the user. If you want more control over the exact wording of the prompts (such as the ability to add words between menu items or to hide active entries in your menu), simply leave off the <enumerate> tag and specify your own prompts.

Menus can accept voice and/or DTMF input. If desired, you can implicitly assign DTMF key sequences to menu choices based on their position in the list of choices by using the construct <menu dtmf=“true”>. The following example shows an example of a menu that accepts voice and/or DTMF input.

<?xml version="1.0" encoding="iso-8859-1"?>
   <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US">
   <menu>
   <prompt>
      Welcome to the main menu.
      Please choose from the following choices.<enumerate/>
   </prompt>
   <choice dtmf="1" next="http://www.example.com/news.vxml">
      current news
   </choice>
   <choice dtmf="2" next="http://www.example.com/weather.vxml">
      current weather
   </choice>
   </menu>
</vxml>