| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| accept | Data Type: (approximate|exact) | Default: Optional |
| accept is a w3c compliant attribute that allows the developer to specify whether an exact or an approximate utterance will be considered a valid grammar match for the phrase contianed within the choice element. If set to 'approximate' then the caller is allowed quite a bit of leeway in regards to how exact the utterance must be, while a setting of 'exact' designates more stringent control of what is considered valid. For example, if the grammar value is the string 'david hasselhoffs self integrity', then an utterance of 'hasselhoff' will be considred a valid match if the accept setting is 'approximate', but not if set to 'exact'. Do note that the choice accept value will override the menu accept setting; therefore, to ease confusion, it is recommended that you simply use the choice accept setting whenever possible. | ||
| dtmf | Data Type: (true|false) | Default: False |
| The dtmf attribute, when set to 'true', will assign the first 9 menu choices implicit dtmf grammar values, unless the choices already have them explicitly assigned. Unless specified, the default value for the dtmf attribute is false, thus disallowing implicit dtmf grammar assignation. An important caveat to remember is that on the VXML 2.0 browser, the method for assigning dtmf menu choices has been modified to reflect the changes to the w3c 2.0 specification. If the menu’s dtmf attribute has been set to ‘true’, and any choices within the menu have explicitly specified dtmf values, then a fatal error.badfetch will be thrown. | ||
| id | Data Type: ID | Default: Optional |
| The id attribute specifies the navigational identifier of the form element. Once specified, the developer can assign the id as a destination of any goto statement. | ||
| scope | Data Type: (dialog|document) | Default: Dialog |
| The scope attribute denotes the scope of any grammars contained within the menu. If set to ‘dialog’, (default), then all grammars contained will only be active within the current form. If set to ‘document’, then the grammars will be considered active throughout the current page of Voicexml code. If, however, the scope is set to ‘document’ in the application root document, then the menu grammar will be active throughout the entire application. | ||
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <!-- document scoped match --> <catch event="batboy_event"> <prompt> bat boy is always the life of the party.</prompt> </catch> <!-- document scoped match --> <catch event="elvis_event"> <prompt> the two headed elvis clone is indeed popular.</prompt> </catch> <!-- dialog scoped match --> <catch event="bigfoot_event"> <prompt> lie za minell e, while being both the bride of bigfoot, and immensely popular to those with no taste or sense of artistic merit, is not nearly the most popular tabloid celebrity. </prompt> <!-- fans of liza minelli should always be disconnected immediately --> <disconnect/> </catch> <menu id="M1" scope="dialog" dtmf="true"> <prompt> Who is the most infamous celebrity in the weekly world news tabloid? </prompt> <prompt> <enumerate> For <value expr="_prompt"/>, press <value expr="_dtmf"/> </enumerate> </prompt> <choice event="bigfoot_event"> lie za manelly </choice> <choice event="bigfoot_event"> bride of bigfoot </choice> </menu> <menu id="M2" scope="document" dtmf="false"> <prompt>.</prompt> <!-- note that an empty prompt within this menu is neccessary to avoid a badfetch--> <choice event="batboy_event"> bat boy </choice> <choice event="elvis_event"> elvis clone <grammar type="text/gsl">[(?the two headed elvis clone)]</grammar> </choice> </menu> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
pjamestx
|
|
| The description of the menu's id attribute leads one to believe that you can use a goto to navigate to a menu. However, the information on the goto tag seems to indicate that it can only target a URI or a form. Is it possible to goto a menu? | |
MattHenry
|
|
| Hiyas,
You can indeed use the <goto> to navigate to a <menu>, as long as it is properly formatted: <goto next="#MyMenuName"/> Let me know if you run into any problems. ~Matt |
|
shinde_pallavi
|
|
| In the above example, if the dtmf property of menu M2 were set to true, then which event would be thrown when the caller pressed dtmf-1? Would it be bigfoot_event or elvis_event? | |
MattHenry
|
|
| Note that in the event that M2 had it's dtmf property set to true, then our mappings would be as follows:
dtmf-1 = batboy_event dtmf-2 = elvis_event <menu id="M2" scope="document" dtmf="true"> <prompt> choose an event by pressing 1 or 2</prompt> <!-- note that an empty prompt within this menu is neccessary to avoid a badfetch--> <choice event="batboy_event"> bat boy </choice> <choice event="elvis_event"> elvis clone <grammar type="text/gsl">[(?the two headed elvis clone)]</grammar> </choice> </menu> ~Matt |
|
john.ament
|
|
| Just wondering if I could get a comment on how to get a timeout catch or invalid number catch? We use DTMF input only. For invalid numbers, I just assigned the extra numbers to the same event. Is there another way? | |
MattHenry
|
|
|
Hiya John, To catch either of these events, then you'd probably want to define a catch handler. As such, you'd be looking at something like this, for the sample code above: <menu id="M1" scope="dialog" dtmf="true"> <!-- 'wrong' keypress --> <nomatch> <audio src="InvalidInput.wav"/> <goto next="#M1"/> </nomatch> <!-- no keypress at all --> <noinput> <audio src="DidnthearAnything.wav"/> <goto next="#M1"/> </noinput> I should also mention that if you are looking to use DTMF input only, then you might want to turn off the voice reco altogether, by way of the 'inputmodes' property setting....check out 'Appendix H: Property Guide' for details. ~Matthew Henry |
|
john.ament
|
|
| Matt-
Thanks for the info. I had asked another question but dropped it after rereading the specifications. Thanks. |
|
mikethompson
|
|
| Hey John,
Glad we could help you out =^) Regards, Mike Thompson Voxeo Extreme Support |
|
bpcamac
|
|
| Subject : DTMF="#"
The voxeo test platform correctly announces the dtmf key # as the pound sign when enumerating the choices, but never recognizes it as a valid response eventhough it does recognize "1" and "*" in the example below. Any ideas why it doesn't work? Does the pound sign need to be escaped? Enclosing the key in single quotes produces parsing errors. <menu> <prompt> <enumerate> <value expr="_prompt"/> press <value expr="_dtmf"/>. </enumerate> </prompt> <choice next="#Menu1" dtmf="1"> To select the first choice </choice> <choice next="#Menu1" dtmf="*"> To select the second choice </choice> <choice next="#MainMenu" dtmf="#"> To return to the main menu </choice> </menu> |
|
MattHenry
|
|
|
Hi there, The '#' key isusually reserved as the default terminating character; you will need to change this default termchar if you want to use this as an option within your application. Check out "appendix H:property guide", and do a quick serach for the 'termchar' property to learn how you can get around this. ~Matt |
|
PUNUKA
|
|
| hi .. In w3c voicexml 2.0 and 2.1 how many max numbers of choices are allowed in the menu tag? in case of inputmode set as speech and not dtmf and suppose I specify a grammar tag inside the menu and the choices have their prompts(text) which one will be used as recognition grammar for use input? which takes precedence? is it the grammar or the choice prompts? I am currently testing a voicexml 2.1 compliant and I need to be exact about this? kindly help | |
MattHenry
|
|
|
Hi there, Let's try and address these questions one by one: Q:how many max numbers of choices are allowed in the menu tag? A: I haven't tested for any specific upper limit, but I would think that as along as your VXML document doesn't get to be above 1/2 MB, then you should be okay. In all honesty, for grmmars this complex, then you might want to think about simply writing an external grammar, and referencing it via the <field> element for easier management of your code. Q:in case of inputmode set as speech and not dtmf and suppose I specify a grammar tag inside the menu and the choices have their prompts(text) which one will be used as recognition grammar for use input? A: If inputmodes is set to "speech" then all DTMF reco will be ignored, of course. I haven't tested a menu with a choice grammar and a inline or external grammar, but I would assume that both would be active. However, this makes for ugly code. I would suggest sticking with one method or the other. Q: which takes precedence? is it the grammar or the choice prompts? A: Again, this isn't something that I have specifically tested for, but you can try setting different interpretation values for each, and confirming which of the two will take priority. ~Matt |
|
VXMLDud
|
|
| Is it possible to use the grammar element as a child of the choice element in a menu, while the menu attribute for DTMF is set to TRUE? The VoiceXML specification states that when an explicit DTMF sequence is given in the choice under such a scenario an error is thrown, and the grammar element may specify a DTMF sequence to be matched. E.g.
Also is there anything to stop us from specifying a grammar for some of the choices in a menu? See e.g. <menu> <choice next="http://www.sports.example.com/vxml/start.vxml"> <grammar src="sports.grxml" type="application/srgs+xml"/> Sports </choice> <choice next="http://www.weather.example.com/intro.vxml"> Weather </choice> <choice next="http://www.stargazer.example.com/voice/astronews.vxml"> Stargazer astrophysics news </choice> </menu> |
|
mikethompson
|
|
| Hello VXMLDud,
I did some testing around your questions and I have some information for you... I could not cause an error badfetch, per the documentation, when explicitly defining a DTMF value (for <choice), in conjunction with the DTMF attribute in <menu>. In the below code sample, I was able to get a successful match when using both dtmf="value" within <choice> and by using an inline grammar within choice. Of course, during both tests I had dtmf="true" within <menu>. <vxml version="2.0"> <!-- document scoped match --> <catch event="batboy_event"> <prompt> bat boy is always the life of the party.</prompt> </catch> <!-- document scoped match --> <catch event="elvis_event"> <prompt> You said the elvis clone. </prompt> </catch> <menu id="M2" scope="document" dtmf="true"> <prompt> choose an event by pressing 1 or 2</prompt> <choice event="batboy_event"> bat boy </choice> <choice event="elvis_event" dtmf="4"> elvis clone <!-- <grammar type="text/gsl">[dtmf-4]</grammar> --> </choice> </menu> </vxml> I'm going to discuss this with Engineering and see if we can make this behave more in line with the spec. Stay tuned, Mike Thompson Voxeo Corporation |
|
mikethompson
|
|
| Hello,
As an update, I wanted to let you know our Engineers are tracking the issue in internal bug ticket #490342. Once Voxeo Engineering has had a moment to diagnose the bug and make a fix, I will post back to this ticket with the information. Best, Mike Thompson Voxeo Corporation |
|
mikethompson
|
|
| Hello,
I spent some more time reviewing this issue with our Platform Engineers, and I have some information for you. After looking closer at the spec, it only defines the use of the DTMF attribute, not external grammars. As such, the example I used a while back is working as intended. However, *this* example should throw a error.badfetch: <vxml version="2.0"> <!-- document scoped match --> <catch event="big_boy"> <prompt> who's a big boy? You are.</prompt> </catch> <!-- document scoped match --> <catch event="pork"> <prompt> You chose pork chops.</prompt> </catch> <menu id="M2" scope="document" dtmf="true"> <prompt> choose an event by pressing 4</prompt> <!-- note that an empty prompt within this menu is neccessary to avoid a badfetch --> <choice event="big_boy" dtmf="5"> big boy </choice> <choice event="pork"> <!-- Pork chops --> <grammar type="text/gsl">[dtmf-4]</grammar> </choice> </menu> </vxml> However, the above example is *not* throwing an error.badfetch either. This is because our VXML Platform Engineers do not agree with the spec behavior in this scenario. It tends to put unnecessary constraints on the contents of the VXML document. In short, we've given the developer more control (and options) with the menu/choice combination. As such, the above snippet will allow the user to use "5" instead of cause the application to get a bad fetch. :) Please let me know if you have additional questions. Best, Mike Thompson Voxeo Corporation |
|
DeKey
|
|
| I have a question:
how do you retrieve the value of a menu that has been filled? I tried the following but it doesnt work... <menu id="mymenu" scope="document" dtmf="false"> <prompt> Please say one of the following choises: <enumerate/> </prompt> <choice next="#c1"accept="approximate">choice 1</choice> <choice next="#c2" accept="approximate">choice 2</choice> <choice next="#c3" accept="approximate">choice 3</choice> <choice next="#c" accept="approximate">choice 4</choice> </menu> <form id="c1" scope="dialog"> <block> <prompt> Did you say <value expr="document.mymenu"/>? </prompt> <exit/> </block> </form> |
|
voxeojeremyr
|
|
| Hi DeKey,
Because we have have left the menu form, the variable "menuchoice" is out of scope and no longer available. To get the last speech interpretation you can use this in your "c1" form: <value expr="application.lastresult$[0].interpretation"/> If you have any questions, please let us know. Thanks, Jeremy Richmond Voxeo Support |
|
DeKey
|
|
| This is an interesting approach (and it's working alright). But it raises two questions:
I) how do I submit the value of the menu (with submit tag) II) is there a way to ask for user confirmation (e.g. was your choice ??) while menu is on scope? |
|
VoxeoDustin
|
|
| Hey,
1) You can find some pretty good examples of using submit to send data off in our docs. You'll simply want to use the variable name you'd like to submit in the namelist attribute of submit. http://docs.voxeo.com/voicexml/2.0/submit.htm 2) Once you've stored the value of the response in a variable, you can then use a subsequent field with type="boolean" to get a yes/no response from the caller: <form id="Form_2"> <field name="Verify" type="boolean"> <prompt>You said <value expr="application.lastresult$.interpretation"/>. Is that correct? </prompt> <filled> <if cond="Verify"> <goto next="#Form_3"/> <else/> <goto next="#Menu_1"/> </filled> </field> </form> Cheers, Dustin |
|
chuchoomar
|
|
| 1. the element filled is a menu child?......or no it is possible?
2. is possible and how is possible that i have in a one menu with dtmf and voice recognition? |
|
VoxeoDustin
|
|
| Hey,
The filled element is only a valid child of field, which may be better suited for your purposes. http://docs.voxeo.com/voicexml/2.0/field.htm You can certainly look for both DTMF and voice input in the same field: <field name="F_1"> <grammar type="application/grammar+xml" mode="voice" xml:lang="en-us" root="VOICE"> <rule id="VOICE"> <one-of> <item> apples </item> <item> oranges </item> </one-of> </rule> </grammar> <grammar type="application/grammar+xml" mode="dtmf" xml:lang="en-us" root="DTMF"> <rule id="DTMF"> <one-of> <item> 1 </item> <item> 2 </item> </one-of> </rule> </grammar> <prompt> Press 1 or say apples for apples, press 2 or say oranges for oranges </prompt> <filled> <prompt> You selected <value expr="F_1"/> </prompt> </filled> </field> Thanks, Dustin |
|
crishvi
|
|
| hi,
According to the what you said the dtmf values are automatically assigned to the choice elements but what will happen if the number of choice elements exceed 10 ???.I mean will it recognise if i enter 11 through dtmf or try to take 1 for the current menu and take 1 for the next dialog like it does in the case of field . Thanks, Rishvi |
|
voxeojeff
|
|
| Hi Rishvi,
When you have dtmf set to 'true' in your <menu> element, it automatically assigns the first 9 choices to implicit dtmf values (assuming you have 9). If you wish to go beyond 9, I'd recommend setting them in the <choice> elements, as they will allow for DTMF sequences. For example: <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <catch event="Event_1 Event_2"> <prompt> <value expr="_message"/> </prompt> </catch> <menu id="menu"> <prompt> Would you like selection one or twelve? </prompt> <choice event="Event_1" dtmf="1" message="'you selected one'"> </choice> <choice event="Event_2" dtmf="12" message="'you selected twelve'"> </choice> </menu> </vxml> Pressing a dtmf-1 dtmf-2 sequence triggers Event_2's message. On the other hand, pressing dtmf-1 alone or followed by the pound sign (#) will trigger Event_1's message. The pound key is the default termchar, and can be used when you don't want to wait for your selection to register. Hope this helps, Jeff |
|
crishvi
|
|
| Thanks for the quick reply.You guys are doing a great job. | |
annuvinayak
|
|
| Hi,
I want to specify a similar action to take place for more then one DTMF choices. Can anyone suggest how I could do that. This is what I want to do: <menu id="M1" dtmf="true"> <prompt> Press one for sports or two for weather </prompt> <choice dtmf="1" next="#x" /> <choice dtmf="2" next="#y" /> <choice dtmf="3 4 5 6 7 8 9 0" next="#z" /> </menu> Thanks in advance! |
|
VoxeoDustin
|
|
| Hey,
The dtmf attribute of choice specifies a sequence of key presses necessary to match, so to enable the same target for multiple DTMF key presses, we'll have to specify a choice for each possible entry: <choice dtmf="3" next="#z" /> <choice dtmf="4" next="#z" /> <choice dtmf="5" next="#z" /> Cheers, Dustin |
| login |