Upgrade 3CX to v18 and get it hosted free!

Cisco 79XX XML Push

Author image

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:
<?php

    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: [email protected], 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”; }
else
{
fputs($fp, $post.$xml);
flush();
while (!feof($fp))
{
$response .= fgets($fp, 128);
flush();
}
}

return $response;
}

$ip = “your.CISCO.phone.here”;
$uri = “http://your.web.server.here/hello_world.php”;
$uid = “test”;
$pwd = “test”;
echo push2phone($ip, $uri, $uid, $pwd);
?>



Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.