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

How to take "*" as user input

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
kapil
Posts: 1
Joined: Fri May 17, 2013 5:30 pm

How to take "*" as user input

Post by kapil »

Hi

How can i take "*" as an user input. All the other inputs were working fine but when i enter "*" or any combination with "*" Ex. "*45" ,"45*4" etc. it says i could not understand.

Can you please help me on this.

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

Re: How to take "*" as user input

Post by support »

Hi kapil,

Below is some sample code that demonstrates how to take '*' as user input:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form id="mainmenu">
<field name="myfield">
<grammar root="ROOT" type="application/srgs+xml" mode="dtmf">
  <rule id="ROOT" scope="public">
    <one-of>
      <item repeat="0-255">
	<ruleref uri="#digit"/>
      </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>
    </one-of>
  </rule>
</grammar>
  <prompt>
    Enter some digits.
  </prompt>
  <filled>
    <if cond="myfield.indexOf('*') != -1">
      <assign name="myfield" expr="myfield.replace('*', 'star')"/>
      <prompt>
        You entered <value expr="myfield"/>.
      </prompt>
    <else/>
      <prompt>
	You entered <value expr="myfield"/>.
      </prompt>
    </if>
  </filled>
</field>
</form>
</vxml>
Hope this helps.

Regards,
Plum Support

Post Reply