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

Test the key-pound is present

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
soso
Posts: 62
Joined: Tue Apr 22, 2008 8:11 am

Test the key-pound is present

Post by soso »

Hi,

I use this properties:

Code: Select all

    <property name="termchar"          value="" />
    <property name="interdigittimeout" value="1s" />
        
On the filled section, I would like to test is the field contains the key-pound.

I try to use the one key like this:

<field name="input">
<filled>

<if cond="input$.utterance=='#'">
...
</if>
</filled>

I would like to know how to execute a condition if a # key is the input field?

For example, I would like to test :

555

and

555#

Thansk by advance.

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

IVR code to execute condition if a # key is in input field

Post by support »

Hi,

You can use the following IVR code example to help you accomplish this. Note the <if> conditional below:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<form>
  <field name="input">
    <grammar root="ROOT" type="application/srgs+xml" mode="dtmf">
      <rule id="ROOT" scope="public">
        <one-of>
            <item repeat="0-255">
              <ruleref uri="#digit"/>
            </item>
          <item> "* #" </item>
          <item> "#" </item>
        </one-of>
      </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>
          <item> "*" </item>
          <item> "#" </item>
        </one-of>
      </rule>
    </grammar>

    <prompt>
      Please enter some digits.
    </prompt>
    <filled>
      <if cond="input.indexOf('#') != -1">
        <prompt>
          You entered <value expr="input"/>. The field you entered contained a pound key.
        </prompt>
      <else/>
        <prompt>
          You entered <value expr="input"/>. The field you entered did not contain a pound key.
        </prompt>
      </if> 
    </filled>
  </field>
</form>
</vxml>
Hope this helps.

Regards,
Plum Support
Last edited by support on Tue Jan 12, 2010 9:43 am, edited 2 times in total.

soso
Posts: 62
Joined: Tue Apr 22, 2008 8:11 am

Post by soso »

That's working perfectly !

Thanks.

Post Reply