Hi,
Here is an example of IVR code that should help you achieve this.
yourapplicationscript.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0" application="yourrootdocument.php">
<form>
<field name="myfield">
<!-- Multiple grammars can be specified either by including -->
<!-- several grammar blocks within the field item or by -->
<!-- specifying a built-in grammar with the "field" tag's -->
<!-- "type" attribute. -->
<grammar type="application/x-jsgf" mode="dtmf">
( 1 | 2 )+
</grammar>
<grammar type="application/x-jsgf" mode="voice">
( one | two )+
</grammar>
<prompt>
Say or enter any number of the digits one or two.
</prompt>
<filled>
You entered <value expr="myfield"/>.
</filled>
<nomatch>
You did not say or enter any ones or twos.
<reprompt/>
</nomatch>
<noinput>
You did not enter anything.
<reprompt/>
</noinput>
</field>
</form>
</vxml>
yourrootdocument.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<link next="transfercall.php" dtmf="0"/>
</vxml>
transfercall.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<transfer dest="tel:+1xxxxxxxxxx">
<prompt>
Transferring your call.
</prompt>
</transfer>
</form>
</vxml>
From this IVR example, a user calls into yourapplicationscript.php and hears a prompt. If a user presses 0 on their phone keypad, they would hear the message, "Transferring your call." and then be transferred to the transfer phone number.
This is possible because yourapplicationscript.php refers to our root document, yourrootdocument.php. In that root document, we have set up a
<link> that goes to transfercall.php if the user presses 0 on their phone keypad.
However, please note that if a user enters a
<field> in your own IVR script that allows them to enter 0 (for example, if you're collecting digits), they will not be allowed to enter 0 to transfer them (since your IVR field grammar overrides what was set up in your root document). If that is the case, we recommend that you use a different DTMF key such as "*" or "#" for the user to press if they wish to be transferred.
Hope this helps.
Regards,
Plum Support