The Cisco 79XX Phones include a mini-browser that allows the phone to interact with specially designed web services. These services can be developed as a CGI script on an HTTP server which outputs content using the XML syntax presented in this document.
A phone operator presses the “Services” button to access a menu of available services. Using the numeric keypad or the up/down button, a service is selected. The phone will then contact Apache to download an XML document which can contain the description of an object. These objects can be one of six different types.
This document will show you how to use PHP and Apache, all open source tools, to provide these services to your phones.
NB Currently, this document covers version 3.0 of CMXML. Current SIP firmware (6.1) for Cisco Phones will only work with the syntax below. CMXML 3.1 to 4.0 is supported only by SCCP phones.
XML Push is only supported with the SCCP image. To achieve a dynamic page with the SIP image you can use the HTTP header refresh directive.
XML applications written for Cisco 79XX IP Phones can be delivered to other types of IP Phones and IP Endpoints using a middleware technology from Millenigence called DashPhone CXP.
These services can also be delivered directly to the iPhone using a free simulator called MyServices.
Cisco Documentation
Perhaps a good place to start is the Cisco documentation: Cisco IP Phone Services Application Development Notes (Cisco IP Phone XML Objects). This is a call manager document which also pertains to SIP.
XML Objects Types
When service applications send XML displays to the Cisco phone, they must ensure that Apache outputs the content with a MIME text/xml type, which can be accomplished with the PHP header() function.
The code sample below will send the necessary headers using PHP.
<?
header("Content-type: text/xml");
header("Connection: close");
header("Expires: -1");
?>
CiscoIPPhoneDirectory
This object is the same as the one used by the phone when you press the “Directory” button. Using this object will allow you to present a dialing directory of up to 32 entries.
Syntax
<CiscoIPPhoneDirectory>
<Title>Name Of Directory</Title>
<Prompt>Prompt text.</Prompt>
<DirectoryEntry>
<Name>Name of Person or Company</Name>
<Telephone>TelephoneNumber</Telephone>
</DirectoryEntry>
<DirectoryEntry>
<Name>Name of Person or Company</Name>
<Telephone>TelephoneNumber</Telephone>
</DirectoryEntry>
</CiscoIPPhoneDirectory>
Example PHP Source Code
<?
header("Content-type: text/xml");
header("Connection: close");
header("Expires: -1");
$mysql_conn = mysql_connect("localhost", "asteriskuser", "");
mysql_select_db("directory", $mysql_conn);
$result = mysql_query("SELECT name,tel FROM lunchdir", $mysql_conn);
print("<CiscoIPPhoneDirectory>\n");
print("\t<Title>Lunch Time Essentials</Title>\n");
print("\t<Prompt>Who will deliver food today?</Prompt>\n");
while($row = mysql_fetch_row($result))
{
print("\t<DirectoryEntry>\n");
print("\t\t<Name>");
print($row[0]);
print("</Name>\n");
print("\t\t<Telephone>");
print($row[1]);
print("</Telephone>\n");
print("\t</DirectoryEntry>\n");
}
print("</CiscoIPPhoneDirectory>\n");
?>
vCard to Cisco IP Phone CMXML Directory Script for PHP
Other open-source integration scripts are available to retrieve directory content from relational databases or LDAP servers. These are great methods, but some of us don’t want the hassle of running yet another directory server or database since all the contacts we want are stored in our local address book and not in a web-connected database or LDAP server.
This script (https://vostrom.com/vcardcmxml/) from VOSTROM gives you the ability to search your vCard file by name or browse through your vCard file name-by-name using your 79XX IP Phone’s External Directory feature. You can simply tap Dial to call any entry. But unlike many other scripts, this supports paging (Next page, …) to get around the phone’s silly limitation on number of entries per page (32), reformats phone numbers automatically to work with the IP Phone, and even labels entries with Work, Mobile, Home, or Main for contacts with multiple phone numbers. Easy to integrate (no database or LDAP server required), and also easy to use as a basis for adding your own SQL queries or LDAP queries if you have names stored there–See the addEntry() function. View the PHP source code here: https://vostrom.com/vcardcmxml/vcdir.phps. There is some documentation here (https://vostrom.com/vcardcmxml/) including a 3-step, 5-minute setup process.
CiscoIPPhoneGraphicMenu
Syntax
<CiscoIPPhoneGraphicMenu>
<Title>Title of Graphic Menu</Title>
<LocationX>Position - X Coordinate</LocationX>
<LocationY>Position - Y Coordinate</LocationY>
<Width>Width of Image</Width>
<Height>Height of image</Height>
<Depth>Pixel Depth of image</Depth>
<Data>Image Data (Hex)</Data>
<Prompt>Prompt text.</Prompt>
<MenuItem>
<Name>Name of Menu Item.</Name>
<URL>http://url.of.site.com/services/command.php</URL>
</MenuItem>
<MenuItem>
<Name>Name of Menu Item.</Name>
<URL>http://url.of.site.com/services/command.php</URL>
</MenuItem>
</CiscoIPPhoneGraphicMenu>
CiscoIPPhoneImage
Syntax
<CiscoIPPhoneImage>
<Title>Title of Image</Title>
<LocationX>Position - X Coordinate</LocationX>
<LocationY>Position - Y Coordinate</LocationY>
<Width>Width of Image</Width>
<Height>Height of image</Height>
<Depth>Pixel Depth of image</Depth>
<Data>Image Data (Hex)</Data>
<Prompt>Prompt text.</Prompt>
</CiscoIPPhoneImage>
CiscoIPPhoneInput
Syntax
<CiscoIPPhoneInput>
<Title>Title</Title>
<Prompt>Prompt text.</Prompt>
<URL>http://url.of.site.com/services/command.php</URL>
<InputItem>
<DisplayName>Name of field.</DisplayName>
<QueryStringParam>TelephoneNumber</QueryStringParam>
<InputFlags></InputFlags>
<DefaultValue>Value</DefaultValue>
</InputItem>
</CiscoIPPhoneInput>
CiscoIPPhoneMenu
Syntax
<CiscoIPPhoneMenu>
<Title>Title of Menu</Title>
<Prompt>Prompt text.</Prompt>
<MenuItem>
<Name>Name of Menu Item.</Name>
<URL>http://url.of.site.com/services/command.php</URL>
</MenuItem>
<MenuItem>
<Name>Name of Menu Item.</Name>
<URL>http://url.of.site.com/services/command.php</URL>
</MenuItem>
</CiscoIPPhoneMenu>
CiscoIPPhoneText
Syntax
<CiscoIPPhoneText>
<Title>Title Here.</Title>
<Text>Text message to display.</Text>
<Prompt>Prompt text.</Prompt>
</CiscoIPPhoneText>
Working Examples
A working example of some XML Services can be found at the following addresses:
- Open 79XX XML Directory: Open79XXDir – Open PHP/MySQL XML Services content management system for Cisco 79XX XML Phones.
- Australian Cisco Services: http://cisco.internect.net – Live feeds of Australian News, Weather and Share Prices, for Cisco IP Phone users in Australia.
- Github: http://github.com/flebel/cisco79xx_phone_directory – Script to display Google Contacts on the phone’s external directory.
- Linux Lighting Group: https://llg.cubic.org/tools/cisco.html – Links to 5 XML services (some german). The site also provides an enhanced version of the rss2cisco script from dontpokebadgers.
- CiscoXMLServices: http://www.ciscoxmlservices.com/site/ – Directory, FeedRSS, Fortune, Flickr images, Zimbra integration and other utilities…
cmd.php :
<?php
$cmd = $_GET["cmd"];
exec("mpc $cmd", $ret);
header("Content-type: text/xml");
header("Connection: close");
header("Expires: -1");
if ($cmd != "status")
header("Location: http://host.tld/cisco/mpd/cmd.php?cmd=status");
else
header("Refresh: 2");
if ($cmd == "status")
{
echo "<CiscoIPPhoneText>\n";
echo "<Title>MPD</Title>\n";
echo "<Text>";
foreach ($ret as $r)
echo "$r\n";
echo "</Text>\n";
echo "</CiscoIPPhoneText>\n";
}
?>
Asterisk Directory
Use this PHP script to generate an Asterisk sip.conf, skinny.conf, and iax.conf based directory.
NOTE: Only entries which use the ‘name’ key are considered. Previously used ‘callerid’, but ran into problems parsing callerid if the extension was included. For each user you want added to the directory add ‘name=User’ to their respective profile. Change the $location and $dirname variables depending on your configuration.
- Verified to work with P0S3-07-5-00
- Verified to work with P0S3-08-2-00 3-9-06 –ctwohig
P0S3-08-2-00 is listed on Cisco’s site but not with the rest of the SIP images, on the voice downloads page follow the link for Cisco IP Phone FW 7900 Series.