Hack65.Build a Speed-Dial Service on Cisco IP Phones


Hack 65. Build a Speed-Dial Service on Cisco IP Phones

Cisco's 7900 series IP phones have some powerful programmable firmware that you can harness for your own unique purpose, answering the age-old question, "Doesn't this LCD display seem a bit large for just caller ID?"

That expensive Cisco phone on your desk has some great hidden capabilities. Additional tools and toys that lurk beneath the 79xx's gray exterior could increase your productivity and foster some innocent fun. I'm talking about things like automated weather reports on the phone's display, simple menu-driven applications (like a time card, say), and just about anything else you can program using an XML web site.

In fact, you'll probably build so many cool tools and toys that you'll need a way to sort through them, like a directory or a menu. Using the Cisco VoIP phone's XML application capability, you can set up such a directory.

For this hack, you're going to use XML to create your own custom menus that access hidden features of the Cisco phone. To make your menu appear on the phone, you'll need to configure the phone to look for your custom menu file.

Cisco phones, like most IP phones, have a Flash storage device onboard that is checked and optionally updated at every startup. During startup, the phones contact a TFTP server and attempt to download settings stored in files on the server [Hack #80]. By setting the services_url property on the phone's console to the URL of your menu, you can configure the phone to load your custom menu upon its next reboot. To set this property, press the Settings button on the Cisco phone. Then, select Unlock Config and use the keypad to enter the password (the default is cisco). Next, select the XML URL option, followed by the Services URL option. Enter the URL, like the following example, using the phone's keypad (you enter slashes and colons by cycling through the # and * keys):

 http://lathama.com/services/cisco/ 

Now, when the phone boots, it will attempt to load a menu for the Services button by accessing an XML file at the URL. You can also set this URL in a configuration file on the TFTP server. (If you do neither, the Services button will be rather useless, as it doesn't default to any built-in settings.) Edit the SIPDefaults.cnf file on the TFTP server to set the Services URL. Use an entry like this:

 services_url: "http://lathama.com/services/cisco/" 

Leave the ending slash in there. It will tell the web server to grab the default or index file. Testing this with a web browser will be difficult, as the XML has no headers to tell the browser what is going on. Create a file called index.html (default.htm for Windows web servers) on a nearby web server that's accessible at the URL you supplied to the phone, and fill it with XML content like this:

 <CiscoIPPhoneMenu> <Title>My New Menu</Title> <Prompt>Prompt This</Prompt> <MenuItem> <Name>Menu Item</Name> <URL>http://domain/cisco/services/menuitem.xml</URL> </MenuItem> <SoftKeyItem> <Name>Soft Key</Name> <URL>http://domain/cisco/services/softkey.xml</URL> <Postition>1</Posititon> </SoftKeyItem> </CiscoIPPhoneMenu> 

This sample shows you a simple yet slick method of loading a menu. When you press the Settings button on the phone, the menu shows up as simple text bars and allows you to arrow-down or up to the option you choose, using the phone's navigation controls and softkeys. After you make a selection, the listed URL is queried. This convention is the formula behind what Cisco calls services. You can think of services as the little applications (stock tickers, games, etc.) on modern cellular phones. The Cisco phones split the phone directory off as its own service (available through the Directory button rather than the Services button), but that shouldn't stop you from making your own directory with this hack.

The menus are simple to create, but you'll need to become familiar with the strange tags. If you're not familiar with XML, the <CiscoIPPhoneMenu> tag, which is used to enclose Cisco phone menu structures, might seem a little strange to work with. I would have just used <Menu>, but that might not work in newer firmware. Menus contain one or more menu items denoted with the tag <MenuItem>. A softkey type of menu that uses the <SoftKeyItem> tag also is available. Softkey menus use the buttons on the side of some of the phones (the 7960, for example, has six on the right and four at the bottom of the display). Some of the older Cisco phones do not have the extra buttons, so for compatibility with all of Cisco's IP phones, stickto simple menus.

Inside <MenuItem> are easy tags, such as <Name> and <URL>. These are casesensitive on some current firmware versions. <Name> is what shows up as the item's name, and <URL> is what it will request if the user selects the menu option. Notice that the http:// part is in the URL, but FTP URLs will work, too.

Now, on to your first menu. Start the following example and adjust it to suit. Let's say you use the extension of the phone for the title, to allow you and your friends or users to know the extension at any time. Break up the menu into chunks that you can handle:

 <CiscoIPPhoneMenu> <Title>EXT 1234</Title> <MenuItem> <Name>PIM</Name> <URL>http://domain/cisco/services/pim.xml</URL> </MenuItem> <MenuItem> <Name>Work</Name> <URL>http://domain/cisco/services/work.xml</URL> </MenuItem> <MenuItem> <Name>Play</Name> <URL>http://domain/cisco/services/play.xml</URL> </MenuItem> </CiscoIPPhoneMenu> 

So you now have three sections to add things into. Work on PIM first, and add a list of favorite restaurants (hey, you'll want to reward yourself with a pizza when this is through!). Go to the pim.xml file on the web server. Add some local and not-so-local places, and then allow the menu to dial the number for you. To keep my favorite places safe, I'll suggest fictional restaurants and phone numbers. (Actually, if you're in the Detroit area, nothing beats National Coney Island!)

 <CiscoIPPhoneMenu> <Title>EXT 1234 - PIM</Title> <MenuItem> <Name>Restaurants</Name> <URL>http://domain/cisco/services/pim.xml</URL> </MenuItem> </CiscoIPPhoneMenu> <CiscoIPPhoneDirectory> <Title>EXT 1234  PIM - Restaurants</Title> <DirectoryEntry> <Name>Larrys Latkes</Name> <Telephone>18005551212</Telephone> </DirectoryEntry > <DirectoryEntry > <Name>Timbos Nacho World</Name> <Telephone>18665551212</Telephone> </DirectoryEntry > <DirectoryEntry > <Name>Drunken Cow Steak House</Name> <Telephone>18775551212</Telephone> </DirectoryEntry > </CiscoIPPhoneDirectory> 

Look at all that's changed. You are now using the <CiscoIPPhoneDirectory> tag to show the dial and other buttons at the bottom of the screen. You also are now using <DirectoryEntry> rather than <MenuItem>, and <Telephone> rather than <URL>. To complete the hack, edit the work.xml and play.xml files.

Andrew Latham




VoIP Hacks
VoIP Hacks: Tips & Tools for Internet Telephony
ISBN: 0596101333
EAN: 2147483647
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net