Page 1 of 1

How to use variable to transfer call

Posted: Tue Jun 03, 2008 8:38 am
by jporrello
I am trying to transfer a call to a pager after calling a subdialog to get a pager number. I can get it to say the number but I can not set the dest= to the variable passed.

Scratchpad program:
<?xml version="1.0"?>
<vxml version="2.0">

<form id="intro">
<block>
<prompt bargein="false">
<audio src="wavfiles/humanvoice.wav">
Hello! Welcome to My program On-Call System!
</audio>
</prompt>
</block>
<field name="option" type="digits?minlength=1;maxlength=1">
<prompt>
Please Enter One for location1, Two for location2
</prompt>
</field>
<subdialog name="random" src="http://myserver.com/pager.php"/>
<block>
The pager number is <value expr="random.pager"/>.
</block>
<!-- transfer to Pager -->
<transfer dest=random.pager connecttimeout="20s" bridge="true"/>
</form>
</vxml>





This is the php file on the server:
<?php
header("Content-type: text/xml");

$pager1 = "12055555555";
?>

<vxml version="2.0">
<form>
<block>
<var name="pager" expr="'<?php echo($pager1)?>'"/>
<return namelist="pager"/>
</block>
</form>
</vxml>


Thanks,

Change in IVR code allows call transfers

Posted: Tue Jun 03, 2008 9:04 am
by support
Hi,

The reason why you cannot use the dest attribute of the IVR tag, <transfer>, is because you are trying to pass an ECMAScript expression to it (random.pager). Instead, you should use the destexpr attribute of the <transfer> tag. I would recommend changing this line of IVR code:

Code: Select all

<transfer dest=random.pager connecttimeout="20s" bridge="true"/> 
to this:

Code: Select all

<transfer destexpr="random.pager" connecttimeout="20s" bridge="true"/>
We have tested this IVR code with this one change and confirmed it to work. Hope this helps.

Regards,
Plum Support