How Does All This Fit Together?
Let's take it bite by bite and understand how it's working.
The
tag is required to take any kind of input. The tag plays back
all text in it as audio. As a matter of fact, all text within tags in a VXML document
will be played back as audio (almost!). We have named our field as option, and we
will use this name later to check its value.
The grammar file is critical. The first two lines define that it's a Grammar XML file,
the mode of grammar is DTMF (key presses), and that the default rule in this file is
MAINRULE. The DTMFDIGIT rule dictates that it can accept any one of the digits 1, 9, and
0, and when any one of them is received, it should return an appropriate string value
to the calling rule. We can use the numbers 1, 9, and 0 here because we have kept the
mode of the grammar file as DTMF, else we would have to use dtmf-1, dtmf-9, and
dtmf-0. But of course, switching the mode is what good programmers do!
The MAINRULE has a single item that has to occur once and only once. That item is
the DTMFDIGIT rule. A rule can refer other rules using the tag.
Let's look at now.
Pages:
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222