CallXML 3.0 Development GuideHome  |  Frameset Home


<menu>  element

Menu is an element that combines the attributes and functionality of a <block> element with a <playAudio> element.

The intent of this element is to foster easy implementation of menus, where one key press will move the caller through an application. In the listed examples, the audio file will be played three times before "timing out" and moving on in the CallXML code. Compare the example below with the playAudio example in the element table in order to get a better understanding of this element..

Only event handler tags for the possible events listed below can exist inside this tag. Any other tags found will result in an error.


usage
<menu cache="(yes|no)" choices="(grammar value)" cleardigits="(true|false)" format="URI" id="(element id)" label="(navigation identifier)" maxtime="(m|s|ms)" next="(navigation identifier)" repeat="(numeric value)" say="STRING" termdigits="(123456789*#|ABCD)" test="CDATA" value="URI" value-is="STRING" value-is-not="STRING">


attributes
cacheData Type: (yes|no)Default: none - attribute is optional
Allows manual override over the caching mechanism. If this attribute is empty the default system caching is used. "yes" should force the system to use the cache all the time, "no" means that no cache should be used at all.
choicesData Type: (grammar value)Default: Optional
The 'choices' attribute defines a list of comma delimited voice recognition utterances that will be active for the container element. Alternatively,  the attribute can contain a choice followed parantheses containing different words which equate to that choice. Note that both dtmf grammars, and spoken word grammar utterances can be defined; digit values always indicate dtmf input, whereas spelled 'literals' for numbers imply that the grammar must be spoken:


<say choices="1, one">press, or say one</say>


One can also define multiple matches to return the same value to the application by specifying the values in the following format:

<ContainerElementName choices="ReturnValue (subchoice1, subchoice2)">

As such, either of the 'subchoice' utterances will be interpreted as 'ReturnValue'. To illustrate in greater detail:

<say choices="Beatles (john, paul, ringo, george),
              Rolling Stones (mick, keith, charlie, ron)"
>
      Say the name of a Beatle, or a Rolling Stone.
</say>


Lastly, developers can also make use of a builtin number grammar for capturing a string of digit values by specifying [x DIGITS], where 'x' is the length of the string that you wish to collect:

<block choices="[5 DIGITS]">

This can also be modified to accept input of varying lengths by specifying [x-y DIGITS], where 'x' and 'y' are the minimum and maximum values for the length of the string being collected:

<block choices="[5-8 DIGITS]">

