And then, we can recognize what she or he entered.
To do any recognition??”voice or keystroke??”we need to develop grammar.
The grammar rules will define what are valid inputs, and which field should
be populated with what value when a valid input is received. Once the field is
populated with the recognized value, VoiceXML can check the value of the field and
decide on the next action.
With this knowledge, let us see how to put things together.
Time for Action: Prompting the User for Next Action
1. First, let us create a field in the form to accept user input. Add the following
code right after the line in our index.xml file.
Chapter 9
[ 165 ]
Press one to order a pizza online.
Press nine to speak to our chef.
Press zero at any time to return to this menu.
2. The code we added will prompt the user to make a choice. We need
to validate the user input via the grammar. We have already added a
tag to the tag, so let us create a new file called
dtmf_grammar.xml with the following code:
Pages:
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220