Most IP phones available on the market can be configured through a web interface. Though it is a really convenient way to configure a device, if you plan to install dozens or hundred of these you will probably require an IP phone that can be configured through an automatic and practical way. This article explains how to configure such phone from a central repository.
Some phones are proposing this feature, mainly high end range ones, but the small Grandstream BT-100 and BT-200 are also configurable from a central point. These phones are not the best on the market from an audio quality, but for general telephony it can be a good product.
The proposed solution can be done on a Unix server, we have done it on a Mac OS X (release 10.3) without any problem, it should be easy to do it on Linux or *BSD. A Windows implementation could probably be done with some adjustments.
The configuration file used by the Grandstream phone is in a binary format, it is required to use a special tool, available at the Grandstream web site that we will use to translate a textual version of the configuration to a phone readable one. You would find the tool at Grandstream and is called GS_CFG_GEN.tar.gz. You also need the template files, we will use the BT-200 (named BT200_config_1.1.3.2.txt) in order to configure our BT-100 test model (around US$50).
Parameters
Each parameter in the text configuration file is named with a code using a specific format Pxxx, comments can be used to find the one to modify. You can also use the web interface to find the name of the parameter to change: knowing its location on the configuration page, look at the HTML source to find its name. For sure this is not a trivial way of finding a parameter, but it is really an efficient one.
Networking parameter
# DHCP support. 0 - yes, 1 - no
P8 = 0
# NTP Server
P30 = 192.168.16.10
# Layer 3 QoS (IP Diff-Serv or Precedence value for RTP)
P38 = 48
If a static IP address is required on the IP phone, the appropriate fields are P9-P12 for the IP address, P13-P16 for netmask, P17-P20 for default gateway and P21-P24 for DNS server.
SIP parameters
Each IP phone in IP needs to register itself with a registrar (here called SIP server), parameters are:
# Account Name
P270 = 14
# SIP Server
P47 = 192.168.16.14
# SIP User ID
P35 = 14
# Authenticate ID
P36 = 14
Here, the phone will be reachable behind the URI: sip:14@192.168.16.14. If the IP phone, the registrar and proxy are located on the same IP network, you could deactivate the NAT feature:
# NAT Traversal. 0 - yes, 1 - no, 2 - No, but send keep-alive
P52 = 1
The way of sending DTMF digits on the call is by default set to “in-band” which can be broken by low bandwidth codecs, you can change this parameter with:
# Send DTMF. 0 - in audio, 1 - via RTP, 2 - via SIP INFO
P73 = 2
Codecs
On the Grandstream phone, we can specify both codecs to be used and preference order, the parameters P57 and above are used for this purpose, note that RTP values are used to identify each codec:
# First codec.
P57 = 8
Here, G.711 A law is selected as the preferred codec.
Automatic configuration
The automatic configuration is enabled in the configuration itself, it is important to set it, otherwise next reboot will overwrite this behaviour:
# Firmware Upgrade. 0 - TFTP Upgrade, 1 - HTTP Upgrade.
P212 = 0
# Config Server Path
P237 = 192.168.16.181
# Use firmware pre/postfix to determine if f/w is required
# 0 = Always Check for New Firmware
# 1 = Check New Firmware only when F/W pre/suffix changes
# 2 = Always Skip the Firmware Check
P238 = 2
Here, the serivce used is TFTP (easier to set up than a web server from scratch), we specify its IP address. We specify also that firmware will not be checked at each reboot, this depends on how you manage new releases.
Configuration file preparation
Once the configuration file has been prepared, in text format, it should be compiled in order to be downloaded by the phone in an appropriate format. This is performed with the Java specific tool proposed by Grandstream. A shell script, bin/encode.sh, is proposed and needs to be modified to match your installation, mainly paths.
Command to execute looks like:
./bin/encode.sh 000b8207a364 BT-100-14.config cfg000b8207a364
The MAC address of the target phone is specified as well as the source file name. The MAC address is written under the phone and useful to reset to factory this one. The result file should be named with a cfg prefix followed by the MAC address of the phone in lowercase. This file will be gathered on the TFTP server directly by the phone during boot process, the MAC address is known by the phone. This allows to have a specific configuration file for each individual IP phone on our network, which was the main objective.
Automation
The last remaining issue to solve is “how to configure the phone out of the box?”.
The first installation is the more difficult, but here is the real challenge of a big deployment. By default, the out of the box Grandstream phone is getting an IP address through DHCP, afterwards it can be accessed through IP network, with a web browser. In order to limit the IP address range, we can prepare a specific DHCP network (based on a VLan for instance). The limited IP range will ease the IP access to the phone.
From this point, we need to perform some minor operation in the configuration of the phone, at least the fact that the configuration will be gathered through TFTP and the server IP address. This can only be done through HTTP, but hopefully can be automated.
We are using a PERL script, written by Charles Howes and named gsutil, available at Packets Consulting. This tool automates an HTTP connection to the IP phone and change some parameters, it requires a configuration file. Our configuration file looks like:
firmware_upgrade = 0
config_server_path = 192.168.16.181
Initial configuartion
To configure the IP phone at 192.168.16.133, we are using:
./gsutil -bnr -p admin 192.168.16.133 < template.conf
This command changes the configuration of the specified phone using a password for the admin interface and reboots the IP phone at the end. At boot, the phone will gather its configuration through TFTP and the phone will be ready to use.
Conclusion
Even with an entry level IP phone it can be possible to automate the installation of a complete voice over IP site. With Grandstream phones, the process requires the following steps:
- changing the upgrade method off a default IP phone (through gsutil),
- create a configuration file for every IP phone,
- prepare the configuration file with the Java script proposed by Grandstream,
- gather automatically the configuration at boot time.
For sure, some higher end IP phone are better prepared for this automatic installation process, but at a higher price, so give this Grandstream a try.