XML dial using line 4 on a 33i

prival
Posts: 6
Member Since:
2007-06-07

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 $phone80$errno$errstr5);
  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") === falseini_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);


?>


prival
Posts: 6
Member Since:
2007-06-07
Can not get the code to

Can not get the code to render correctly, so here it is in pastebin:

http://pastebin.com/m716ffae0



SkykingOH
Posts: 9541
Member Since:
2007-12-17
I have fixed your original

I have fixed your original post. Take a look at the input options below the text box, you can format PHP code or any monospaced font and make it readable in a forum post.

Good luck with your script.

--

Scott

aka "Skyking"



prival
Posts: 6
Member Since:
2007-06-07
SOLVED: XML dial using line 4 on a 33i

Thanks Scott.

Actually it's solved not, the above script works. Mi phone may have been in an unstable state as I rebooted it and now my script works.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.