VoiceXML 2.1 Development GuideHome  |  Frameset Home

  GSL Grammar Slots  |  TOC  |  GSL Built-in Grammars  

DTMF Grammars

DTMF grammars follow the same rules for spoken word grammars. The best practice for writing your application is to ignore the legacy <dtmf> element and define your DTMF grammars within the <grammar> element in order to be prepared for the VoiceXML 2.1 standard, as the dtmf element is deprecated in the VoiceXML 2.1 environments:


<grammar type="text/gsl">
<![CDATA[
[
  [(dtmf-1)] {<F_1 "one">}
  [(dtmf-2) ] {<F_1 "two">}
[(dtmf-3) ] {<F_1 "three">}
]
]]>
</grammar>



I am sure that it would be helpful to see this in action to cement this little factoid into you head....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Yea that would be nice
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Well thats to bad!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Just joking, =)  here you go!!!



<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<meta name="maintainer" content="your_email_address@wherever.com"/>

<form id="guessNumber">
   
<field name="F_1" slot="MySlot">
<prompt>
    Please punch in a number on your keypad.
  </prompt>

    <grammar type="text/gsl">
<![CDATA[[
  [(dtmf-1)] {<mySlot "one">}
  [(dtmf-2) ] {<mySlot "two">}
[(dtmf-3) ] {<mySlot "three">}
[(dtmf-4) ] {<mySlot "four">}
[(dtmf-5) ] {<mySlot "five">}
[(dtmf-6) ] {<mySlot "six">}
[(dtmf-7) ] {<mySlot "seven">}
[(dtmf-8) ] {<mySlot "eight">}
[(dtmf-9) ] {<mySlot "nine">}
[(dtmf-0) ] {<mySlot "zero">}
]
]]>
  </grammar>

      <noinput>
      <log expr="'****no input'"/>
      <prompt>
        I did not hear you. Please try again.
      </prompt>
          <reprompt/>
    </noinput>

    <nomatch>
    <log expr="'****no match'"/>
            <prompt>
        Is that a number? Please try again.
    </prompt>
      <reprompt/>
    </nomatch>

      <filled>
        <prompt>
          You chose <value expr="F_1$.interpretation.mySlot"/>
        </prompt>
        <exit/>
    </filled>
    </field>
  </form>
</vxml>






Download the code!

  Download the source code


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  GSL Grammar Slots  |  TOC  |  GSL Built-in Grammars  

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site