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 can I do submit then a transfer?
-
- Posts: 12
- Joined: Thu Feb 14, 2013 12:06 pm
How can I do submit then a transfer?
I have a menu choice then proceed to a goto where I want to do a submit to a page then a transfer of the call. The transfer happens but nothing is posted back.
Re: How can I do submit then a transfer?
Hi,
Just to clarify, are you looking to do another <submit> to do a post to a script after your transfer has completed?
Below is some sample code that demonstrates how to do a submit to a transfer page and then posting to a script after a transfer has completed:
enterchoice.php:
transferpage.php:
storeinformation.php:
From this example code, we start with enterchoice.php. In that script, we get the user's ANI and store it in "userani". The user enters 1 and we do a submit to transferpage.php, passing it the variable, "userani". Within transferpage.php, we create two variables, "user_phone_num" and "sales_phone_num". Note that "user_phone_num" is set to what was stored in "userani". From there, a transfer occurs and after the transfer completes, we do a submit to storeinformation.php, passing it the variables, "user_phone_num" and "sales_phone_num".
Hope this helps.
Regards,
Plum Support
Just to clarify, are you looking to do another <submit> to do a post to a script after your transfer has completed?
Below is some sample code that demonstrates how to do a submit to a transfer page and then posting to a script after a transfer has completed:
enterchoice.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="userani" expr="session.telephone.ani"/>
<menu id="departments">
<prompt>
Press 1 or say sales to be transfered to Sales.
</prompt>
<choice dtmf="1" next="#sales">sales</choice>
</menu>
<form id="sales">
<block>
<submit next="transferpage.php" method="post" namelist="userani"/>
</block>
</form>
</vxml>
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
$userani = $_POST[userani];
?>
<vxml version="2.0">
<var name="user_phone_num" expr="'<?php echo($userani)?>'"/>
<var name="sales_phone_num" expr="2345678901"/>
<form>
<block>
<prompt>
You are being transferred.
</prompt>
<assign name="dest_expr" expr="'tel:+1' + sales_phone_num + ';ani=' + user_phone_num"/>
<goto next="#transfer"/>
</block>
</form>
<form id="transfer">
<transfer name="my_transfer" destexpr="dest_expr">
<filled>
<if cond="my_transfer == 'near_end_disconnect'">
<throw event="nearend"/>
</if>
<if cond="my_transfer == 'maxtime_disconnect'">
<throw event="maxtime"/>
</if>
<if cond="my_transfer == 'network_disconnect'">
<throw event="network"/>
</if>
<if cond="my_transfer == 'far_end_disconnect'">
<throw event="farend"/>
</if>
</filled>
</transfer>
<catch event="connection.disconnect.hangup nearend maxtime network farend">
<submit next="storeinformation.php" namelist="user_phone_num sales_phone_num" method="post" enctype="multipart/form-data"/>
</catch>
</form>
</vxml>
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
$File = "storeresults.txt";
$Handle = fopen($File, 'a+');
$Date = date("r");
$UserNum = $_POST[user_phone_num];
$SalesNum = $_POST[sales_phone_num];
$Data = "$Date $UserNum $SalesNum\n";
fwrite($Handle, $Data);
fclose($Handle);
?>
<vxml version="2.0">
<form>
<block>
<exit/>
</block>
</form>
</vxml>
Hope this helps.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com