A menu is a convenient syntactic shorthand for a form containing a single anonymous field that prompts the user to make a choice and transitions to different places based on that choice.
|id||The identifier of the menu. It allows the menu to be the target of a <goto> or a <submit>. Please note that this attribute does not allow for any white space.|
|scope||(default is "dialog") The menu's grammar scope. If it is dialog, the menu's grammars are only active when the user transitions into the menu. If the scope is document, its grammars are active over the whole document (or if the menu is in the application root document, any loaded document in the application).|
|accept||(default is "exact") When set to "exact", the text of the choice elements in the menu defines the exact phrase to be recognized. When set to "approximate", the text of the choice elements defines an approximate recognition phrase. Each <choice> can override this setting.|
|dtmf||When set to true, the first nine choices that have not explicitly specified a value for the dtmf attribute are given the implicit ones "1", "2", etc. Remaining choices that have not explicitly specified a value for the dtmf attribute will not be assigned DTMF values (and thus cannot be matched via a DTMF keypress).|
Please keep in mind that the id attribute for this tag does not allow for any white space.
<?php header("Content-type: text/xml"); echo "<?xml version=\"1.0\"?>\n"; ?> <vxml version="2.0"> <menu id="departments"> <prompt> News Departments: Press 1 or say sports to be transfered to Sports. Press 2 or say weather to be transfered to Weather. Press 3 or say operator assistance to be transferred to Operator Assistance. </prompt> <choice dtmf="1" next="#sports">Sports</choice> <choice dtmf="2" next="#weather">Weather</choice> <choice dtmf="3" accept="approximate" next="#operator">Operator Assistance</choice> <noinput>Sorry, I didn't hear you.</noinput> <nomatch>Sorry, I didn't understand you.</nomatch> </menu> <form id="sports"> <block> <prompt> The Rainbow Cubs hit a home run to win the game. </prompt> </block> </form> <form id="weather"> <block> <prompt> It's raining cats and dogs. </prompt> </block> </form> <form id="operator"> <block> <prompt> Sorry, there is no operator assistance available. </prompt> </block> </form> </vxml>
The output of the above script would be:
Computer: News Departments: Press 1 or say sports to be transfered to Sports. Press 2 or say weather to be transfered to Weather. Press 3 or say operator assistance to be transfered to Operator Assistance.
Computer: The Rainbow Cubs hit a home run to win the game.
<audio>, <catch>, <choice>, <enumerate>, <error>, <help>, <noinput>, <nomatch>, <prompt>, <property>, <value>