cleardigitsData Type: (true|false)Default: none - attribute is optional
This attribute's value is a Boolean, indicating whether the queued digits buffer should be cleared when this action starts. "true" clears the digits buffer; "false" leaves the contents of the digit buffer alone.
formatData Type: URIDefault: none - attribute is optional
The 'format' attribute defines the string  formatting to use for the element.  If the value is undefined, the audio file format should be determined from the file name extension, if possible, and, if necessary, override the default format.
idData Type: (element id)Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
labelData Type: (navigation identifier)Default: none - attribute is optional
This attribute designates the unique inter-document identifier of the parent element in question, and allows an easy way to navigate through applications as a destination 'anchor', as used in goto references
maxtimeData Type: (m|s|ms)Default: 30s
The maxtime attribute indicates the maximum time that the CallXML browser should wait for digits before executing any repeat instances, if present.
nextData Type: (navigation identifier)Default: none - attribute is optional
The 'next' attribute sets the URL the CallXML platform will go to when the container ends.
repeatData Type: (numeric value)Default: 1
The value for the repeat attribute indicates the number of times to execute the content contained by the parent element. If this attribute is explicitly specified, this must be a valid number, or an error will result.  Also note that if the value is zero the content will be skipped.
sayData Type: STRINGDefault: none - attribute is optional
The 'say' attribute allows the developer to specify backup TTS to be output in the event that the .wav file cannot be found.
termdigitsData Type: (123456789*#|ABCD)Default: none - attribute is optional
This attribute holds the list of touch-tone digits which can terminate the current caller action. Note that for each termdigit specified, there should be an <ontermdigit> handler in the code to catch the event. Allowable values are any one of "012356789*#", the ordinary DTMF (Touch-Tone) keypad possibilities, plus the special keypad tones found on some telephones "ABCD".
testData Type: CDATADefault: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
valueData Type: URIDefault: none - attribute is required
The 'value' attribute defines the audio file to play to the caller when the parent element is first entered.
value-isData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-notData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.



code samples
<3.0 menu-label-value-termdigits>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <prompt>
      Lets navigate to a menu, shall we?
    </prompt>
    <goto value="#M_1"/>
  </do>

  <menu label="M_1" value="EnterSomething.wav" choices="1">


  <on event="choice:1">
    <say>
      You must have pressed DTMF 1 to get here.
    </say>
  </on>
</menu>

</callxml>


<3.0 menu-repeat-cache>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="D1">
    <prompt>
      Lets navigate to a menu, shall we?
      Note that if we dont enter any digits, then the wav
      file will repeat 3 times.
    </prompt>
    <goto value="#M_1"/>
  </do>

  <menu label="M_1" value="EnterSomething.wav" choices="1"
      repeat="3" cache="yes"/>



  <on event="choice:1">
    <say>
      You must have pressed DTMF 1 to get here.
    </say>
  </on>

</callxml>


<3.0 menu-next>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

<menu label="menu" value="entersomething.wav" termdigits="123">
    <on event="choice:1" next="#key1"/>
    <on event="choice:2" next="#key2"/>
    <on event="choice:3" next="#key3"/>
</menu>

  <do label="key1">
  <prompt> you pressed 1 </prompt>
  <exit/>
  </do>

  <do label="key2">
  <prompt> you pressed 2 </prompt>
  <exit/>
  </do>

  <do label="key2">
  <prompt> you pressed 3 </prompt>
  <exit/>
  </do>

</callxml>


<3.0 menu-id>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

<do>

  <menu label="menu" value="enter.wav" choices="1,2" id="menu_A" maxtime="5s" text="press one here. or dont."/>

  <menu label="menu" value="enter.wav" choices="1,2" id="menu_B" maxtime="5s" text="press two here"/>


    <on event="choice:1" target="menu_A">
    <log>*** TARGETED 1 ***</log>
    <prompt>
      you pressed one, in menu A.
    </prompt>
    </on>

    <on event="choice:1">
    <log>*** NON-TARGETED 1 ***</log>
    <prompt>
      you pressed one in a non specific menu.
    </prompt>
    </on>

    <on event="choice:2" target="menu_B">
    <log>*** TARGETED 2 ***</log>
    <prompt>
      you pressed two, in menu B.
    </prompt>
    </on>

    <on event="choice:2">
    <log>*** NON-TARGETED 2 ***</log>
    <prompt>
      you pressed two in a non specific menu.
    </prompt>
    </on>

</do>

</callxml>


<menu-valueis>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

<do label="main" value="slappy">

<!-- this will not be executed, as 'slappy' is NOT equal to 'pappy' -->
<menu label="menu" value="enter.wav" choices="#" maxtime="5s" value-is="pappy"/>


<!-- this will not be executed, as 'slappy' IS equal to 'slappy' -->
<menu label="menu" value="enter.wav" choices="#" maxtime="5s" value-is-not="slappy"/>


<!-- this will be executed, as 'sappy' is NOT equal to 'slappy' -->
<menu label="menu" value="entersomething.wav" choices="123" maxtime="5s" value-is-not="sappy">

    <on event="choice:1" next="#key1"/>
    <on event="choice:2" next="#key2"/>
    <on event="choice:3" next="#key3"/>
</menu>

</do>

  <block label="key1">
  <prompt> you pressed 1 </prompt>
  <exit/>
  </block>

  <block label="key2">
  <prompt> you pressed 2 </prompt>
  <exit/>
  </block>

  <block label="key3">
  <prompt> you pressed 3 </prompt>
  <exit/>
  </block>

</callxml>


<3.0 menu-test>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

<do label="main" value="slappy">

<!-- this will not be executed, as 'slappy' is NOT equal to 'pappy' -->
<menu label="menu" value="enter.wav" choices="#" maxtime="5s" test="'slappy' = 'pappy'"/>


<!-- this will not be executed, as 'slappy' IS equal to 'slappy' -->
<menu label="menu" value="enter.wav" choices="#" maxtime="5s" test="'slappy' = 'slappy'"/>


<!-- this will be executed, as 'sappy' is NOT equal to 'slappy' -->
<menu label="menu" value="entersomething.wav" choices="123" maxtime="5s" test="'sappy' != 'slappy'">

    <on event="choice:1" next="#key1"/>
    <on event="choice:2" next="#key2"/>
    <on event="choice:3" next="#key3"/>
</menu>

</do>

  <block label="key1">
  <prompt> you pressed 1 </prompt>
  <exit/>
  </block>

  <block label="key2">
  <prompt> you pressed 2 </prompt>
  <exit/>
  </block>

  <block label="key3">
  <prompt> you pressed 3 </prompt>
  <exit/>
  </block>

</callxml>




additional links
none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site