Hack 80. Make IP Phone Configuration a Trivial Matter
Trivial File Transfer Protocol (TFTP) servers are simple, stripped-down file storage servers that play a role in VoIP networks that's anything but trivial.
When an IP phone is first powered up, it goes through a boot-up sequence that's similar to that of a PC. While most PCs boot up from a functional configuration that's stored locally, an IP phone's configuration can be controlled remotely by an administrator, who can store each configuration in a central repository. IP phones use the TFTP protocol to retrieve updated configurations from that repository, known as a TFTP server.
With a TFTP server, you can centrally store and manage an entire network's worth of IP phone configurations. Merely placing a particular phone's configuration file on the TFTP server will change the phone's functionality to match the new configuration file the next time the phone is booted. Many ATAs can be configured this way, too. In addition, firmware updates for IP phones and ATAs can be delivered by TFTP. So clearly, understanding a little about TFTP and learning how to set up such a server is useful for any VoIP network.
6.10.1. Set Up a TFTP Server
TFTP servers can be hosted on Windows, Mac, Linux, and BSD machines (and on Cisco routers, too), and there's a host of free software (and plenty of good shareware) to enable a basic TFTP server for your test lab. For a more robust TFTP server, use the age-old tftpd software that's included in most Unixes.
To set up a simple TFTP server on Windows, download TFTP Desktop from Weird Solutions. This is a limited version of Weird's commercial Windows TFTP server, and it allows one transfer at a timeenough to satisfy the needs of a VoIP network with a half-dozen IP phones or so. (You can find TFTP Desktop at http://www.weirdsolutions.com/weirdSolutions/pages/02products/download/index.htm.)
Mac users can turn to my favorite TFTP server, Fabrizio La Rosa's aptly named TFTP Server, available at http://www.macupdate.com/info.php/id/11116. Like TFTP Desktop for Windows, this application creates a basic TFTP server with a simple graphical user interface (GUI), but it does so using Mac OS X's built-in TFTP daemon, meaning there are no limits to how much traffic it can handle. You just tell TFTP Server what folder you want to share using TFTP, and that's it.
Linux and other Unix users can probably find a fully functional TFTP server already on their systems. To be sure, issue a tftpd & at the root command line. If you don't get a "command not found" response, you've got the TFTP daemon, and you just have to figure out how to make it work. Thankfully, there's nothing to it. Just create a directory to create your TFTP repository (commonly /tftpboot), and launch the TFTP daemon like this:
# mkdir /tftpboot # chown nobody /tftpboot # tftpd l s /tftpboot &
This will launch the TFTP server (which on many Linux systems runs as the phantom user nobody for security reasonshence the chown to give nobody permission to the TFTP directory). Any files placed in /tftproot will be accessible from a TFTP client, such as the one built into IP phones.
6.10.2. Understand IP Phone Configuration
The syntax of the phone configuration files saved on the TFTP server varies from one make of IP phone to the next. That is, Cisco has a different configuration-file structure than Uniden, for example. But they all bear a few things in common.
First, most IP phone configuration files are regular text files that look like a Unix .conf file or an old-fashioned Windows .ini file. Second, most IP phones support two methods of configuration by TFTP: default and phone-specific.
Default configuration files apply to all phones of a specific make that connect to the TFTP server. Phone-specific configuration files apply only to an individual IP phone. These tend to be denoted by the IP phone's MAC hardware address in the filename of the configuration file. So, if you were to browse through the contents of a typical TFTP server on a VoIP network, you'd see at least one filename without a MAC address (the default configuration) and a handful of files that have MAC addresses in their filenames, denoting them as phone-specific configurations. Most IP phones will revert to the default configuration automatically if no phone-specific file exists on the TFTP server. Other phones will include settings from the default configuration file if they aren't mentioned in the phone-specific file.
Uniden's IP phones generally follow this convention. Take a look at this sample /tftpboot directory:
uniden00e01102ffb7.txt uniden00e01103000a.txt unidenBase.txt uniden00e01102ffc3.txt uniden00e01103001c.txt unidencom.txt uniden00e01102ffca.txt uniden00e01103001f.txt
This directory contains several phone-specific configuration files (the unidenXXXXXXXXXXXX.txt ones) and a default configuration file, unidencom.txt. unidencom.txt covers the networking configuration of the phones (specifically, SIP proxies). So, if you wanted a particular config to affect all the phones (unless overridden in the phone-specific configs), you would place that config in unidencom.txt. Cisco, Grandstream, and others use a very similar model to Uniden. For some tips on Cisco and Uniden TFTP configuration, check out the hacks in Chapter 5. (The unidenBase.txt file is there just as a template from which to generate future phone-specific config files.)