Page 1 of 1

Mixed Intutive Grammer - Getting Syntax error while calling

Posted: Thu Mar 26, 2009 6:22 am
by amitkhosla
I'm getting the following error. Can youplease help me to resolve this
dtmf input: 1
Found grammar match
hypothesis #0: {choice: 1} {appointmentId: 121} {subject: Surgery} {location: New Delhi} {organizationName: Apollo} {organizationPhone: 123-456-7890} {organizationAddress: delhi} (0.9990)
missing name after . operator line 1
SyntaxError: missing name after . operator line 1
received event: error.semantic.ecmascript:
bargein set to true
INPUTMODES set to "DTMF VOICE"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak>
A serious error of type </speak>
---------
<?xml version='1.0'?><speak>error.semantic.ecmascript</speak>
---------



Here is the vxml
-----------------------------------
<vxml version="2.0">
<form id="checkin_main_frm">
<property name="timeout" value="15s"/>
<grammar type="application/x-jsgf" mode="voice">
( repeat {choice=repeat;} )
</grammar>
<grammar type="application/x-jsgf" mode="dtmf">
(
1 {choice=1;
appointmentId=121;
subject=Surgery;
location=New Delhi;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=delhi;} |

2 {choice=2;
appointmentId=141;
subject=Tooth Decay;
location=New York;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=london;} |


3 {choice=3;
appointmentId=332;
subject=leg pluster;
location=cambridge;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=cambridge;} | 4 {choice=4;} )
</grammar>

<initial>
<prompt>
What do you want to do?
Press 1 for check in to Surgery at New Delhi
Press 2 for check in to Tooth Decay at New York
Press 3 for check in to leg pluster at cambridge
Press 4 to repeat the menu.
Say repeat to go to main menu.
</prompt>
</initial>

<field name="choice"/>
<field name="appointmentId"/>
<field name="subject"/>
<field name="location"/>
<field name="organizationName"/>
<field name="organizationPhone"/>
<field name="organizationAddress"/>
<filled>
<if cond="choice=='4'">
<goto next="#menurepromt"/>
<elseif cond="choice=='repeat'" />
<submit next="/ivr/welcome.action"/>
<else/>
<goto next="#checkIn"/>
</if>
</filled>
<noinput>
Please make a selection.
<reprompt/>
</noinput>
<nomatch>
Sorry, I didn't understand.
Please make a correct selection.
<clear namelist="appointmentId subject location organizationName organizationPhone organizationAddress"/>
<reprompt/>
</nomatch>
</form>

<form id="checkIn">
<property name="timeout" value="7s"/>
<field name="confirm">
<grammar type="application/x-jsgf" mode="dtmf">
( 1 | "#" )+
</grammar>
<prompt bargein="true">
You selected to check in into appointment with
id <value expr="appointmentId"/>
subject <value expr="subject"/>
location <value expr="location"/>
organization name is <value expr="organizationName"/>
phone number is <value expr="organizationPhone"/>
address is <value expr="organizationAddress"/>

Press one to confirm.
Press pound key to cancel and go back to previous menu.
</prompt>

</field>
<filled>
<if cond="confirm==1">
<submit namelist="appointmentId" next="/ivr/confirmCheckin.action"/>
<elseif cond="confirm=='#'" />
<goto next="#checkin_main_frm"/>
</if>
</filled>
<noinput>
<reprompt/>
</noinput>
<nomatch>
Sorry, I didn't understand.
Please make a correct selection.
<reprompt/>
</nomatch>
</form>

<form id="menurepromt">
<block>
<clear namelist="confirm"/>
<reprompt/>
</block>
</form>
</vxml>

IVR code for grammar

Posted: Thu Mar 26, 2009 11:31 am
by support
Hi Amit,

Looking at this block of IVR code:

Code: Select all

<form id="checkIn">
<property name="timeout" value="7s"/>
<field name="confirm">
<grammar type="application/x-jsgf" mode="dtmf">
( 1 | "#" )+
</grammar>
<prompt bargein="true">
You selected to check in into appointment with
id <value expr="appointmentId"/>
subject <value expr="subject"/>
location <value expr="location"/>
organization name is <value expr="organizationName"/>
phone number is <value expr="organizationPhone"/>
address is <value expr="organizationAddress"/>

Press one to confirm.
Press pound key to cancel and go back to previous menu.
</prompt>

