Page 1 of 1
Use * key to go back option.
Posted: Fri Apr 29, 2011 5:17 pm
by abhay
Hello,
I want to use * key to go back to previous step in my application. I tried to use it, but when user press * call gets disconnected. Can anyone help me regarding how I can use * key?
Thanks
Abhay
Re: Use * key to go back option.
Posted: Mon May 02, 2011 10:36 am
by support
Hi abhay,
The following IVR code example demonstrates how you can use the * key on your phone keypad to go to a previous <form> within your application:
stargoback.php
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form id="past">
<block>
<prompt>
This is a past prompt.
</prompt>
<goto next="#present"/>
</block>
</form>
<form id="present">
<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>
<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>
</one-of>
</rule>
</grammar>
<prompt>
Enter some digits.
</prompt>
<filled>
<if cond="myfield.indexOf('*') != -1">
<goto next="#past"/>
<else/>
<prompt>
You entered <value expr="myfield"/>.
</prompt>
</if>
</filled>
<nomatch>
You did not enter a correct input.
<reprompt/>
</nomatch>
<noinput>
You did not enter anything.
<reprompt/>
</noinput>
</field>
</form>
</vxml>
From this example, if the user enters * when they are prompted to enter digits, they will be directed back to the "past" <form> and hear the message, "This is a past prompt." again.
Please let us know if you need any further clarification on this.
Regards,
Plum Support