| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<meta name="maintainer" content="your_email_address@wherever.com"/>
</vxml>
<form> and <field> tags should also be familiar by now. Giving <form> an "id" attribute will allow us to use it like an anchor tag later. The <noinput> and <nomatch> will allow us to trap, and programmatically handle, when a caller says nothing at all, or gives an answer that the does not match a defined grammar utterance.
<?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="guess">
<prompt>
Guess what the computer is thinking! Pick a number between 0 and 9.
</prompt>
<noinput>
<prompt>
I did not hear you. Please try again. <reprompt/>
</prompt>
</noinput>
<nomatch>
<prompt>
Is that a number? Please try again.
</prompt>
<reprompt/>
</nomatch>
</field>
</form>
<noinput> and <nomatch> events that could occur during a voice dialog. W e also threw in the <reprompt> element for good measure. As it's name implies, this is simply a 'shortcut element' that will regurgitate the last audio file, (or in this case), TTS <prompt> that was played to the caller.
<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/>
<grammar type="text/gsl">
[one two three four five six seven eight nine zero]
</grammar>
<?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="guess">
<grammar type="text/gsl">
[one two three four five six seven eight nine]
</grammar>
<grammar type="text/gsl">
[dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-6 dtmf-7 dtmf-8 dtmf-9]
</grammar>
<prompt>
Guess what the computer is thinking! Pick a number between 0 and 9.
</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>
</form>
<filled namelist="guess" mode="all">
<prompt>
You said <value expr="guess" />. Your brain is enormous.
</prompt>
<goto next="#playAgain" />
</filled>
<form> to give callers the chance to guess again. This time, we're looking for a simple "yes" or "no" answer. If the caller answers "yes" we go back to the previous <form> and start over. If they answer "no" , then we can end the call.
<form id="playAgain">
<field name="confirm" slot="confirm">
<prompt bargein="false">
Do you want to play again?
</prompt>
</field>
<filled namelist="confirm" mode="all">
<if cond="confirm == 'yes'">
<goto next="#guessNumber" />
<elseif cond="confirm == 'no'" />
<prompt>
Thank you! Goodbye!
</prompt>
</if>
</filled>
</form>
<grammar type="text/gsl">
<![CDATA[[
[yes] { <confirm "yes"> }
[no] { <confirm "no"> }
]]]>
</grammar>
<?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="guess">
<grammar type="text/gsl">
[one two three four five six seven eight nine zero]
</grammar>
<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>
Guess what the computer is thinking! Pick a number between 0 and 9.
</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>
You said <value expr="guess" />. Your brain is enormous.
</prompt>
<goto next="#playAgain" />
</filled>
</form>
<form id="playAgain">
<field name="confirm" slot="confirm">
<grammar type="text/gsl">
<![CDATA[[
[yes] { <confirm "yes"> }
[no] { <confirm "no"> }
]]]>
</grammar>
<prompt bargein="false">
Do you want to play again?
</prompt>
</field>
<filled namelist="confirm" mode="all">
<if cond="confirm == 'yes'">
<goto next="#guessNumber" />
<elseif cond="confirm == 'no'" />
<prompt>
Thank you! Goodbye!
</prompt>
</if>
</filled>
</form>
</vxml>
<nomatch> and <noinput> events<reprompt> element| ANNOTATIONS: EXISTING POSTS |
dodgly
|
|
| There is a typographical error in the final example code.
On line 23 there is an open <prompt> tag but it should be a closed </prompt> tag. This will cause the application to not parse. |
|
MattHenry
|
|
| Thanks for catching that typo for me; i have this corrected, (in both spots that it was present in), which will be publicly fixed upon the next document Build update.
~Matt |
|
sonya
|
|
| how about several digits 'please enter your pin' | |
Michael.Book
|
|
| Hello "sonya,"
To capture multiple DTMF digits (or to capture multiple digits via voice for that matter) I would simply use the built-in field type "digits". For more information on field types, check out: http://docs.voxeo.com/voicexml/2.0/field.htm ..and http://docs.voxeo.com/voicexml/2.0/gslbuiltins.htm#start I hope this helps... Have Fun, ~ Michael |
|
marmor
|
|
| You refer to separate grammar files here in the instructions, but then include the grammar we created inline within the main application. So how do we reference an external grammar file? Also there is an English mistake "ready for the to recognize". -MM | |
JimMurphy
|
|
| Marmor-
There is an example of how to use external GSL grammars/subgrammars at: http://www.voicexmlguide.com/gslsubg.htm There is also an example of how to use external grXML grammars/subgrammars at: http://www.voicexmlguide.com/grxmlsubg.htm I hope that helps. If not, please let us know. -Jim |
|
dwburhans
|
|
| Change
our document is ready for the to recognize the caller's input. in the last paragraph of step 2 to our document is ready to recognize the caller's input. |
|
MattHenry
|
|
| David,
Thanks for catching that; I have this corrected in the internal build of the docs, which will be posted live sometime in the next 10 days. ~Matt |
|
mithhilarora
|
|
| Shouldn't there be
<exit/> after the Thank you! Goodbye! </prompt> |
|
MattHenry
|
|
| Hi there,
At this particular point in the application, the FIA is at the end of it's execution, so the application will inherently exit. However, smart coders, (read: coders other than myself, ha-ha), like to explicitly terminate application execution as a general rule, as this corresponds with their coding ethics. But again, this is not entirely required. ~Matt |
|
jagadishsuri
|
|
| hi
The dtmf input is fine but i need to understand how will the application which is serving the vxml file get the input the person enters on the phone with the help of numbers.i need to process that input and serve another vxml file based on the input. |
|
MattHenry
|
|
|
Hi there, I'm not totally clear on what it is that you are asking here. The user input in this example is stored within the variable called "guess": <value expr="guess" /> If we need to process based on user input, then you might do something like this: <filled> <if cond="guess == '1'"> <goto next="Input_One.xml"/> <elseif cond="guess == '2'"/> <goto next="Input_Two.xml"/> <!-- etc --> </if> </filled> Does this answer your question? If not, please provide us with additional details on exactly what it is that you are looking to do, and we would be glad to help. Regards, ~Matthew Henry |
|
jagadishsuri
|
|
| hi
nice to see ur response but u havent completly got my doubt.My doubt is for suppose if we a webapplication running some where and we want to send the values entered in the phone by the person to whom we have called to that web application which is external to the IVR.Like if he enters his name in the phone and we want to send that name to the webapplication just like hmtl form submittion with the from elements and its values.how do we do that . if iam still not clear please feel free,iam ready to explain it in more detail. thanking you regards jagadish |
|
MattHenry
|
|
|
I think I understand what you are asking, which is easily answered. How you send these values to your webserver, is by invoking the <submit> tag, and specifying your VXML variable in the namelist attribute: <submit next="http://myWebserver.com/postProcess.jsp" namelist="guess"/> And how do we access this variable in in the destination page? Check the below link for details: http://docs.voxeo.com/voicexml/2.0/qs_vars.htm ~Matthew Henry |
|
jagadishsuri
|
|
| hi
I have another question,i need to take both characters and digits as input in the form of DTMF input can u help.For example i asked the caller to enter the registration number and it is like this (we234rr).How can we take both characters and numbers as DTMF input.Both characters and digits for a single input variable.ask me if iam not clear. thanking you regards jagadish |
|
jagadishsuri
|
|
| hi
I have another question,i need to take both characters and digits as input in the form of DTMF input can u help.For example i asked the caller to enter the registration number and it is like this (we234rr).How can we take both characters and numbers as DTMF input.Both characters and digits for a single input variable.ask me if iam not clear. thanking you regards jagadish |
|
MattHenry
|
|
|
Hi there, I have to caution you that arbitrary alphanumeric recognition is one of the most difficult things to accurately capture. If you do a search on our user forums for 'alpha' and 'alphanumeric', you'll doubtlessly find several instances of my 'alphanum manifesto' that explains why this is so difficult. This being said, I do have some code that you may find useful, (originally designed to be used for Canadian zip codes), but I have to be very candid in the fact that all bets are off when it comes to accuracy. However, with some careful prompting, tuning, n-best post processing, and narrowing down of the alpha characters allowed, (if possible), you might be able to make this work for you. Some useful bakground links/tutorials are also included, as they bear on this topic: http://docs.voxeo.com/voicexml/2.0/t_14_mot.htm http://docs.voxeo.com/voicexml/2.0/t_20.htm http://docs.voxeo.com/voicexml/2.0/w3cprops.htm Best of luck! ~Matthew Henry |
|
jagadishsuri
|
|
| hi
iam happy for ur response so far.the docs here are very good but i have a small problem here a peculiar one. I need to enter the text with the help of DTMF input with out using voice.i mean charaters.like if we ask the caller to enter his first name and we should take the name into a variable . while the caller types the characters in the key pad .can u help. i have done a lot of googling in net and also in voxeo but in vain. its very important for our application. thanking you regards jagadishsuri |
|
MattHenry
|
|
|
Hi again, If you are requiring your callers to enter in a string of digits to be converted to alpha characters, I have to be very up front: There isn't really an elegant way to do this that will be user-friendly. In short, I advise against it. However, I suppose if you really wanted to, you could create a grammar file that corresponded to the numeral/alpha characters on a standard phone: [(dtmf-2)] = 'a' [(dtmf-2 dtmf-2)] = 'b' [(dtmf-2 dtmf-2 dtmf-2)] = 'c' (etc) Good luck, ~Matthew Henry |
|
jagadishsuri
|
|
| hi
thanks for that .This would solve the problem to a certain extent. but always looking for a better one. thanks for your time. |
|
marisman
|
|
| How would I disable speech input if I only want a DTMF entry? | |
mikethompson
|
|
| Hello Marisman,
There is actually a handy property that you can invoke from multiple scopes in your application. That property is known as "inputmodes" and it allows you to turn off Voice recognition (or dtmf recognition) at will. Here is an example: <vxml> <property name="inputmodes" value="dtmf"/> <form> <field> .... </field> </form> </vxml> This will disable Voice recognition across the entire document. If you would like to turn voice back on, simply use a value of "dtmf voice" and "voice" for simply voice. Hope this helps, Mike Thompson Voxeo Extreme Support |
|
jassy
|
|
| Hi,
First of all, thanks a lot for being so helpful. You guyz are really doing a great job. Thanks for your quick responses. Coming to my doubt, In our application, we need to enter text through DTMF. A few months back I saw someone came up with a similar doubt. I saw your suggession. [(dtmf-2)] = 'a' [(dtmf-2 dtmf-2)] = 'b' [(dtmf-2 dtmf-2 dtmf-2)] = 'c' . But our requirement is : If I want to enter "Main"- I jus pres dtmf-6; dtmf-2; dtmf-4; dtmf-6 How to accomplish this? How to write specifc grammars for this? Please clarify. Thanks, Jassy |
|
mikethompson
|
|
| Greeting Jassy,
What you are trying to accomplish is going to be a *huge* task, as you will need to use very extensive logic to determine the correct word from the user. If you have a pre-determined set of commands that you *know* the customer will be entering, then you could easily compare the dtmf combination to a list of results you are expecting. For example, a user enters (dtmf-4 dtmf6 dtmf-6 dtmf-3), one possible result would be 'G O O D'. So, if you have some idea of what the user will be entering, it won't be too difficult to tell which command they are entering. You will need to use either client side ECMA script or server-side logic to determine the correct results. Obviously this task will be much more difficult if the set of possible results (such as names) is enormous. This should give you a good idea of how to get started on building your advanced grammar. Let us know if you have any more questions... Regards, Mike Thompson Voxeo Corporation |
|
tornblad
|
|
| Hi there,
thanks for a great VXML site - I wouldn't have thought it would be this easy to get started with VXML. Using DTMF is pretty easy, but how do I allow users to enter numeric data using DTMF? For my app, I need something like this: "Welcome! Please dial your membership number followed by the pound key." - User dials his/her membership number - Anders Tornblad, Sweden |
|
mikethompson
|
|
| Anders,
It is actually quite simple to do this by using the <field> element with the integration of the type="number" attribute. For more information on this, go here: http://docs.voxeo.com/voicexml/2.0/gslbuiltins.htm http://docs.voxeo.com/voicexml/2.0/dtmfreco.htm Hope this helps, Mike Thompson Voxeo Corporation |
|
jassy
|
|
| Hi Mike,
Thanks for the idea. I will start with that. If any doubt further, I wil approach you back. Thanks for your response. Thanks, Jassy. |
|
tornblad
|
|
| Thanks Mike,
I had missed the built-in GSL grammars. That part of my app works like a charm now. The user is asked for his/her membership id and types it in. The id gets sent to my server through a php script, that checks the id for validity and outputs vxml to tell the user to enter his/her password, or that the membership id is faulty! It just works! =) / Anders of Sweden |
|
sidvoxeo
|
|
| Anders,
We are glad that the app works and we could assist you with all the questions. I am closing this ticket, feel free to reopen it if you have any other questions. Thanks Sid |
|
ynkrish
|
|
| hi,
The information is provided in a very concise and neat fashion :), Thanks to Voxeo for a great site.. A few small typos :) 1) The first vxml in step 2 is missing a end tag </vxml> 2) The dtmf grammer file has dtmf-6 repeated. 3) The vxml example in step3 has the dtmf-0 missing. Cheers krish |
|
rampageido
|
|
| Hi
This is an extremely great resource! Good effort and great job done! I'd appreciate some help trying to attain the following: "Please enter your 4-6 digit pin number followed by the pound key. If you have forgotten your pin, please press '1'. If you would like to change your pin, please press '2'." So far i have the following voicexml: <field name="Select3"> <property name="termchar" value=""/> <!--<property name="interdigittimeout" value="0s"/>--> <grammar mode="dtmf"> $rule = 1 | 2; </grammar> <prompt> Please enter your 4-6 digit pin number followed by the pound key. If you have forgotten your pin, please press '1'. If you would like to change your pin, please press '2'." </prompt> <filled> Debug Selected value is <value expr="Select3"/> <if cond="Select3=='1'"> <goto expr="paths.vxml('ManagePin')"/> <elseif cond="Select3=='2'"/> <goto next="#Get_Pin"/> </if> </filled> <catch event="repeat"> <assign name="Select3" expr="undefined"/> <reprompt/> </catch> <catch event="noinput"> <if cond="attempt >= maxAttempts"> <throw event="too_many_attempts"/> <else/> I\'m sorry this is not a valid entry. <assign name="attempt" expr="attempt + 1"/> </if> <reprompt/> </catch> <catch event="nomatch"> <if cond="attempt >= maxAttempts"> <throw event="too_many_attempts"/> <else/> <goto next="#Get_Pin"/> <assign name="attempt" expr="attempt + 1"/> </if> <reprompt/> </catch> </field> My problem is that if a user has a pin starting 1 or 2 , the menu option takes precedence. How can i enhance the grammar to include 1,2 and a valid 4 to 6 digit pin. Please advice Thanks Ram |
|
mjolley
|
|
| Step 3 seems to have a typo:
<grammar/> rather than </grammar> |
|
equalsatty
|
|
| is there a way to send an dtmf response from vxml to a ccxml initiated call.
i mean ccxml app A tries to call vxml application B and plays another vxml C to B . now B shud give back a dtmf digit '3', which is handled in C. -Satty |
|
JOHNCL
|
|
| Is there a way to programatically insert a 'beep tone' to indicate to the caller that the application has begun waiting for dtmf input? Similar to setting the beep attribute to true in the record element.
Thanks, JohnCl |
|
mikethompson
|
|
| Hi John,
There is not an attribute for a given field which will play a beep when the recognizer is ready for input. However, if this is what you want to do, you can always play a beep.wav directly below the field like so: <field name="whatever"> <!--Put your grammar here--> <prompt> <audio src="beep.wav"/> </prompt> <filled> <!--Whatever you want here--> </filled> </field> For your convenience, I have attached a beep audio file to this ticket for you to try out. :) Best, Mike Thompson Voxeo Corporation |
|
JOHNCL
|
|
| Many thanks for the speedy response Mike! | |
Bertrand
|
|
| Hi,
Using your example, I am trying to tweak the playAgain form so that the application can accept Yes/No OR respectiveley dtmp-1/dtmf-2. In order to do that, I added the following grammar <grammar type="text/gsl"> [dtmf-1 dtmf-2] </grammar> to the playAgaiin form. Alas it doesn't work... I' sure it's possible to accept Yes or dtmf-1 as both possible answers. How can that be done? Thanks |
|
Bertrand
|
|
| Hi,
Please ignore the above question. I found the way to do it and derived the example below from your "Pick a number" example. In this version, the number can be provided via voice or dtmf. Thanks, Bertrand <?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="guess" slot="guess"> <grammar type="text/gsl"> <![CDATA[[ [one dtmf-1] { <guess "one"> } [two dtmf-2] { <guess "two"> } [three dtmf-3] { <guess "three"> } [four dtmf-4] { <guess "four"> } [five dtmf-5] { <guess "five"> } [six dtmf-6] { <guess "six"> } [seven dtmf-7] { <guess "seven"> } [eight dtmf-8] { <guess "eight"> } [nine dtmf-9] { <guess "nine"> } [zero dtmf-0] { <guess "zero"> } ]]]> </grammar> <prompt> Guess what the computer is thinking! Pick a number between 0 and 9. </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> You said <value expr="guess" />. Your brain is enormous. </prompt> <goto next="#playAgain" /> </filled> </form> <form id="playAgain"> <field name="confirm" slot="confirm"> <grammar type="text/gsl"> <![CDATA[[ [yes dtmf-1] { <confirm "yes"> } [no dtmf-2] { <confirm "no"> } ]]]> </grammar> <prompt bargein="false"> Do you want to play again? </prompt> </field> <filled namelist="confirm" mode="all"> <if cond="confirm == 'yes'"> <goto next="#guessNumber" /> <elseif cond="confirm == 'no'" /> <prompt> Thank you! Goodbye! </prompt> </if> </filled> </form> </vxml> |
|
mikejstein
|
|
| Can DTMF tones be part of a <link> structure?
Something like : <link next="SOMEPAGE"> <grammar type="text/gsl">[dtmf-star]</grammar> </link> I've been trying that in my program, but it's not jumping to the link. Thanks, Mike |
|
MattHenry
|
|
|
Hi Mike, This is totally legal, and should work fine: As long as you have an active recognition field in the <form> where you are trying to kick off the document/global-scoped link. To explain, this wouldn't work at all, as the interpreter isn't listening for input: <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <link next="newPage.xml"> <grammar type="text/gsl">[dtmf-star]</grammar> </link> <form> <block> <audio src="someFile.wav"/> </block> </form> </vxml> ~Matt |
|
DeKey
|
|
| hi,
is there an easy way for the user to enter text? i would like to achieve the following: -hello user, please enter your first name... -(some dtmf by the user) -your name is ____ i ve seen the suggestion above: [(dtmf-2)] = 'a' [(dtmf-2 dtmf-2)] = 'b' [(dtmf-2 dtmf-2 dtmf-2)] = 'c' (etc) but that's for single characters only isn't it? i am interested in strings of characters... is there an obvious way to do that? any suggestions? |
|
mikethompson
|
|
| Hello,
There is a simple way to do this with GRXML grammars, while a GSL grammar would get a little sticky. I happen to have some sample code already whipped up which I think you will find quite useful. It uses grXML, which is quickly becoming the new standard for grammars. It also uses SISR return syntax, making this grammar 100% W3C compliant. Kindly take a look at the script attached, and let me know if you have any questions about it. One other thing I should mention is the fact this grammar uses # to complete the alpha combination. This being said, you'll need to modify the VXML termchar to something other than #, or simply change # to something like * in your grammar. Best, Mike Thompson Voxeo Corporation |
|
DeKey
|
|
| hello and thank you for replying,
How can I download the script you refer to? Excuse my ignorance but I am new to this site and besides the sample code of this article (vxml_dtmf.zip) I don't see any other script attached... In case there is a problem with the page, if you don't mind please send it to dkolia@hotmail.com Thank you! |
|
voxeojeff
|
|
| Hi DeKey,
My apologies, I do see the file attached however it is most likely not accessible through our documentation annotations. I'll go ahead and open a private account ticket for you and attach it there. If you have any questions, you may reply to the newly created ticket and we will be more than happy to assist. :-) Best regards, Jeff |
| login |
|