Page 1 of 1

Test the key-pound is present

Posted: Fri Dec 19, 2008 6:37 am
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.

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

Posted: Fri Dec 19, 2008 11:33 am
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

Posted: Fri Dec 19, 2008 11:42 am
by soso
That's working perfectly !

Thanks.