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

Grammar valid inputs depends on the size of the array

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

Grammar valid inputs depends on the size of the array

Post by bhairav »

How to define Grammar tag valid inputs based on the size of the array.
Below is the code, where by I wasn't sure to define the (1 | 2 | 3...), so i made it till 9, actually the valid inputs are based on the size of the array. How do i define this.

Another issue I have in this code is, throw nomatch event doesnt reprompt.

Please advise.

<?xml version="1.0"?>
<vxml version="2.0">
<var name="iMaxTries" expr="3"/> <!-- max allowed prompt tries -->
<form id = "validPickupAddresses">
<var name="iTries" expr="0"/>
<block>
<assign name = "addresscount" expr = "1"/>
</block>
<field name="pickupAddress_input">
<grammar type="application/x-jsgf" mode="dtmf">
( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
</grammar>
<prompt>
<foreach item="address" array="pickupAddresses">
Press <value expr="addresscount++"/> for <say-as type="address"><value expr="address"/></say-as>
<break time="1s"/>
</foreach>
</prompt>
<filled>
<if cond = "pickupAddress_input > pickupAddresses.length">
<throw event="nomatch"/>
<else/>
<assign name="pu_selected_number" expr="pickupAddress_input" />
<goto next="#enter_do_block"/>
</if>
</filled>
</field>
</form>

<catch event="nomatch">
<assign name="iTries" expr="iTries+1"/>
<if cond="iMaxTries == iTries">
<goto next="#transferCSR"/>
<else/>
Invalid input, Try Again.
<assign name="iTries" expr="0"/>
<reprompt/>
</if>
</catch>
</vxml>

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

Re: Grammar valid inputs depends on the size of the array

Post by support »

Hi,

Please see this post about how to build the grammar you're looking for.

We also noticed that you declared the iTries variable within the form "validPickupAddresses". This variable is only accessible within that form. You cannot access it within the catch block. If you move it to the same location as the iMaxTries variable you can access it within the catch block.

Regards,
Plum Support

Post Reply