Hack 68. Configure Multiple IP Phones at One Time
Uniden's IP phones, like the UIP200, are excellent business-grade telephones that can be mass configured by TFTPthat is, if you know how.
As you might have already gathered, you can configure IP phones in three ways: directly, using the phone's LCD and buttons; through a web or Telnet interface; or via a configuration file the phone downloads from a TFTP server during boot-up. Those three methods are presented in order of the level of detail to which you can administer the phone, with TFTP configuration allowing the most precise control. Once you've got a TFTP server running [Hack #80], you need only drop the right text files onto your TFTP server to mass-configure your IP phones.
The Uniden IP phones don't offer the trademark high-end look and feel of the Cisco 7900 series of phones, but they do provide a good value nonetheless. At half the price of a typical Cisco SIP phone, the Uniden UIP200 SIP phone supports all of the standards fundamental to a VoIP LAN: inline power, SIP, and several of the key audio codecs. Getting a UIP200 onto the network and doing useful things with your softPBX is a snap, with the help of mass configuration via TFTP.
5.11.1. Get the Uniden on the Network
To get started, I'll assume your UIP200 is connected to your Ethernet LAN and is powered up. You might want to use a static IP configuration on the phone (as opposed to DHCP), so pop into the Uniden's Quick Setup utility by pressing the phone's Menu key. Use the directional arrow keys to access the Network Settings menu. Then, press the Menu key to select it. Now, press the down arrow until you reach IP Address; then press Menu again. Now, you can key in the IP address, substituting stars (*) for periods. Press Menu to accept the address, and then arrow down to the Subnet Mask and enter the appropriate value for your LAN. Repeat this process for the Default GW option, entering the right value for your LAN's default gateway (probably the address of the nearest router).
Next, use the arrow keys to select DNS Server 1, press Menu, and enter the IP address of the nearest DNS server. Then, reboot the phone by powering it off and on. Try pinging the phone's IP address from a nearby PC to see if it's communicating with the network.
5.11.2. Connect the Uniden to TFTP
To alter the phone's automatic configuration mode (i.e., TFTP-based configuration), you need to unlock the configuration menu. To do so, press the phone's Menu key and press the down arrow until you reach Unlock Config. Press Menu again. You'll be prompted for a password, which you can enter using the number pad (on most UIP200 firmware versions, the password is 2002). Press the Menu key to confirm the entered password.
Next, press the up arrow until you reach Network Settings. Press Menu; then press the up arrow until you reach TFTP IP Address. Press Menu, enter the address of your TFTP server, and then press Menu again to confirm it. Now, press the Cancel key to go back to the main menu. Use the arrows to find Phone Settings, and press Menu. Then, it's the arrows again until you find Auto Config. Press Menu, and then press the up arrow to set Auto Config to Enabled. Press Menu, press Cancel, and then press Menu twice to reboot the phone. On the next boot, the phone will look to your IP address to find its SIP and telephony configuration.
5.11.3. Build a Uniden Configuration File
The best way to learn Uniden SIP configuration is to step through the Uniden configuration files. But before we do so, let me go over the basic structure a Uniden UIP200 phone looks for when booting up and searching for its config on a TFTP server. First, the phone expects to find a file called unidencom.txt, which describes the operational characteristics that apply to all phonesthings like site-wide audio settings, addresses of SIP proxies (softPBX servers, that is), DNS servers, and the like. The phone will also look for a file called uniden<MAC>.txt, where <MAC> is the MAC hardware address of the phone. So there is a single unidencom.txt file, and there are many uniden<MAC>.txt files.
I'll step you through the key settings found in unidencom.txt:
ProxyServer 10.1.1.10 ProxyServerPort 0 OutboundProxy1 10.1.1.10 OutboundProxy1Port 0
The proxy settings tell the phone which SIP server to deal with when resolving dialed numbers and attempting to connect calls. ProxyServerPort allows you to override the default SIP UDP port of 5060, if your softPBX is configured this way (not likely). OutboundProxy1 allows you to specify that you want to use a different SIP server for nonlocal calls. In most cases, OutboundProxy1 will be the same as ProxyServer.
Registrar1 10.1.1.10 Registrar1Port 10.1.1.10
Like a SIP Proxy, which routes calls, a SIP Registrar also handles connections from SIP phones, but for a different reason. A SIP Registrar keeps tabs on SIP users and informs requesting callers as to where a particular SIP user can be found (i.e., what IP address that user is registered from). You can specify a different registrar. But in most cases, this will also be the same address as your SIP Proxy, as proxies and registrars tend to be on the same server more often than not.
This setting lets you override whatever DNS server address you provided in the Quick Setup menuunless the phone is using DHCP, in which case it will use whatever DNS server is recommended by the DHCP server when it acquires its address.
RegisterExpireSec 3600 RegisterRetrySec 90
These settings tell the phone how often to register with the SIP registrar, and how often to retry failed registrations.
SipPort tells the phone which UDP to use when listening for SIP messages, such as incoming calls. 5060 is the default, and in most scenarios, you want to leave it at 5060.
G711MuTxPacketLength 20 G711MuJitterBufferLength 10 G711ATxPacketLength 20 G711AJitterBufferLength 10 G729TxPacketLength 20 G729JitterBufferLength 10
The Uniden's three supported codecs are G.711 muLaw, G.711 aLaw, and G.729. The G.711 codecs are standard 64 Kbps PCM bitstream codecs that mimic the sound framing technology used by the legacy time division multiplexing (TDM) equipment on the public telephone network. G.729 is a high-compression codec that requires about half the bandwidth of G.711. These settings allow you to tweak the packet length (in milliseconds) of each codec. Adjusting the packet length (also called the packet interval) changes how large each sound packet will be. Shorter lengths will yield smaller packets, but will require greater bandwidth because they incur more Ethernet and IP overhead. (For a great description of how packet intervals and overhead interact, if I do say so myself, pick up O'Reilly's Switching to VoIP.)
The jitter buffer settings tell the UIP200 how many milliseconds of sound data to record before transmitting to overcome the commonplace network instability known as jitter. In all reality, you might not need to touch any of these settings, though it is certainly fun to toy around with the jitter buffer length if your wide area network (WAN) link is particularly jittery.
DiffServMode OFF DefaultDiffServParam 192 RTPDiffServParam 160
DiffServ is a Quality of Service (QoS) mechanism that uses a policy-based approach to enforcing different classes of service on the same WAN. It's not a bad idea to switch DiffServMode to ON, but don't expect this to increase the quality of your phone calls over the Internet, as most Internet routers don't support the DiffServ standard. Class of service is useful only in a controlled enterprise environment.
VlanMode Disable VlanID 1 PcVlanID 2
Virtual LANs, or VLANs, are a way Ethernet switches can segment traffic to create logically independent networks on the same equipment. In most enterprise VoIP scenarios, there are separate VLANs for voice and data traffic. These settings allow you to specify which VLAN ID to join the phone with. And since the phone has a built-in Ethernet switch for piggyback connection of a PC, you can specify the PC's VLAN, too. That way, even though phone and PC are connected on a single uplink cable, they can still be on separate VLANs. This functionality is common on most IP phones that double as Ethernet switches. Remember that since we're talking about unidencom.txt, the VLANs specified here will apply to all phones that use this TFTP server.
Just in case the DHCP server ever crashes and the phone can't acquire a TFTP server address from it, you can set the address of the TFTP server here.
TimeZone -6 EnableDST YES EnableSNTP YES SntpServerIP 10.1.1.10 SntpRetrySec 1800
These settings control the time and date configuration on the phone. TimeZone sets the local time zone of the phone, expressed as an offset of Greenwich Mean Time. In this case, the phone is 6 hours behind because it's in the Eastern time zone. EnableDST allows the phone to switch from Eastern Daylight Time to Eastern Standard Time automatically, and vice versa, and SntpServerIP and SntpRetrySec enable the phone to use Simple Network Time Protocol to synchronize its clock with the other devices on the network.
PreferredCodec g711u,g711a,g729 Language English
The PreferredCodec setting tells the phone which codecs you prefer to use when connecting calls. If the device on the other end of the call is deemed not to support your preferred codec, the phone goes to the next one in the list. G.711 uLaw is most common in the United States, and G.711 aLaw is common elsewhere in the world. G.729 is a bandwidth-conserving codec. If this phone is going to be used by a road warrior or telecommuter with unpredictable bandwidth capacity, or used over a small (128 kbps at the least) wide area link, you might consider putting G.729 at the front of this list. Uniden's firmware doesn't like spaces in this list, by the way.
Language tells the phone which language to use for the menu prompts. Your choices are English, Spanish, and French (sorry, übergeeks: no Klingon).
StunServerAddr 0.0.0.0 StunServerPort 3478
Simple Traversal of UDP NATs (STUN) is a protocol that helps IP phones deal with the problem of Network Address Translation (NAT), a common technique employed by many firewalls to mask a group of privately addressed devices (like IP phones) behind one or more public IP addresses. The protocol is dealt with in more detail in Chapter 6. Leaving StunServerAddr at 0.0.0.0 disables the UIP200's STUN client, and StunServerPort allows you to override the default port number.
To enable direct dialing by IP address (so that you can call another IP phone by its address rather than its phone number), as shown in the example given in "Make IP-to-IP Phone Calls with a Grandstream BudgeTone" [Hack #60], change this setting to Yes.
The AdminPassword setting allows you to change the menu password rapidly on all of the phones that get their configs from this TFTP server. The format is oldpassword/newpassword.