There has been a couple of times on the developer forum where I’ve seen users put builtin and inline grammars all within the same field of their IVR code. A common misconception that users don’t seem to understand is that when you use a built-in grammar within the VoiceXML, you’re secretly telling your field specifically how you want you callers to input the data.
For example, when you add this into your IVR code:
<field name=”phone” type=”digits?length=10″>
this built-in grammar, digits?length=10, allows for the user to only enter 10 digits either by voice or by DTMF (phone keypad entries).
However, if you were to add this inline grammar right underneath that line of code:
<grammar mode=”dtmf” type=”application/x-jsgf”>(1|2|3|4|5|6|7|8|9|0)+ </grammar>
this VoiceXML grammar allows for the user to enter multiple digits (with no restriction on the number of digits that can be entered) by DTMF only.
So, if you’re the IVR platform, what do you do? You have two different VoiceXML grammars giving you different instructions on how to capture data from the user. Because of this, inconsistent behavior can occur for your phone application.
To avoid this hazard, you should use either a stand-alone built-in grammar or a stand-alone inline grammar.
Just for your knowledge, this specific example was based on a user who was looking to only capture 10 digits, but by DTMF only. To resolve this, we can do:
<grammar src=”builtin:dtmf/digits?length=10″/>
This grammar allows only up to 10 digits and this portion, builtin:dtmf, only allows for DTMF only.
Hope this helps you developers out there who may have some questions on implementing VoiceXML grammars.
Leave a Reply