Hi,
How can I log if the transfer was successful. I thought of checking with mycall$.duration>0, but if the caller hangs up after the connection to callee then connection.disconnect.hangup event is thrown and $.duration variable is not set. I am able to log other things like if the transfer returned busy, noanswer, but not sure how to log if there was a successful transfer.
Thanks
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Log transfer
IVR code to help track <transfer>s
Hi,
You can use the following IVR code to log what's happening for your <transfer>:
transfercellphone.php:
ending_time.php
From this IVR code, the <transfer> is attempted and the <if> conditionals check to see if there was a "busy" or "noanswer". If not, then the IVR call is logged as a successful transfer when the callee hangs up.
If the caller hangs up, we need to visit the ending_time.php document via a <subdialog>. This needs to be done to get the ending time stamp of the IVR call. Once you have the start and ending times for the IVR call you can determine what the call duration was even if the caller hangs up.
Hope this helps.
Regards,
Plum Support
You can use the following IVR code to log what's happening for your <transfer>:
transfercellphone.php:
Code: Select all
<?php
echo "<?xml version=\"1.0\"?>\n";
>?
<vxml version="2.0">
<form>
<var name="mydur"/>
<var name="start"/>
<? $start_timestamp = time(); ?>
<block>
<assign name="start" expr="<?= $start_timestamp ?>"/>
</block>
<transfer name="mycall" dest="tel:+1617XXXXXXX" bridge="true">
<filled>
<assign name="mydur" expr="mycall$.duration"/>
<if cond="mycall == 'busy'">
<log label="mylog">Log Transfer Call was busy</log>
<prompt>
Daniel's line is busy.
</prompt>
<elseif cond="mycall == 'noanswer'"/>
<log label="mylog">Log Transfer Call was no answer</log>
<prompt>
Daniel can't answer the phone now.
</prompt>
<else/>
<log label="mylog">Log Transfer Call was successful (voicemail/humanpickup)</log>
<throw event="connection.disconnect.hangup"/>
</if>
</filled>
</transfer>
<catch event="connection.disconnect.hangup">
<goto nextitem="duration"/>
</catch>
<subdialog name="duration" src="ending_time.php" namelist="start">
<filled>
<log> Transfer duration: <value expr="duration.retVal"/></log>
</filled>
</subdialog>
</form>
</vxml>
Code: Select all
<?php
echo "<?xml version=\"1.0\"?>\n";
$start_timestamp = $GET['start'];
$end_timestamp = time();
$transfer_duration = $end_timestamp - $start_timestamp;
?>
<vxml version="2.0">
<form>
<block>
<var name="retVal" expr="<?= $transfer_duration ?>"/>
<return namelist="retVal"/>
</block>
</form>
</vxml>
If the caller hangs up, we need to visit the ending_time.php document via a <subdialog>. This needs to be done to get the ending time stamp of the IVR call. Once you have the start and ending times for the IVR call you can determine what the call duration was even if the caller hangs up.
Hope this helps.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com