===== VoiceXML example ===== **Creating the welcome message** In this VoiceXML example, you will be creating an application that gives you a selection to choose from. Once you make a selection, you are taken to the appropriate document or dialog. In this section, you will create the main greeting message of the application. In the code below, the user hears a "welcome" message and is then given a list of choices from the main menu. The element is used to skip to the menu section.
**Creating the menu** In this section you will create the menu for the VoiceXML application. The menu gives you four selections to choose from. DTMF is enabled, which allows for key presses by setting the dtmf attribute to 'true' in the element. The menu is created using the element and the next attribute specifies what document or anchor to go to. An event is caught, using the element, in case the user doesn't respond, says "help", or the input by the user is not recognized. survey weather news quit **Creating the anchors** In this section you will create the anchor sections that appear in the same document as the menu section. The two choices, news and quit, go to the following sections:
**Creating the weather document** In this section you will create the document that gives the user weather information. Once the user says or selects weather from the menu, the following code is executed:
Creating the survey document The survey document prompts the user to respond to a question. Once the user completes the survey, the user is taken back to the main menu. In the code below the user can respond to the survey question by selecting one of the choices from the active grammar. Below is the active grammar list for the survey document: } [two good dtmf-2] { The user is prompted with a question -- if the user does not say anything, or if there is no match with the active grammar, the user is asked the survey question again. If the user asks for help, the user hears the help information and is asked the question again. After successfully responding to the survey question, the code within the element is executed and the user hears a confirmation message and is returned to the main menu. Welcome to the survey! What did you think of your instructor? If you don't know what to do, say help or push 5. What did you say? Please input something! Please say what you think of your instructor. You can say excellent, good, fair, or poor. You can also push one for excellent, two for good, three for fair, and four for poor. **The entire VoiceXML application** * main.vxml * survey.vxml * weather.vxml