VoiceXML 2.1 Development Guide Home  |  Frameset Home

  GSL Grammar Slots  |  TOC  |  GSL Built-in Grammars  

DTMF Grammars

Note: GSL syntax is not considered to be a W3C-compliant syntax for grammars, and the Nuance has discontinued support for GSL grammars in their most recent product offerings. Voxeo will continue to support GSL-specific markup for some time to come, but it is strongly suggested that new applications and their associated grammars leverage the SRGS + SISR grammar syntaxes instead of being reliant upon the deprecated GSL grammar format.

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 your head:


<?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
kaje
11/26/2008 1:10 AM (EST)
please help me!!!!! i want to connect mysql with VXML.if u konw any one please send me follwing mail address "kajenden2006@yahoo.co.uk"

<?xml version="1.0"?>

<vxml version = "2.1">

  <meta name="maintainer" content="YOUREMAILADDRESS@HERE.com"/>


  <form id="costomerNumber">
    <field name="guess">

    <grammar type="text/gsl"> [dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-6 dtmf-7 dtmf-8 dtmf-9 dtmf-0]
    </grammar>

      <prompt>
        Well come to our voice mail services! Please type your mail ID.
      </prompt>

      <noinput>
      <prompt>
        I did not hear you. Please try again.
      </prompt>
      <reprompt/>
      </noinput>

      <nomatch>
      <prompt>
        Is that a number? Please try again.
      </prompt>
      <reprompt/>
      </nomatch>

    </field>
    <filled namelist="guess" mode="all">
      <prompt>
        We accepted your ID! <value expr="guess" />
      </prompt>
      <goto next="#playAgain" />
    </filled>
  </form>

<form id="playAgain" >
    <field name="AOrB">
      <grammar type="text/gsl">
      <![CDATA[[
        [ dtmf-1]    {  <AOrB  "A"> }
        [ dtmf-2]    {  <AOrB  "B">  }
        ]]]>
      </grammar>
      <prompt bargein="false">
        Do you want to read your message!please press one?.
if you no! please press two.
      </prompt>
    </field>
<filled name="AOrB" mode="all">
      <if cond="AOrB == 'A'">
        <goto next="#A"/>
      <elseif cond="AOrB == 'B'" />
  <goto next="#B"/>
      </if>
  </filled>
  </form>
 
  <form id="A">
    <field name="lost">
    <prompt>
      hi ravi this is text message.
    </prompt>
    </field>
    <filled>
      <if cond="lost=='1'"> 
      <goto next="#playAgain"/>       
      </if>
    </filled>
  </form>

<form id="B">
    <field name="BackToMain">
    <prompt>
      No message.
    </prompt>
    </field>
    <filled>
      <if cond="B=='1'"> 
      <goto next="#playAgain"/>       
      </if>
    </filled>
  </form>
</vxml>
voxeoJeffK
11/26/2008 1:48 AM (EST)
Hi,

What you will need to do is use server-side logic such as PHP or JSP to connect to your database. Your VXML can transfer data to the server-side logic by way of the <submit> or <data> elements. We have an outline of the basics available here:

http://docs.voxeo.com/voicexml/2.0/intro_serverside.htm

And a tutorial is here:

http://docs.voxeo.com/voicexml/2.0/qs_vars.htm

Hope that helps,
Jeff K.
Voxeo Support
shiran
11/28/2008 1:37 AM (EST)
i found a DTMF capture code(using grammar).

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

tell me where i should put this to implement DTMF capturing.
voxeoJeffK
11/28/2008 1:51 AM (EST)
Hi,

You will want to include the grammar in the scope of the relevant input item. For instance for  <field name="F_1"> the grammar will match the user's input of DTMF-1,2 or 3 and fill the F_1 variable:

<field name="F_1">
<prompt>
    Please punch in a number on your keypad.
  </prompt>

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

]
]]>
  </grammar>

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

hope that helps,
Jeff K.
Voxeo Support

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

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