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

Repetitive catch blocks

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
bhairav
Posts: 9
Joined: Tue Mar 12, 2013 1:11 pm

Repetitive catch blocks

Post by bhairav »

I have a requirement, during the entire session if the user reaches maximum attempts of a specific count of nomatch noinput.
I transfer the call. But this catch block becomes redundant. Is there a better way to do this.
And is there a way to store maximum attempts count, globally.

Here is sample part of my script, where by you can see two forms with repetitive catch blocks..

<form id = "validPickupAddresses">
<field name="pickupAddress_input">
<grammar type="application/x-jsgf" mode="dtmf">
( 1 | 2 | 3)
</grammar>
<prompt>
Press 1 for <value expr="puAddress1"/>
Press 2 for <value expr="puAddress2"/>
Press 3 for <value expr="puAddress3"/>
</prompt>
<filled>
<assign name="pu_selected_number" expr="pickupAddress_input" />
<if cond = "pickupAddress_input == 1">
<assign name="client_pu_address" expr="puAddress1" />
<elseif cond = "pickupAddress_input == 2"/>
<assign name="client_pu_address" expr="puAddress2" />
<elseif cond = "pickupAddress_input == 3"/>
<assign name="client_pu_address" expr="puAddress3" />
</if>
<goto next="#enter_do_block"/>
</filled>
<catch event="nomatch noinput" count="1">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="2">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="3">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="4">
<goto next="#transferCSR"/>
</catch>
</field>
</form>

<form id="enter_do_block">
<field name="do_block_input" type="digits?length=2">
<prompt>
Please enter first two digits of DO address and press #.
</prompt>
<filled>
<assign name="client_do_block" expr="do_block_input" />
<goto next="#pullUpDropOffAddress"/>
</filled>
<catch event="nomatch noinput" count="1">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="2">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="3">
Try Again.
<reprompt/>
</catch>
<catch event="nomatch noinput" count="4">
<goto next="#transferCSR"/>
</catch>
</field>
</form>

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

Re: Repetitive catch blocks

Post by support »

Hi,

You can set the <catch> blocks to have document-level scope by placing them outside of the form items. Document-scope <catch> blocks are applied to every form within the document, thus avoiding the need to repeat them. For instance, the code below will reprompt both forms whenever it catches a nomatch or noinput event, and will go to form "transferCSR" on the 4th catch:

Code: Select all

<form id = "validPickupAddresses">
  <field name="pickupAddress_input">
    <grammar type="application/x-jsgf" mode="dtmf">
      ( 1 | 2 | 3)
    </grammar>
    <prompt>
      Press 1 for <value expr="puAddress1"/>
      Press 2 for <value expr="puAddress2"/>
      Press 3 for <value expr="puAddress3"/>
    </prompt>
    <filled>
      <assign name="pu_selected_number" expr="pickupAddress_input" />
      <if cond = "pickupAddress_input == 1">
        <assign name="client_pu_address" expr="puAddress1" />
      <elseif cond = "pickupAddress_input == 2"/>
        <assign name="client_pu_address" expr="puAddress2" />
      <elseif cond = "pickupAddress_input == 3"/>
        <assign name="client_pu_address" expr="puAddress3" />
      </if>
      <goto next="#enter_do_block"/>
    </filled>
  </field>
</form>

<form id="enter_do_block">
  <field name="do_block_input" type="digits?length=2">
    <prompt>
      Please enter first two digits of DO address and press #.
    </prompt>
    <filled>
      <assign name="client_do_block" expr="do_block_input" />
      <goto next="#pullUpDropOffAddress"/>
    </filled>
  </field>
</form>

<catch event="nomatch noinput" count="1">
  Try Again.
  <reprompt/>
</catch>
<catch event="nomatch noinput" count="2">
  Try Again.
  <reprompt/>
</catch>
<catch event="nomatch noinput" count="3">
  Try Again.
  <reprompt/>
</catch>
<catch event="nomatch noinput" count="4">
  <goto next="#transferCSR"/>
</catch>
The counters for each event are form-level; please check the <catch> block documentation for details.

Regards,
Plum Support

bhairav
Posts: 9
Joined: Tue Mar 12, 2013 1:11 pm

Re: Repetitive catch blocks

Post by bhairav »

Thank you

Post Reply