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

Considering the pound key with the user input

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
amitkhosla
Posts: 53
Joined: Sun Feb 15, 2009 11:42 pm
Contact:

Considering the pound key with the user input

Post by amitkhosla »

I have a requirement where i want the user to enter the time in minutes followed by pound key.

i have done it this way, but that does not consider the pound key.

<form id="informDelay">
<block>
<assign name="status" expr="'delay'"/>
</block>
<field name="delayedByMins" type="digits">
<prompt>
How many minutes are you delayed in getting to <value expr="organizationName"/>?
Enter number of minutes.
For example, if you are 15 minutes delayed enter 15 followed by the pound sign.
</prompt>
<filled>
You entered <value expr="delayedByMins"/> minutes.
<submit namelist="appointmentId status delayedByMins phoneNumber" next="<s:url action='appointmentUpdate'/>"/>
</filled>
</field>
</form>

Please suggest how to implement it.

Regards,
Amit

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

IVR code with use of pound after data's entered

Post by support »

Hi,

Here is a past example of IVR code that might help you. Please note how the pound key is implemented in the IVR <grammar> below:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="delaymins1"/>
<var name="delaymins2"/>

<form id="informDelay">
<field name="delayedByMins" type="digits">
<grammar root="ROOT" type="application/srgs+xml" mode="dtmf">
    <rule id="ROOT" scope="public">
            <item repeat="0-255">
                <ruleref uri="#digit"/>
            </item>
            <item> "#" </item>
    </rule>

    <rule id="digit" scope="public">
        <one-of>
            <item> 0 </item>
            <item> 1 </item>
            <item> 2 </item>
            <item> 3 </item>
            <item> 4 </item>
            <item> 5 </item>
            <item> 6 </item>
            <item> 7 </item>
            <item> 8 </item>
            <item> 9 </item>
        </one-of>
    </rule>
</grammar> 

<prompt>
How many minutes are you delayed in getting to your location?
Enter number of minutes.
For example, if you are 15 minutes delayed enter 15 followed by the pound sign.
</prompt>
<filled>
<if cond="input.indexOf('#') != -1"> 
<assign name="delaymins1" expr="delayedByMins.toString().replace(/#/,'')"/>
<assign name="delaymins2" expr="delaymins1.toString().replace(/ /g,'')"/>
You entered <value expr="delaymins2"/> minutes.
<else/>
<goto next="#informDelay"/>
</if> 
</filled>
</field>
</form> 
</vxml>
Regards,
Plum Support
Last edited by support on Tue Feb 16, 2010 2:06 pm, edited 5 times in total.

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

IVR code for using pound key after data is entered

Post by support »

Hi,

Sorry, but please disregard the previous IVR example. It doesn't need the <if> conditional in it.

This IVR code should work the way you want:

inputpound.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="delaymins1"/>
<var name="delaymins2"/>

<form id="informDelay">
<field name="delayedByMins">
<grammar root="ROOT" type="application/srgs+xml" mode="dtmf">
    <rule id="ROOT" scope="public">
            <item repeat="0-255">
                <ruleref uri="#digit"/>
            </item>
            <item> "#" </item>
    </rule>

    <rule id="digit" scope="public">
        <one-of>
            <item> 0 </item>
            <item> 1 </item>
            <item> 2 </item>
            <item> 3 </item>
            <item> 4 </item>
            <item> 5 </item>
            <item> 6 </item>
            <item> 7 </item>
            <item> 8 </item>
            <item> 9 </item>
        </one-of>
    </rule>
</grammar> 

<prompt>
How many minutes are you delayed in getting to your location?
Enter number of minutes.
For example, if you are 15 minutes delayed enter 15 followed by the pound sign.
</prompt>
<filled>
<assign name="delaymins1" expr="delayedByMins.toString().replace(/#/,'')"/>
<assign name="delaymins2" expr="delaymins1.toString().replace(/ /g,'')"/>
You entered <value expr="delaymins2"/> minutes.
</filled>
</field>
</form> 
</vxml>
Hope this helps.

Regards,
Plum Support

Post Reply