Using DTMF Grammar
The most flexible way to accept DTMF input is to use DTMF grammars that define how tones are interpreted.
To include DTMF tones in your grammar, use the format “dtmf-0” for each of the tones 0 through 9. You can also use “dtmf-star” for the star (“*”) key, “dtmf-pound” for the pound (“#”) key, and “dtmf-?” to indicate an unknown key.
However, if you specify mode = DTMF in the grammar element and then use an item list as in Using DTMF Grammar example, you can use only numbers for the DTMF tones.
Example, Using DTMF Grammar shows a sample grammar that allows the caller to enter digits from the touch-tone pad. This example requests the user to use DTMF digits to enter PIN (Personal Identification Number) information. The grammar can be generated from the server from a user information database. It recognizes the key sequence 4-3-2-1.
<form>
<field name="getPin">
<grammar xml:lang="en-US" root = "pin" mode="dtmf">
<rule id="pin" scope="public">
<one-of lang-list="en-US">
<item> 4321 </item>
</one-of>
</rule>
</grammar>
"Please enter your pin followed by the pound sign."
<!-- The pin is 4321 -->
<nomatch>
Your input is incorrect. Please enter again.
</nomatch>
<nomatch count="3">
Sorry access is denied.
<exit/>
</nomatch>
</field>
<block>
Thank you. Please wait while we access your account.
</block>
</form>