We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

nomatch tag not working

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
davisco
Posts: 2
Joined: Wed Jan 10, 2007 12:11 pm

nomatch tag not working

Post by davisco »

I am having problems with the <nomatch> tag. What I am trying to do is fairly basic - in pseudocode:

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 -----
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.

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>
I have also tried the code above with a different grammar:

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>
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.

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>
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

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: nomatch tag not working

Post by support »

Hi,

The error was with the line (in your first script):

Code: Select all

<field name="clockInChoice" type="digits">
Should be changed to:

Code: Select all

<field name="clockInChoice">
Reason being that setting type="digits" defines the build-in digits grammar, which will accept any number of digits as valid input. Therefore, if you entered any numbers at all, your <else/> block would be hit in the <filled> block, and a nomatch would never occur. If you remove this, then the only grammar that will be applied to the field will be the grammar you have defined as 1 or 2.

Please let us know if you have any questions.

Regards,
Plum Support

davisco
Posts: 2
Joined: Wed Jan 10, 2007 12:11 pm

Re: nomatch tag not working

Post by davisco »

Thanks! That was it! I thought that was specifying dtmf -vs- voice. Didn't realize it was overriding the rule I was adding in.
Thanks again.

Post Reply