| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<catch> sections as they do not have any built-in functionality other than being a short hand grammar. The included utterances for Universal events are:<vxml> level of your root document.<property name="universals" value="all"/><property name="universals" value="none"/><help> tags within your current form. For example:
<field name="helpfield">
<help>
You said help!
</help>
</field>
<catch> to function properly. When a user says "cancel" or "repeat" the application will look for a <catch> with the "event" attribute set to either "cancel" or "repeat". For example:
<catch event="cancel">
<prompt>
You said cancel!
</prompt>
</catch>
<field name="options_field">
<catch event="repeat">
<reprompt />
</catch>
</field>
<link> element to handle these user utterances. To customize your event processing for these occurrences, keep in mind that you must assign <catch> elements in your script to handle the event, else the default handlers and audio files will be executed.<link> element:
<link event="custom">
<grammar type="text/gsl">
<![CDATA[
[custom]
]]>
</grammar>
</link>
<catch event="custom">
<prompt>
YAY you caught the custom grammar event!
</prompt>
</catch>
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<!-- Set the universals property to the grammars we want to use -->
<!-- remember this can be global, field level or both -->
<!-- help uses the <help> element -->
<!-- repeat and cancel require a <catch> to properly execute -->
<!-- exit will automatically exit the application when the caller says "exit" -->
<!-- Universals can also be set to all and none for "help repeat exit cancel" or disabled respectively -->
<property name="universals" value="help cancel exit repeat" />
<!-- Set up a link-type global grammar -->
<!-- This is essentially what a universal grammar is -->
<link event="global">
<grammar type="text/gsl">
<![CDATA[
[global]
]]>
</grammar>
</link>
<!-- Set up our main form and field -->
<form id="frm_main">
<field name="main_menu">
<!-- This is our local field-level grammar that we would use for
field specific options -->
<grammar type="text/gsl">
<![CDATA[
[
[( one )]
[( two )]
[( three )]
]
]]>
</grammar>
<!-- Start the main menu TTS -->
<prompt>
Welcome to the main menu
Please choose one of the following options
Say one two or three for the local grammar
Say help for help
Say repeat to repeat these options
Say cancel to cancel
Say exit to disconnect
</prompt>
<!-- An utterance from our field level grammar has been recorded -->
<filled>
<prompt>
You are in filled
The utterance was <value expr="lastresult$.utterance" />
</prompt>
<!-- restart this form so we can try again -->
<goto next="#frm_main" />
</filled>
<!-- The help universal will always look for the <help> tags -->
<!-- when a help tag is found the execution will continue here -->
<help>
<prompt>
YAY you asked for help so I give you cheese burger
</prompt>
</help>
<!-- Set up a catch for the repeat universal grammar -->
<catch event="repeat">
<prompt>
I found a repeat event
</prompt>
<!-- Do what repeat does, repeat the prompt! -->
<reprompt />
</catch>
<!-- Set up a catch for the cancel universal grammar -->
<catch event="cancel">
<prompt>
This is cancel, cancelling the thing you wanted to cancel
</prompt>
</catch>
</field>
</form>
<!-- set up a global catch for our link global grammar -->
<catch event="global">
<prompt>
YAY we are in the custom global grammar catch!
</prompt>
</catch>
</vxml>
| ANNOTATIONS: EXISTING POSTS |
| login |
|