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

how do I catch errors that occur a certain number of times?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
ban
Posts: 21
Joined: Mon May 03, 2004 1:39 pm

how do I catch errors that occur a certain number of times?

Post by ban »

I am trying to reprompt the user when they enter the first 2 invalid numbers, after the 3rd invalid number, I use <submit> to go to a 'goodbye' script. If the number is valid, the rest of the script is executed.

However, I cannot get the script to quit after 3 invalid numbers.
It quits after 3 nomatch or noinput fine. It also works fine if you enter a valid number.

What is wrong here?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//The Plum Group//Voice Markup Language 2.0//EN" "http://vxml.plumgroup.com/vxml-221.dtd">
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
  <form id="id" scope="dialog">
    <block>
      hello
    </block>
    <field name="fieldPin" type="digits">
      <catch event="invalid" count="1">
        <reprompt/>
      </catch> 
      <catch event="invalid nomatch noinput" count="3">
        <prompt bargein="false">
          <audio src="/vxml/audio/dummy.wav">
            The application only permits 3 invalid PIN attempts.  
            Please call 800-555-1212 to make sure you have a valid  
            PIN number.
          </audio>
        </prompt>
        <var name="msgReference" expr="'3_101730'" />
        <submit next="http://website/vxml/goodbye.xml" 
                    namelist=" msgReference" 
                    method="get" 
                    enctype="application/x-www-form-urlencoded" />
      </catch>
      <prompt bargein="true">
        <audio src="/vxml/audio/dummy.wav">
          Please enter your pin number.</audio>
      </prompt>
      <filled>
        <if cond="fieldPin!=1234">
          The value<value expr="fieldPin" /> is not valid
          <clear namelist="fieldPin"/>
          <throw event="invalid"/>
        </if>
      </filled>
    </field>
    <field name="field90" type="number">
      <prompt bargein="true">
        <audio src="/vxml/audio/dummy.wav">
          What is your weight in pounds?
        </audio>
      </prompt>
      <filled>
      </filled>
      <nomatch>
        <audio src="/vxml/audio/sorry.wav">
          Sorry I didn't understand
        </audio>
        <audio src="/vxml/audio/useKeyboard.wav">
          You can also enter the value using the keypad.
        </audio>
        <reprompt />
      </nomatch>
    </field>
    <field name="confirm90">
      <grammar type="application/x-jsgf">(yes|1) {yes} | (no | 2) {no}</grammar>
      <prompt bargein="false">
        <audio src="/vxml/audio/dummy.wav">
          You entered <value expr="field90" /> 
        </audio>
        <audio src="/vxml/audio/isCorrect.wav">
          Is this correct?
        </audio>
      </prompt>
      <filled> 
        <if cond="confirm90=='no'">
          <clear namelist="field90 confirm90" />
          <goto nextitem="field90" />
        </if>
      </filled>
    </field>
    <var name="msgReference" expr="'3_101730'" />
    <block>
      <submit next="http://website/receive"   
                    namelist="field90"confirm90  msgReference" 
                    method="get" 
                    enctype="application/x-www-form-urlencoded"/>
     </block>
  </form>
</vxml>

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

IVR script error clears out the count field

Post by support »

I haven't actually tried this IVR script, but it looks like <clear namelist="fieldPin"/> is probably clearing out the count field too, such that its always being set to 1, and therefore never increments the count to 3. Try maintaining the count in a separate <var>, and increment the count manually. Then check to see if the var you are incrementing == 3, if so <submit> to the goodbye script.

If this doesnt work let me know and we'll take another pass at it. :)
hope this helps!

Plum Support

Post Reply