Cisco 79XX XML Push

NB This has been tested with the SCCP image and also works with the SIP image SIP70.8-5-2S on 7970s.

If you want to Push an XML Object to a Cisco IP Phone, it first tries to authenticate your request against a Call Manager. If you don't have a Call Manager (e.g. you're using Asterisk), then you can use "<authenticationURL></authenticationURL>" in the SEP<MAC>.cnf.xml. The phone can then be directed to any web server which handles the authentication.

Data transferred:
1) The Push is done by posting a "CiscoIPPhoneExecute" with the URL of the Object you want to be loaded. The POSTing has to be directed to the phone at the URL "/CGI/Execute" and must use HTTP Basic Authentication.
2) The phone POSTs 'UserID', 'Password' and 'devicename'
3) The server answers 'ERROR', 'UN-AUTHORIZED' or 'AUTHORIZED' (ensure no headers sent and no extra characters. The phone will respond with a 'CiscoIPPhoneError Number="4"' if it receives anything extra.)

Now it's up to you, what your script answers according to UserID andPassword.
A simple authentication script, always allowing access, would be:
php echo "AUTHORIZED";
(NB This doesn't check UserID and Password) Also make sure that there are no extra characters, such as spaces, outside the <?php....?>.

An example to send an Execute Object to the phone, containing the URL you want to be pulled:
    1. This is an example of CiscoIPPhoneExecute as seen in the SDK
    2. Usage: Simply include in your php program and call the funtion
  1. using the parameters:
  2. $ip = IP of phone we're pushing to
  3. $uri = the URL or URI we want the phoneto execute
  4. $uid = the user id to authenticateagainst to the phone
  5. $pwd = the password to authenticate
      1. Author:, Oct. 2003
function push2phone($ip, $uri, $uid, $pwd)
$auth = base64_encode($uid.":".$pwd);
$xml = "<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\"URL=\"".$uri."\"/></CiscoIPPhoneExecute>";
$xml = "XML=".urlencode($xml);

$post = "POST /CGI/Execute HTTP/1.0\r\n";
$post .= "Host: $ip\r\n";
$post .= "Authorization: Basic $auth\r\n";
$post .= "Connection: close\r\n";
$post .= "Content-Type: application/x-www-form-urlencoded\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";

$fp = fsockopen ( $ip, 80, $errno, $errstr, 30);
if(!$fp){ echo "$errstr ($errno)<br>\n"; }
fputs($fp, $post.$xml);
while (!feof($fp))
$response .= fgets($fp, 128);

return $response;

$ip = "";
$uri = "";
$uid = "test";
$pwd = "test";
echo push2phone($ip, $uri, $uid, $pwd);

Created by: flavour, Last modification: Fri 06 of Nov, 2009 (21:18) by cmaj
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+