In order to switch off the voice recognition mode and force the VoiceXML browser to only accept DTMF input opposed to voice,
the following can be added to the VoiceXML document:
The placing of the property within the context of the VoiceXML document is as follow:
The shorthand for incorporating DTMF grammar in a VoiceXML document is as follow:
Herewith an example of a complete application with the DTMF shorthand example:
A general DTMF grammar which can be included in the main VXML document can look as follow:
Cases where a DTMF string needs to be captured, are when a numeric password or a contact number must be received.
In these cases the application can be told what length of input to expect. However, it does cause the application to
be more robust if a caller is requested to enter a termination key. For example, "please enter your mobile number and
press hash when done", "please enter your 4 digit password and press hash when done", "record your message after the tone
and press hash when done".
In the example below 'star' is specified as the termination key:
In the final example, the DTMF grammar code is displayed within a working example of code: