Asterisk and Cisco 7940

By | 2012-10-19

There are a number of guides out on the Internet for getting Cisco phones working with Asterisk. I didn’t particularly find any of them 100% thorough. This then is my guide, documenting the moment I ordered the phone to the moment I made a call on it.

I bought a Cisco 7940 phone from eBay. It was a brand new boxed version. I’ve changed the MAC to 00:18:b9:ff:ff:ff in this document in case the real MAC could be used by an attacker (paranoia is good for security).

I’d suggest beginning by running Wireshark and set it to filter on the phone’s MAC so that you can follow what it’s doing more easily (I used 'ether host xx:xx:xx:xx:xx or broadcast'). Leave that running for the whole of this guide.

Power Supply

The main difference between the 79×0 and 79×1 phones from Cisco is that the ‘0’ are pre-standard power-over-ethernet, so unless you want to buy a Cisco power over ethernet supply, you’ll probably need a power block for the 79×0 phones. They’re 48V with a slightly unusual connector.

Prerequistes

I’m going to assume you’ve already got a DHCP server on your network, and I’m assuming you’re already running a working Asterisk system.

First Boot

Here’s the sequence:

  • Green headset light
  • Red Mute light
  • Green speaker light
  • “Cisco Systems, Inc. Copyright 2000”
  • “Configuring VLAN”
  • “Configuring IP”
  • “Configuring CM List”
  • “TFTP Timeout”
  • “Configuring IP”
  • … repeat …

Here’s the syslog for the “Configuring IP” period:

11:44:37 dhcpd: DHCPREQUEST for 10.10.202.71 from 00:18:b9:ff:ff:ff via eth0: ignored (not authoritative).
11:44:41 dhcpd: DHCPREQUEST for 10.10.202.71 from 00:18:b9:ff:ff:ff via eth0: ignored (not authoritative).
11:44:49 dhcpd: DHCPREQUEST for 10.10.202.71 from 00:18:b9:ff:ff:ff via eth0: ignored (not authoritative).
11:45:05 dhcpd: DHCPREQUEST for 10.10.202.71 from 00:18:b9:ff:ff:ff via eth0: ignored (not authoritative).
11:45:37 dhcpd: DHCPDISCOVER from 00:18:b9:ff:ff:ff via eth0
11:45:37 dhcpd: DHCPOFFER on 192.168.1.12 to 00:18:b9:ff:ff:ff via eth0
11:45:37 dhcpd: DHCPREQUEST for 192.168.1.12 (192.168.1.3) from 00:18:b9:ff:ff:ff via eth0
11:45:37 dhcpd: DHCPACK on 192.168.1.12 to 00:18:b9:ff:ff:ff via eth0

It’s trying for one minute to get a preprogrammed address, 10.10.202.71, then it falls back to DHCPDISCOVER and gets a valid IP for my internal network, “192.168.1.12”. My suggestion is to configure your DHCP server to allocate a fixed address to the phone (at least for now).

Even though the phone is booting, you do have access to the settings page (the bottom right button on the cluster above the volume button). On that, you’ll find menu options for

  • Contrast
  • Ring Type
  • Network Configuration
  • Status

Status->Firmware Versions will show you a useful set of data you should note down. Here’s what I saw.

App Load ID:
  P0030301MFG2
Boot Load ID:
  PC0303010200
Version:
  3.1(MF.G2)
Expansion Module 1:

Expansion Module 2:

My network configuration page was locked, but it did show that 10.10.202.71 address.

On the top settings page there is also a ‘more’ option. Under which you’ll get a “factory” option. It’s not unreasonable to push that. It won’t do much anyway.

TFTP

The “TFTP Timeout” isn’t a surprise as I’ve not installed a TFTP server. Use whatever you like. I tried the Debian package, tftpd first, but found it wasn’t verbose enough in logs to help debugging. I settled on atftpd. Debian defaults this to inetd mode, so you can configure it in /etc/inetd.conf.

It defaulted to using /srv/tftp as its root directory. Change this to whatever you’d like (or just use this default).

Now we need to tell the DHCP server to tell the phone about our TFTP server. I did this by matching on MAC address:

host cisco7940 {
    hardware ethernet 00:18:b9:ff:ff:ff;
    fixed-address cisco7940.example.com;
    option tftp-server-name "192.168.1.3";
    next-server 192.168.1.3;
}

Obviously you should put your own TFTP server IP address in this section.

After you’ve done this, your syslog will show you that the phone is requesting the following files via TFTP:

12:45:17 atftpd[1483]: Serving OS79XX.TXT to 192.168.1.12:52578
12:45:17 atftpd[1483]: Serving SEP0018B9FFFFFF.cnf.xml to 192.168.1.12:52579
12:45:17 atftpd[1483]: Serving XMLDefault.cnf.xml to 192.168.1.12:52580
12:45:17 atftpd[1483]: Serving SEP0018B9FFFFFF.cnf to 192.168.1.12:52581
12:45:17 atftpd[1483]: Serving SEPDefault.cnf to 192.168.1.12:52582

They don’t exist yet so the phone issues a TFTP error message.

Firmware

You’ll need to find yourself the appropriate firmware. Officially that firmware is only available from Cisco and is copyright. You therefore shouldn’t go to Google and make any efforts at all to locate it.

The OS79XX.TXT file on your TFTP server tells the phone which file it should TFTP-fetch to use as a firmware.

The suggested order of firmware installation is as follows (note, after version 5 the binaries are signed so you will only be able to upgrade to Cisco signed versions):

  • Version 5: P0S3-05-3-00
  • Version 8: P003-8-11-00

For each, you should edit the OS79XX.TXT and fill in the name of the firmware binary without its extension. The phone will use that name to fetch from the TFTP server and will install it:

  • Edit OS79XX.TXT
  • Power up phone
  • TFTP Download of OS79XX.TXT
  • TFTP Download of P0S3-05-3-00.bin
  • Mute light lights
  • All three lights light
  • Phone self reboots

After this I got a different boot logo, “SIP” in the top right corner and some different messages and menus. Most notably “Phone Unprovisioned”.

Go again…

  • Edit OS79XX.TXT
  • Power up phone
  • TFTP Download of OS79XX.TXT
  • TFTP Download of P003-8-11-00.sbn
  • Mute light lights
  • All three lights light
  • Phone self reboots

Now we get the “Universal Application Loader” boot page. You can now do a factory reset like this:

  • Power down phone
  • Hold ‘#’
  • Power up phone
  • Wait for light cycle to finish
  • “Reset sequence detected” message is shown
  • Enter '1,2,3,4,5,6,7,8,9,*,0,#'
  • You’ll be offered the option to save network cfg, press ‘2’ for ‘no’.

The boot then stops with the message “TFTP file not found”. Here’s the syslog. None of these files exist yet in my TFTP directory. Note that the phone is actually looking for the same configuration but starts at configuration specific to itself and works to more generic files.

13:24:01 atftpd[7926]: Serving CTLSEP0018B9FFFFFF.tlv to 192.168.1.12:50367
13:24:01 atftpd[7926]: Serving SEP0018B9FFFFFF.cnf.xml to 192.168.1.12:50368
13:24:01 atftpd[7926]: Serving SIP0018B9FFFFFF.cnf to 192.168.1.12:50369
13:24:01 atftpd[7926]: Serving MGC0018B9FFFFFF.cnf to 192.168.1.12:50370
13:24:01 atftpd[7926]: Serving XMLDefault.cnf.xml to 192.168.1.12:50371
13:24:01 atftpd[7926]: Serving SIPDefault.cnf to 192.168.1.12:50372
13:24:01 atftpd[7926]: Serving MGCDefault.cnf to 192.168.1.12:50373

No buttons have any effect at this point. The reason is that the Universal Application Loader is not phone software, it will load phone software from the TFTP server.

We’ll use XMLDefault.cnf.xml. I’ve deleted the now-unused v5 firmwares, the unused v8 SCCP firmwares and am left with the following in my TFTP directory

  • OS79XX.TXT
  • P003-8-11-00.bin
  • P003-8-11-00.sbn
  • P0S3-8-11-00.loads
  • P0S3-8-11-00.sb2
  • XMLDefault.cnf.xml

My XMLDefault.cnf.xml contains the following:

<Default>
  <loadInformation>P0S3-8-12-00</loadInformation>
</Default>

Which results in

13:52:21 atftpd[7926]: Serving P0S3-8-12-00.loads to 192.168.1.12:50382

The P0S that this is a SIP firmware. Reboot the phone and the “Universal Application Loader” is gone, and we get SIP phone software again. You can use the settings button to check the firmware version. It should now be 'P0S3-8-11-00' (I originally used v8.12.00 but it stripped the non-alphanumeric characters from the caller IDs, so I’ve switched to v8.11.00).

Provisioning

The SIP firmware now loaded makes the following TFTP request.

13:53:05 atftpd[7926]: Serving SIPDefault.cnf to 192.168.1.12:50346
13:53:05 atftpd[7926]: Serving SIP0018B9FFFFFF.cnf to 192.168.1.12:50347

These two files are the generic SIP configuration and the per-phone SIP configuration. The following sections give some examples. Your changes for them are your own preference, the main settings are the proxy1_address and the line1_xxxx settings which you’ll copy from your Asterisk sip.conf.

SIPDefault.cnf

# Proxy server address should probably be more accuratly be called
# the SIP server
proxy1_address: x.x.x.x
# proxy_register tell it to connect to the SIP server (why would you
# want to set this to 0?!
proxy_register: 1

sntp_server: "pool.ntp.org"
sntp_mode: unicast
time_zone: GMT
dst_offset: 1
dst_start_month: March
dst_start_day_of_week: Sun
dst_start_week_of_month: 8
dst_start_time: 01
dst_stop_month: Oct
dst_stop_day_of_week: Sun
dst_stop_week_of_month: 8
dst_stop_time: 02
dst_auto_adjust: 1
time_format_24hr: 1
date_format : D/M/Y

# The directory_url contains a URL to the directory XML file
directory_url: "http://www.example.com/directory.xml"

messages_uri: "8500"

SIP0018B9FFFFFF.cnf

# The following lines contain the authenication details
line1_name: line1
line1_authname: "line1"
line1_password: "supersecret"
# Asterisk overrides this
line1_displayname: "Caller ID"
# What to show on screen next to the line button
line1_shortname: "BUTTONLABEL"

directory.xml

<CiscoIPPhoneInput>
    <Title>Phone book</Title>
    <Prompt>Prompt text.</Prompt>
    <URL>http://www.example.com/phonebook.pl</URL>
    <InputItem>
            <DisplayName>search</DisplayName>
            <QueryStringParam>search</QueryStringParam>
            <InputFlags></InputFlags>
            <DefaultValue></DefaultValue>
    </InputItem>
</CiscoIPPhoneInput>

<CiscoIPPhoneDirectory>
<Title>Directory</Title>
<Prompt>Who you gonna call?</Prompt>
<DirectoryEntry>
     <Name>Tom</Name>
     <Telephone>6905</Telephone>
</DirectoryEntry>
<DirectoryEntry>
     <Name>Dick</Name>
     <Telephone>6906</Telephone>
</DirectoryEntry>
</CiscoIPPhoneDirectory>

Leave a Reply