| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<grammar xml:lang="en-US" root = "TOPLEVEL">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> dtmf-1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item>
<item> dtmf-2 <tag> <![CDATA[ <F_1 "two"> ]]> </tag> </item>
<item> dtmf-star <tag> <![CDATA[ <F_1 "star"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> 1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item>
<item> 2 <tag> <![CDATA[ <F_1 "two"> ]]> </tag> </item>
<item> * <tag> <![CDATA[ <F_1 "star"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<grammar> element. This is good coding practice, and really should be made a habit if we don't want to look like hacks. Just imagine what The Neighbors would think if the saw you write a grammar without the 'mode' being set....The Horror!
<grammar xml:lang="en-US" root = "TOPLEVEL">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> 1 <tag> <![CDATA[ <F_1 "yes"> ]]> </tag> </item>
<item> yes <tag> <![CDATA[ <F_1 "yes"> ]]> </tag> </item>
<item> 2<tag> <![CDATA[ <F_1 "no"> ]]> </tag> </item>
<item> no <tag> <![CDATA[ <F_1 "no"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<grammar src> will be needed within your voice reco fields:
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> 1 <tag> <![CDATA[ <F_1 "yes"> ]]> </tag> </item>
<item> 2 <tag> <![CDATA[ <F_1 "no"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="voice">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> yes <tag> <![CDATA[ <F_1 "yes"> ]]> </tag> </item>
<item> no <tag> <![CDATA[ <F_1 "no"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> dtmf-1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item>
<item> dtmf-2 <tag> <![CDATA[ <F_1 "two"> ]]> </tag> </item>
<item> dtmf-star <tag> <![CDATA[ <F_1 "star"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
| ANNOTATIONS: EXISTING POSTS |
beta
|
|
| I'm currently testing on Voxeo Prophecy.
It seems that with mode="dtmf" in an embedded gramamr <item> dtmf-1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item> works fine, which contradicts the last statement "Also note that if we try to get clever, and mix up our syntax, then errors will definitely crop up" but <item> 1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item> as stated above, which should work, does not work. I tried to use <item> dtmf-1 <tag> <![CDATA[ <F_1 "one"> ]]> </tag> </item> without mode="dtmf" and this works fine as well. I'm confused. |
|
MattHenry
|
|
|
Hi there, I should point out that this set of documentation was written for the Voice Center 5.5 release, and is not meant to be used specifically for Prophecy application development. As such, discrepancies will exist between the documentation, and how Prophecy behaves. As Prophecy is still a Beta product, we have not written a dedicated set of documentation for it, but we plan on doing so sometime in the next few months. Hope this clears things up, ~Matthew Henry |
|
yana
|
|
| I still don't understand how DTMF grammar looks for any x digits (for example - enter you ID) | |
MattHenry
|
|
|
Hello Yana, As I understand it, you want to capture a variable length digit input from your callers. Your choices are as follows: 1) Create a grxml grammar using one-of/item/ruleref that allows you to capture the string. Examples that illustrate the general subgrammar structure to use can be found in the below link: http://docs.voxeo.com/voicexml/2.0/grxmlsubg.htm 2) Use the predefined 'num2sixteen' GSL grammar in our downloadables section: http://evolution.voxeo.com/library/grammar/library.jsp 3) Leverage the field type grammars, as illustrated in the below link: http://docs.voxeo.com/voicexml/2.0/gslbuiltins.htm Chances are that if you find yourself stuck on a particular concept specific to VXML, our documentation has this fully detailed already, and more than likely has sample code that illustrates this plainly to minimize confusion. Regards, ~Matthew Henry |
|
Jenny
|
|
| Hi All
I need a grxml grammar to accept 4 digits from the user Can any body help ASAP???? Thanks in advance |
|
jbassett
|
|
| Hello,
Have you tried something like utilizing the built-in field type grammars like the example below? <field name="pin" type="digits?length=4"> Let me know if this is what you were looking for. Thanks Jesse Bassett Voxeo Support |
|
Jenny
|
|
| Thanks Jesse..
Actually I want grxml grammar to work in different platform. I could not use built-in types. My expectation solved with the following grammar <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd"> <grammar version="1.0" root ="Pin" xmlns="http://www.w3.org/2001/06/grammar"> <rule id = "Pin" scope ="public"> <item repeat = "4"><ruleref uri="#digit"/></item> </rule> <rule id = "digit"> <one-of> <item>one</item> <item>two</item> <item>three</item> <item>four</item> ...... </one-of> </rule> </grammar> Thanks, Jenny |
|
jbassett
|
|
| Hello,
I am glad things worked out for you. I will go ahead and mark this ticket as closed. Feel free to re-open it, or ask any further questions. Thanks Jesse Bassett Voxeo Support |
|
Jenny
|
|
| Hi,
Thanks for ur support. As per my requirement I modified the previous grammar to either accept any 4 digit number or "0" as user input. <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd"> <grammar version="1.0" root ="Pin" xmlns="http://www.w3.org/2001/06/grammar"> <rule id = "Pin" scope ="public"> <one-of> <item repeat = "4"><ruleref uri="#digit"/></item> <item>0</item> </one-of> </rule> <rule id = "digit"> <one-of> <item>one</item> <item>two</item> <item>three</item> <item>four</item> ...... </one-of> </rule> </grammar> when I am using with in vxml as inline grammar within "field" element it is ok. But if I want to use this grammar in some other tool so I want to return back the slots filled. The slot might be either any four digit number or "0". Using Tag with in Grammar how could I achieve that? I need to collect the user values in particular slot...or particular variable... How could I do that? |
|
Jenny
|
|
| Hi,
Can any body tell me with one user input how can i fill two slots? if we are getting the input as "12 Main street" how can I fill the slots <streetNumber> as "12" and <streetName> as "Main Street" This grammar need to be dynamic enough to accept different street numbers and street names? I need this to be a grxml grammar.. Can anybody help. Thanks in Advance, Jenny |
|
jefo12
|
|
| how to enable dynamic grammar using dtmf...
<prompt> The appointments are </prompt> <foreach item="applist" array="myarr"> <prompt><value expr="applist"/><break/></prompt> </foreach> //palys all the appointments the callerid has..... <prompt> Do you want to cancelorreschedule any of those appointments say cancel or reschedule or if you want to take an new appointment say schedule.. </prompt> If the user selects cancel...then <prompt>To cancel any of the appointments press the corresponding dtmf button to cancel </prompt> //how can i do this dynamiclaly.... plz suggest me..... |
|
vikesh
|
|
| Hi,
I need to take username (e.g xyz123) and password input through touch tone (DTMF), how can I do that, that user enter his username and press # to end it and password and store it in variable to submit it in database. I read the grammar rules but didn't understand how to do that. Please help, as i have to complete my task very soon. |
| login |
|