I'm trying to run an xml script that gets executed when pushing on a progkey. This script simply dials a string of digits. Right now it works and can dial over line1, but I need to have it dial on line 4 which is programmed on prgkey7. Here my script Any ideas?
<?php
#
function push2phone($server,$phone,$data)
{
$xml = "xml=".$data;
$post= "POST / HTTP/1.1rn";
$post.= "Host: $phonern";
$post.= "Referer: $serverrn";
$post.= "Connection: Keep-Alivern";
$post.= "Content-Type: text/xmlrn";
$post .= "Content-Length: ".strlen($xml)."rnrn";
$fp = @fsockopen ( $phone, 80, $errno, $errstr, 5);
if($fp)
{
fputs($fp, $post.$xml);
flush();
fclose($fp);
}
}
##############################
#############################################################################
# Usage:
# http://192.168.10.50/freepbx/xml/asterisk/xml_login.php?logincode=90000&ip=$$LOCALIP$$&linekey=PrgKey7
#############################################################################
# PHP customization for includes and warnings
#############################################################################
$os = strtolower(PHP_OS);
if(strpos($os, "win") === false) ini_set('include_path',ini_get('include_path').':include:../include');
else ini_set('include_path',ini_get('include_path').';include;..include');
error_reporting(E_ERROR | E_PARSE);
#############################################################################
# Includes
#############################################################################
require_once('AastraCommon.php');
require_once('AastraAsterisk.php');
require_once('AastraIPPhoneTextScreen.class.php');
require_once('AastraIPPhoneTextMenu.class.php');
require_once('AastraIPPhoneInputScreen.class.php');
require_once('AastraIPPhoneExecute.class.php');
require_once('AastraIPPhoneStatus.class.php');
#############################################################################
# Body
#############################################################################
# Retrieve parameters
$logincode=Aastra_getvar_safe('logincode');
$logincode_array = str_split($logincode);
$ip=Aastra_getvar_safe('ip');
$LineKey=Aastra_getvar_safe('linekey');
#Aastra_trace_call('cfwd_asterisk','logincode='.$logincode.', ip='.$ip.', LineKey='.$LineKey);
$xml="<AastraIPPhoneExecute triggerDestroyOnExit=\"yes\">";
foreach ($logincode_array as $value)
{
#Aastra_trace_call('cfwd_asterisk','value='.$value);
$xml.="<ExecuteItem URI=\"Key:KeyPad".$value."\"/>";
}
#$xml.="<ExecuteItem URI=\"Key: NavRight\"/>";
$xml.="<ExecuteItem URI=\"Key: PrgKey7\"/>";
$xml.="</AastraIPPhoneExecute>";
push2phone("192.168.10.50",$ip,$xml);
?>

Member Since:
2007-06-07