Let’s create a simple VoiceXML application whose only purpose is to play a single prompt to a caller. To do this, we must first gain a basic understanding of the use of form items. These are a group of the elements that may be enclosed directly under the < form> tag to perform various tasks required by the application.
These items are divided into two main categories: field items and control items. Field items gather information from the caller to fill variables (field item variables). They may contain prompts directing the caller what to say, grammars that define the interpretation of what is said, and any event handlers. Control items, on the other hand, enclose non-recognition based tasks.
Below is a list of form items available in the 2.0 specification: field items:
- gathers input from the user via speech or DTMF recognition as defined by a grammar
- records an audio clip from the user
- transfers the user to another phone number
- invokes a platform-specific object that may gather user input, returning the result as an ECMAScript object
- performs a call to another dialog or document(similar to a function call), returning the result as an ECMAScript object
- encloses a sequence of statements for prompting and computation
- controls mixed-initiative interactions withing a form
Field item utilization will be discussed in more detail in Tutorial 2.
Each form item has associated with it a form item variable that is initially set to undefined if not previously declared and assigned a value (for field items, this is the same as the field item variable). The variable name can be defined via the “name” attribute or left nameless. A guard condition exists for each item that tests wether or not that item’s variable currently has a value. If it does, the execution of that particular form item is skipped. Otherwise, execution proceeds normally.