enumerate element
VoiceXML 2.0
Creates a template for choices in a menu.

Syntax

<enumerate />

Parents
audio, block, catch, emphasis, enumerate, error, field, filled, foreach, help, if, initial, menu, noinput, nomatch, object, p, prompt, prosody, record, s, subdialog, transfer, voice

Children
audio, break, emphasis, enumerate, mark, p, phoneme, prosody, s, say-as, sub, value, voice

Remarks
The enumerate element allows you to specify a template that is applied to each choice in a menu or to each option in a field. You can access the prompt and DTMF key assigned to the current choice or option by using the Platform-defined _prompt and _dtmf variables.
You must set the dtmf attribute to true on the menu to access the _dtmf variable within the template.
Examples

The following example uses a menu to prompt the user for an action. The enumerate element includes a template that presents the user with the DTMF key and the allowable phrase for each choice in the menu. A regular expression is used to remove special grammar characters from the prompt before playing them back to the user via the TTS engine.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
  <var name="iTries" expr="0"/>

  <catch event="event.askagain">
      <break time="800ms"/>
      <assign name="iTries" expr="iTries+1"/>
      <goto next="#get_command" />
  </catch>

  <menu id="get_command" dtmf="true">
    <prompt>
      <if cond="0 == iTries">
         Welcome home.
         <break time="200ms" />
         <enumerate>
            To <value expr="_prompt.replace(/[\?\(\)]/g, '')"/>, 
            press <value expr="_dtmf"/>, 
            or say <value expr="_prompt.replace(/[\?\(\)]/g, '')"/>.
            <break time="200ms"/>
         </enumerate>
      <else/>
         What else would you like to do?
      </if>
    </prompt>

    <choice next="#heater">(turn on the heater)</choice>
    <choice next="#lights">(turn on the lights)</choice>
    <choice next="#slippers">(fetch my slippers)</choice>
    <choice next="#nothing">(?do nothing)</choice>

    <nomatch>
      Sorry, I didn't understand you. 
      <reprompt />
    </nomatch>

    <noinput>
      Sorry. I didn't hear you. 
      <reprompt />
    </noinput>

  </menu>

  <form id="heater">
    <block>turning on the heater 
       <throw event="event.askagain"/>
    </block>
  </form>

  <form id="slippers">
    <block>fetching your slippers 
       <throw event="event.askagain"/>
    </block>
  </form>

  <form id="lights">
    <block>turning on the lights 
       <throw event="event.askagain"/>
    </block>
  </form>

  <form id="nothing">
    <block>
       <exit/>
    </block>
  </form>
</vxml>


[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers