Call file generated from a PHP file


$destination = $_SERVER['QUERY_STRING'];

// locations
$tmp = "/var/spool/asterisk/tmp/";
$outgoing = "/var/spool/asterisk/outgoing/";

// .call Template
$callFile = file_get_contents($tmp.'');

// String Replace
$callFile = str_replace("##DESTINATION##","$destination",$callFile);

$tmpFile = uniqid().".call";
$fh = fopen($tmp.$tmpFile, 'w');
fwrite($fh, $callFile);

rename($tmp.$tmpFile, $outgoing.$tmpFile);

//echo "<script language='javascript'><!--setTimeout("window.history.go(-1)",5000);//--> </script>";
echo "Complete!";

This PHP file is smashing. It edits a pre-existing call file with a variable passed in the URL then moves it into the spool folder for immediate dialling. I am trying unsuccessfully to add some JavaScript to the resulting output so that once it has done its magic, the user who clicks the link is returned to the page they were viewing. I am so far unsuccessful in this attempt, despite trying various different ways of embedding the JavaScript. I’m sure it’s something really simple I’m doing wrong. If anyone has a moment to point me in the right direction I’d be hugely grateful.

Thank you

You can also initiate outbound calls immediately using AMI without generating a call file as is done in this script:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.