nomatch tag not working
Posted: Fri Jan 16, 2015 1:07 pm
I am having problems with the <nomatch> tag. What I am trying to do is fairly basic - in pseudocode:
The 1 and 2 work fine. The problem is that seemingly no matter what I do, pressing anything other than 1 or 2 seems to fall through just like 1. As I understand it the nomatch should pick it up and do a reprompt.
Here is one version of my actual code from a scratchpad.
I have also tried the code above with a different grammar:
This has the same failure.
I have also tried another implementation taken from the vxml documentation for the <option> tag with the nomatch added in and the prompts changed for my needs.
This also seems to be ignoring the nomatch tag.
I'm sure its something I'm not handling correctly but any advice would be appreciated.
Thanks
Code: Select all
prompt: You are about to clock in. To confirm, press 1. To cancel and return to the main menu, press 2.
if( 1)
prompt: please wait while I clock you in.
else if( 2)
goto #mainMenu
nomatch
prompt: Invalid response.
reprompt
noinput
reprompt
// fall through for processing login here
menu: mainMenu
stuff.
end pseudocode -----
Here is one version of my actual code from a scratchpad.
Code: Select all
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml20/vxml.xsd">
<form id="clockIn">
<field name="clockInChoice" type="digits">
<grammar type="application/x-jsgf" mode="dtmf">
1|2
</grammar>
<prompt>
<voice name="mike" xml:lang="us_en" gender="male">
You are about to Clock In.
To confirm, press 1.
To cancel and return to the menu, press 2.
</voice>
</prompt>
<filled>
<if cond="clockInChoice=='1'">
Please wait while I clock you in.
<elseif cond="clockInChoice=='2'"/>
<goto next="#mainMenu"/>
<else />
<clear namelist="clockInChoice"/>
</if>
</filled>
<nomatch>
Your response was not valid. Please try again.
<reprompt/>
</nomatch>
<noinput>
<reprompt/>
</noinput>
</field>
<block>
<log label="Test">In form clockIn</log>
</block>
</form>
<menu id="mainMenu">
<prompt>
Main Menu - Goodbye
</prompt>
</menu>
</vxml>
Code: Select all
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf">
<rule id="ROOT">
<one-of>
<item>1</item>
<item>2</item>
</one-of>
</rule>
</grammar>
I have also tried another implementation taken from the vxml documentation for the <option> tag with the nomatch added in and the prompts changed for my needs.
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form>
<field name="clockInChoice" type="digits">
<prompt>
You are about to Clock In.
<enumerate>
To <value expr="_prompt"/>, press <value expr="_dtmf"/>.
</enumerate>
</prompt>
<option value="confirm" dtmf="1"> confirm </option>
<option value="cancel" dtmf="2"> cancel and return to the main menu </option>
<filled>
You chose <value expr="clockInChoice"/>.
<if cond="clockInChoice=='cancel'">
<goto next="#mainMenu"/>
</if>
</filled>
<nomatch>
oops... Wrong selection.
<reprompt/>
</nomatch>
</field>
<block>
<prompt>
Now processing clock in.
</prompt>
</block>
</form>
I'm sure its something I'm not handling correctly but any advice would be appreciated.
Thanks