Files
aastra-xml-php/asterisk sample source/register.php
2018-02-15 22:59:05 +01:00

38 lines
1.2 KiB
PHP

<?
#############################################################################
# Asterisk Register - Update DND and CFWD status
#
# Aastra SIP Phones 2.1.0 or better
#
# Copyright 2006 Aastra Telecom Ltd
#
# script.php?user=XXX&dndkey=YYY&cfkey=ZZZ
# XXX is the extension of the phone on the platform
# YYY is the number of the dynamic dnd key
# ZZZ is the number of the dynamic cfwd key
#
#############################################################################
#####################################################################
# Global parameters
$Server = "http://".$_SERVER['SERVER_ADDR'].$_SERVER['SCRIPT_NAME'];
$Server = substr($Server,0,(strlen($Server)-strlen(strrchr($Server, "/"))+1));
# Retrieve parameters
$user=$_GET['user'];
$dndkey=$_GET['dndkey'];
$cfkey=$_GET['cfkey'];
# Update DND and CFWD
$output = "<AastraIPPhoneExecute>\n";
$output .= "<ExecuteItem URI=\"".$Server."dnd.php?action=check&amp;user=".$user."&amp;key=".$dndkey."\"/>\n";
$output .= "<ExecuteItem URI=\"".$Server."cfwd.php?action=check&amp;user=".$user."&amp;key=".$cfkey."\"/>\n";
$output .= "</AastraIPPhoneExecute>\n";
# Return object
header("Content-Type: text/xml");
header("Content-Length: ".strlen($output));
echo $output;
exit;
?>