Hi,
The following VXML script and couple of execution logs attached supplements
Puneet's earlier query.
Kindly go through the same and provide your suggestions.
VoiceXML script:
<?xml version="1.0" ?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0">
<property name="inputmodes" value="dtmf voice" />
<catch event="error.semantic">
<log> In error.semantic event handler </log>
<exit/>
</catch>
<catch>
<log> In generic event handler, event caught is <value expr="_event"/>
</log>
<log> In generic event handler, variable formVar is <value
expr="formVar"/> </log>
<exit/>
</catch>
<menu dtmf="true" scope="document">
<prompt> Welcome to menu </prompt>
<choice event="myEvent1">
first
<grammar src="builtin:dtmf/digits?length=4" />
</choice>
<choice dtmf="0" next="#form2" />
<choice event="myEvent2" />
</menu>
<form id="form2">
<var name="formVar" expr="100" />
<field name="field2" modal="false">
<grammar version="1.0" root="digit" type="application/srgs+xml"
mode="dtmf">
<rule scope="public" id="digit">
<one-of>
<item>666</item>
<item>777</item>
</one-of>
</rule>
</grammar>
<prompt> second </prompt>
<filled>
<log> In filled of field2 </log>
</filled>
</field>
</form>
</vxml>
Execution scenario1: During input collection of field2, provide input
matching menu level grammar.
Prompt: Welcome to menu
Input: 0 (matches choice no:2 ) - leads to form2
Prompt: second
Input: 1 (matches choice no:3) - FIA jumps to menu and throws myEvent2
<log>: In generic event handler, event caught is myEvent2
...Accessing formVar is menu scope leads to error.semantic
<log>: In error.semantic event handler
End of application
Execution scenario2: During input collection of field2, provide input
matching <grammar> which is a child of <choice>
Prompt: Welcome to menu
Input: 0 (matches choice no:2 ) - leads to form2
Prompt: second
Input: 5567 (matches digits?length=4 <grammar> child of choice no:1) - FIA
does not jump to menu. Throws myEvent1 in form scope
<log>: In generic event handler, event caught is myEvent1
<log>: In generic event handler, variable formVar is 100 //No
error.semantic here as formVar is accessible
End of application
Is the behavior observed in execution scenario2 correct? Is it correct for
the interpreter to not jump to menu though the grammar which matched is a
child grammar of <choice>?
Thanks
Rajesh
This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!
_____
From: www-voice-request@w3.org [mailto:www-voice-request@w3.org] On Behalf
Of Puneet Sharma
Sent: Thursday, April 02, 2009 5:10 PM
To: www-voice@w3.org
Cc: ranjit@hauwei.com
Subject: Matching a choice grammar
Hi,
I feel there is an ambiguity in behavior of <choice> element.
Consider case, where while recognition in a <form> , <menu
scope="document">'s choice is matched. Then, I feel there is an ambiguity
about scope of current execution of <choice> element. Specification does not
clarify either it should be <menu> or <form>.
Please refer below section of Vxml 2.0 :
http://www.w3.org/TR/voicexml20/#dmlAFIA
Appendix C - Form Interpretation Algorithm
//
// Process Phase: process the resulting utterance or event.
//
Assign the utterance and other information about the last
recognition to application.lastresult$.
// Must have an utterance
if ( the utterance matched a grammar belonging to a <link> )
If the link specifies an "next" or "expr" attribute,
transition to that location. Else if the link specifies an
"event" or "eventexpr" attribute, generate that event.
else if ( the utterance matched a grammar belonging to a <choice> )
If the choice specifies an "next" or "expr" attribute,
transition to that location. Else if the choice specifies
an "event" or "eventexpr" attribute, generate that event.
else if ( the utterance matched a grammar from outside the current
<form> or <menu> )
{
Transition to that <form> or <menu>, carrying the utterance
to the new FIA.
}
From this I understand that, if <choice> is matched from outside of
<menu> then execute <choice> without any transition to that <menu>, so it is
not clear that in which scope event thrown by such <choice> element should
be handled.
If it is <menu> then above specified algorithm does not allow that
because that grammar is from <choice>, and if it is <form> then <form> will
be executing <filled> from some other scope which is not right to do.
Please also clarify below points also considering above scenarios:
Specification: A menu can be viewed as a form containing a single field
whose grammar and whose <filled> action are constructed from the <choice>
elements.
This statement says that, <choice> is treated as <menu>/<form> level
grammar and but <menu> can specify scope attribute which means <choice>
can be matched at global scope.
Regards
Puneet