Hi,
To implement what you're looking for, you would need to create two remote IVR
grammars in your IVR code. The following IVR example demonstrates how you can do this:
dynamic.php
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form id="main">
<field name="phone" cond="enter==true">
<grammar src="builtin:dtmf/digits?minlength=1;maxlength=255" />
<filled>
</filled>
</field>
<field name="card">
<grammar srcexpr="phone=='true' ? 'creditcardstar.grxml' : 'creditcard.grxml'" type="application/srgs+xml" maxage="0"/>
<prompt>
Please enter your card number.
</prompt>
<filled>
<prompt>
You have entered <value expr="card"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
creditcardstar.grxml:
Code: Select all
<?xml version="1.0"?>
<grammar type="application/srgs+xml" root="ROOT" version="1.0" 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>
creditcard.grxml:
Code: Select all
<?xml version="1.0"?>
<grammar type="application/srgs+xml" root="ROOT" version="1.0" 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>
</one-of>
</rule>
</grammar>
From this IVR example, if you look in the "card" field, you'll see that the IVR grammar is set up in this way:
Code: Select all
<grammar srcexpr="phone=='true' ? 'creditcardstar.grxml' : 'creditcard.grxml'" type="application/srgs+xml" maxage="0"/>
This means that if "phone" was set to true (or whatever special implementation you are using for phone), it will use creditcardstar.grxml (the grammar that allows the user to enter the star pound key) as the grammar and if "phone" is not true, it will use creditcard.grxml (the grammar that doesn't allow the user to enter the star pound key).
Regards,
Plum Support