</field>
<filled>
<if cond="confirm==1">
<submit namelist="appointmentId" next="/ivr/confirmCheckin.action"/>
<elseif cond="confirm=='#'" />
<goto next="#checkin_main_frm"/>
</if>
</filled>
<noinput>
<reprompt/>
</noinput>
<nomatch>
Sorry, I didn't understand.
Please make a correct selection.
<reprompt/>
</nomatch>
</form> 
we noticed that you are putting your <filled> block outside of your field so the <if> condition inside of your <filled> block does not know what to act on.

You should be placing your <filled> block inside of the <field> block.

Hope these changes to your IVR code helps.

Regards,
Plum Support

Posted: Thu Mar 26, 2009 1:04 pm
by amitkhosla
hi

I'm actually facing getting the error 'coz of this grammer, Can you tell me what is the right way to set different fields in one go when user press any key suppose 1.

<grammar type="application/x-jsgf" mode="dtmf">
(
1 {choice=1;
appointmentId=121;
subject=Surgery;
location=New Delhi;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=delhi;} |

2 {choice=2;
appointmentId=141;
subject=Tooth Decay;
location=New York;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=london;} |


3 {choice=3;
appointmentId=332;
subject=leg pluster;
location=cambridge;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=cambridge;} | 4 {choice=4;} )
</grammar>

actual error -

Posted: Thu Mar 26, 2009 2:30 pm
by amitkhosla
hi

I'm actually facing getting the error 'coz of this grammer, Can you tell me what is the right way to set different fields in one go when user press any key suppose 1.

<grammar type="application/x-jsgf" mode="dtmf">
(
1 {choice=1;
appointmentId=121;
subject=Surgery;
location=New Delhi;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=delhi;} |

2 {choice=2;
appointmentId=141;
subject=Tooth Decay;
location=New York;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=london;} |


3 {choice=3;
appointmentId=332;
subject=leg pluster;
location=cambridge;
organizationName=Apollo;
organizationPhone=123-456-7890;
organizationAddress=cambridge;} | 4 {choice=4;} )
</grammar>[/quote]

IVR grammar fix

Posted: Thu Mar 26, 2009 4:15 pm
by support
Hi,

Since your IVR grammar is a bit complex, we restructured it to be an SRGS+XML grammar.

mixedgrammar.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form id="checkin_main_frm">
<property name="timeout" value="15s"/>
<grammar mode="dtmf" type="application/srgs+xml" root="ROOT" version="1.0">
<rule id="ROOT" scope="public">
<one-of>
<item>
1 
<tag>
choice=1;
appointmentId=121;
subject="Surgery";
location="New Delhi";
organizationName="Apollo";
organizationPhone="123-456-7890";
organizationAddress="delhi";
</tag>
</item>
<item>
2
<tag>
choice=2;
appointmentId=141;
subject="Tooth Decay";
location="New York";
organizationName="Apollo";
organizationPhone="123-456-7890";
organizationAddress="london";
</tag>
</item>
<item>
3
<tag>
choice=3;
appointmentId=332;
subject="leg pluster";
location="cambridge";
organizationName="Apollo";
organizationPhone="123-456-7890";
organizationAddress="cambridge";
</tag>
</item>
<item>
4
<tag>
choice=4;
</tag>
</item>
</one-of>
</rule>
</grammar> 

<initial>
<prompt>
What do you want to do?
Press 1 for check in to Surgery at New Delhi
Press 2 for check in to Tooth Decay at New York
Press 3 for check in to leg pluster at cambridge
Press 4 to repeat the menu.
Say repeat to go to main menu.
</prompt>
</initial>

<field name="choice"/>
<field name="appointmentId"/>
<field name="subject"/>
<field name="location"/>
<field name="organizationName"/>
<field name="organizationPhone"/>
<field name="organizationAddress"/>
<filled>
<if cond="choice=='4'">
<goto next="#checkin_main_frm"/>
<else/>
<prompt>
The choice made was <value expr="choice"/>.
The appointment ID was <value expr="appointmentId"/>.
The subject is <value expr="subject"/>.
The location is <value expr="location"/>.
The organization name is <value expr="organizationName"/>.
The organization phone is <value expr="organizationPhone"/>.
The organization Address is <value expr="organizationAddress"/>.
</prompt>
</if>
</filled>
<noinput>
Please make a selection.
<reprompt/>
</noinput>
<nomatch>
Sorry, I didn't understand.
Please make a correct selection.
<clear namelist="appointmentId subject location organizationName organizationPhone organizationAddress"/>
<reprompt/>
</nomatch>
</form> 
</vxml>
Hope this helps.

Regards,
Plum Support