SIP Debugging with registering a phone

Hi -

I’m working on a new Asterisk based system and am running into some issues w/ registering the phones. The phones are Cisco 7945G that have been flashed to the latest SIP firmware. When the phone attempts to register, I see these lines from the Asterisk command prompt when sip debug is on:

Asterisk 1.4.20-1 RPM by vc-rpms@voipconsulting.nl, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Connected to Asterisk 1.4.20-1 RPM by vc-rpms@voipconsulting.nl currently running on trixbox1 (pid = 2544)
trixbox1CLI> sip debug
SIP Debugging re-enabled
Really destroying SIP dialog ‘002155d4-c2520002-0062b090-a9befbe2@192.168.2.200’ Method: REGISTER
trixbox1
CLI>
<— SIP read from 192.168.2.200:49157 —>
REGISTER sip:192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.200:5060;branch=z9hG4bKc373cb6d
From: sip:500@192.168.2.1;tag=002155d4c2520002d9f9da74-89bec897
To: sip:500@192.168.2.1
Call-ID: 002155d4-c2520002-40c70426-9ada40f1@192.168.2.200
Max-Forwards: 70
Date: Tue, 15 Apr 2008 21:06:04 GMT
CSeq: 101 REGISTER
User-Agent: Cisco-CP7945G/8.3.0
Contact: sip:101@192.168.2.200:5060;transport=udp;+sip.instance=“urn:uuid:00000000-0000-0000-0000-002155d4c252”;+u.sip!model.ccm.cisco.com="435"
Supported: (null),X-cisco-xsi-6.0.2
Content-Length: 0
Reason: SIP;cause=200;text="cisco-alarm:25 Name=SEP002155D4C252 Load=SIP45.8-3-5S Last=initialized"
Expires: 3600

<------------->
— (14 headers 0 lines) —
Using latest REGISTER request as basis request
Sending to 192.168.2.200 : 5060 (no NAT)

<— Transmitting (no NAT) to 192.168.2.200:5060 —>
SIP/2.0 404 Not found
Via: SIP/2.0/UDP 192.168.2.200:5060;branch=z9hG4bKc373cb6d;received=192.168.2.200
From: sip:500@192.168.2.1;tag=002155d4c2520002d9f9da74-89bec897
To: sip:500@192.168.2.1;tag=as6815d757
Call-ID: 002155d4-c2520002-40c70426-9ada40f1@192.168.2.200
CSeq: 101 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘002155d4-c2520002-40c70426-9ada40f1@192.168.2.200’ in 32000 ms (Method: REGISTER)

Can anyone help me debug this? Or at provide some direction as to what these message blocks are trying to tell me?

Thanks!

  • Peter

You have a 404 error saying not found. I personally have never seen this on asterisk (but then again I don’t see many thing). Can you post your sip.conf ?

I’m running the SwitchVOX release and it locks access to the system via a web interface so posting the sip.conf file isn’t a possibility. But I have solved my problem.

The final hurdle to getting the phones to register with the server was to set the “Phone NAT Traversal” option to No. All my phones are located in a central office with direct access to the server so there is no NAT traversal needed. When the extensions were originally created this was set to Always, which may be the default.

In the hope that what I’ve learned about configuring VOIP, SwitchVOX / Asterisk and Cisco 7945 phones will help someone else, here are the specifics on the various configuration files in my system.

Network environment ip addresses:
[ul]
Router - 192.168.2.1
Asterisk server - 192.168.2.2
TFTP server - 192.168.2.5
DHCP server - 192.168.2.5
Phones - 192.168.2.150 - 192.168.2.200
[/ul]
DHCP:
The first issue that I ran into was in correctly configuring the dhcp server. The phones want option 150 to be the address of the tftp server and there are very few examples for dhcpd.conf that show how to configure option 150. This turns out to be very simple.

Contents of dhcpd.conf:

# dhcpd.conf

option option-150 code 150 = ip-address; 

# option definitions common to all supported networks...
option domain-name "domain_name.com";
option domain-name-servers 192.168.1.100;
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
option option-150 192.168.2.5; 
default-lease-time 10800; # 3 hours
max-lease-time 604800;    # 1 week

# Use this to enble / disable dynamic dns updates globally.
ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

subnet 192.168.1.0 netmask 255.255.255.0 {
}

# This is a very basic subnet declaration.

subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.150 192.168.2.200;
}

TFTP Server
For various reasons, I’m not able to provide the contents of all the files in the tftp server directory. I’m not yet certain if all the files are needed nor what their purpose would be. But I can provide their names:
[ul]
CTLFile.tlv
Desktops/
OS7945.TXT
OS79XX.TXT
SEP001D705FA120.cnf.xml
SIP45.8-3-5S.loads
United_States/
XMLDefault.cnf.xml
apps45.8-3-4-16.sbn
cnu45.8-3-4-16.sbn
cvm45sip.8-3-4-16.sbn
dialplan.xml
dsp45.8-3-4-16.sbn
g3tones.xml
jar45sip.8-3-4-16.sbn
term45.default.loads
term61.default.loads
term65.default.loads
xmlDefault.CNF.XML
[/ul]
Phones
The next problem was with the phones themselves. Cisco ships their phones with the SCCP flash image installed. These are meant to work with the Cisco Unified CallManager product, not an Asterisk based server. The phones had to be flashed with the SIP image. There are lots of different examples out on the web that show how to various Cisco IP and it looks like the configuration of each phone model is very different. The posting at http://www.epygi.com/forum/showthread.php?t=804 provides alot of information needed to get the Cisco 7945 phones working.

On the tftp server, there needs to be a SEPmmmmmmmmmmmm.cnf.xml file for each phone where mmmmmmmmmmmm is the mac address of the phone. If a phone has a mac address of 00:1D:70:5F:A1:20, then there has to be a SEP001D705FA120.cnf.xml that configures the phone available from the tftp server.

For easier maintenance, I’m using a simple python program to automatically generate the SEP.cnf.xml files based on the contents of an extensions.csv and SEPmac.cnf.xml.template file.

sep_generator

#!/usr/bin/env python
# encoding: utf-8
"""
sep_generator

Copyright (c) 2008, Peter Kropf
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Load the extension.csv file and create the appropiate SEP*.cnf.xml
files needed to allow the phones to be configured for specific people.

usage: sep_generator extensions.csv SEPmac.cnf.xml.template
"""

import os
import csv
import sys
import md5


def create_sep(template, *args, **kwds):
    #print 'args:', args
    #print 'kwds:', kwds
    sep = template % kwds
    sep_file_name = 'SEP%(mac_address)s.cnf.xml' % kwds

    if os.path.exists(sep_file_name):
        new_md5 = md5.md5(sep).hexdigest()
        old_md5 = md5.md5(open(sep_file_name, 'rU').read()).hexdigest()

        if new_md5 != old_md5:
            print 'replacing', sep_file_name
            open(sep_file_name, 'w').write(sep)

    else:
        print 'creating new', sep_file_name
        open(sep_file_name, 'w').write(sep)


def create_extensions(source, template):
    """
    load the extension data from the specified file and generate the
    needed SEP*.cnf.xml files.
    """

    records = {}
    reader = csv.reader(source, delimiter=',')

    header = reader.next()
    #print 'header:', header

    for row in reader:

        if not len(row):
            continue

        kwds = dict([(header[x], row[x]) for x in range(len(header))])
        #print kwds
        create_sep(template, **kwds)


if __name__ == '__main__':
    create_extensions(open(sys.argv[1], 'rU'), open(sys.argv[2], 'rU').read())

extensions.csv

extension,password,mac_address,first_name,last_name
100,xyzzy,001D705FA120,Peter,Kropf

SEPmac.cnf.xml.template

<device>
    <fullConfig>true</fullConfig>
    <deviceProtocol>SIP</deviceProtocol>
    <sshUserId>user</sshUserId>
    <sshPassword>pass</sshPassword>
    <devicePool>
        <name/>
        <dateTimeSetting>
            <dateTemplate>M/D/YA</dateTemplate>
            <timeZone>Pacific Standard/Daylight Time</timeZone>
            <ntps>
                <ntp>
                    <name>192.168.2.2</name>
                    <ntpMode>Unicast</ntpMode>
                </ntp>
            </ntps>
        </dateTimeSetting>
        <callManagerGroup>
            <name>5.0 Beta</name>
            <tftpDefault>true</tftpDefault>
            <members>
                <member priority="0">
                    <callManager>
                        <name>ccm-beta-5-1</name>
                        <description>CallManager 5.0 Beta Pub - 5.0.1.032</description>
                        <ports>
                            <ethernetPhonePort>2000</ethernetPhonePort>
                            <sipPort>5060</sipPort>
                            <securedSipPort>5061</securedSipPort>
                            <mgcpPorts>
                                <listen>2427</listen>
                                <keepAlive>2428</keepAlive>
                            </mgcpPorts>
                        </ports>
                        <processNodeName>192.168.2.2</processNodeName>
                    </callManager>
                </member>
            </members>
        </callManagerGroup>
        <srstInfo>
            <name>Disable</name>
            <srstOption>Disable</srstOption>
            <userModifiable>false</userModifiable>
            <ipAddr1/>
            <port1>2000</port1>
            <ipAddr2/>
            <port2>2000</port2>
            <ipAddr3/>
            <port3>2000</port3>
            <sipIpAddr1>192.168.2.2</sipIpAddr1>
            <sipPort1>5060</sipPort1>
            <sipIpAddr2>192.168.2.2</sipIpAddr2>
            <sipPort2>5060</sipPort2>
            <sipIpAddr3/>
            <sipPort3>5060</sipPort3>
            <isSecure>false</isSecure>
        </srstInfo>
        <mlppDomainId>-1</mlppDomainId>
        <mlppIndicationStatus>Default</mlppIndicationStatus>
        <preemption>Default</preemption>
        <connectionMonitorDuration>120</connectionMonitorDuration>
    </devicePool>
    <sipProfile>
        <sipProxies>
            <backupProxy/>
            <backupProxyPort/>
            <emergencyProxy/>
            <emergencyProxyPort/>
            <outboundProxy/>
            <outboundProxyPort/>
            <registerWithProxy>true</registerWithProxy>
        </sipProxies>
        <sipCallFeatures>
            <cnfJoinEnabled>true</cnfJoinEnabled>
            <callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
            <callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
            <callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
            <callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
            <meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
            <abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
            <rfc2543Hold>false</rfc2543Hold>
            <callHoldRingback>2</callHoldRingback>
            <localCfwdEnable>true</localCfwdEnable>
            <semiAttendedTransfer>true</semiAttendedTransfer>
            <anonymousCallBlock>2</anonymousCallBlock>
            <callerIdBlocking>2</callerIdBlocking>
            <dndControl>1</dndControl>
            <remoteCcEnable>true</remoteCcEnable>
        </sipCallFeatures>
        <sipStack>
            <sipInviteRetx>6</sipInviteRetx>
            <sipRetx>10</sipRetx>
            <timerInviteExpires>180</timerInviteExpires>
            <timerRegisterExpires>3600</timerRegisterExpires>
            <timerRegisterDelta>5</timerRegisterDelta>
            <timerKeepAliveExpires>120</timerKeepAliveExpires>
            <timerSubscribeExpires>120</timerSubscribeExpires>
            <timerSubscribeDelta>5</timerSubscribeDelta>
            <timerT1>500</timerT1>
            <timerT2>4000</timerT2>
            <maxRedirects>70</maxRedirects>
            <remotePartyID>true</remotePartyID>
            <userInfo>None</userInfo>
        </sipStack>
        <autoAnswerTimer>1</autoAnswerTimer>
        <autoAnswerAltBehavior>false</autoAnswerAltBehavior>
        <autoAnswerOverride>true</autoAnswerOverride>
        <transferOnhookEnabled>false</transferOnhookEnabled>
        <enableVad>false</enableVad>
        <preferredCodec>g711ulaw</preferredCodec>
        <dtmfAvtPayload>101</dtmfAvtPayload>
        <dtmfDbLevel>3</dtmfDbLevel>
        <dtmfOutofBand>avt</dtmfOutofBand>
        <alwaysUsePrimeLine>false</alwaysUsePrimeLine>
        <alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
        <kpml>3</kpml>
        <phoneLabel>%(first_name)s</phoneLabel>
        <stutterMsgWaiting>2</stutterMsgWaiting>
        <callStats>true</callStats>
        <offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
        <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
        <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
        <startMediaPort>16384</startMediaPort>
        <stopMediaPort>32766</stopMediaPort>
        <sipLines>
            <line button="1">
                <featureID>9</featureID>
                <featureLabel>%(extension)s</featureLabel>
                <proxy>192.168.2.2</proxy>
                <port>5060</port>
                <name>%(extension)s</name>
                <displayName>%(extension)s</displayName>
                <autoAnswer>
                    <autoAnswerEnabled>2</autoAnswerEnabled>
                </autoAnswer>
                <callWaiting>3</callWaiting>
                <authName>%(extension)s</authName>
                <authPassword>%(password)s</authPassword>
                <sharedLine>false</sharedLine>
                <messageWaitingLampPolicy>1</messageWaitingLampPolicy>
                <messagesNumber>*99</messagesNumber>
                <ringSettingIdle>4</ringSettingIdle>
                <ringSettingActive>5</ringSettingActive>
                <contact>101</contact>
                <forwardCallInfoDisplay>
                    <callerName>true</callerName>
                    <callerNumber>false</callerNumber>
                    <redirectedNumber>false</redirectedNumber>
                    <dialedNumber>true</dialedNumber>
                </forwardCallInfoDisplay>
            </line>
        </sipLines>
        <voipControlPort>5060</voipControlPort>
        <dscpForAudio>184</dscpForAudio>
        <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
        <dialTemplate>dialplan.xml</dialTemplate>
        <softKeyFile/>
    </sipProfile>
    <commonProfile>
        <phonePassword/>
        <backgroundImageAccess>true</backgroundImageAccess>
        <callLogBlfEnabled>2</callLogBlfEnabled>
    </commonProfile>
    <loadInformation>SIP45.8-3-5S</loadInformation>
    <vendorConfig>
        <disableSpeaker>false</disableSpeaker>
        <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
        <pcPort>0</pcPort>
        <settingsAccess>1</settingsAccess>
        <garp>0</garp>
        <voiceVlanAccess>0</voiceVlanAccess>
        <videoCapability>0</videoCapability>
        <autoSelectLineEnable>0</autoSelectLineEnable>
        <webAccess>0</webAccess>
        <daysDisplayNotActive>1,7</daysDisplayNotActive>
        <displayOnTime>08:00</displayOnTime>
        <displayOnDuration>10:30</displayOnDuration>
        <displayIdleTimeout>01:00</displayIdleTimeout>
        <spanToPCPort>1</spanToPCPort>
    </vendorConfig>
    <versionStamp/>
    <userLocale>
        <name/>
        <uid/>
        <langCode>en_US</langCode>
        <version/>
        <winCharSet/>
    </userLocale>
    <networkLocale/>
    <networkLocaleInfo>
        <name/>
        <uid/>
        <version>1.0.0.0-1</version>
    </networkLocaleInfo>
    <deviceSecurityMode>1</deviceSecurityMode>
    <idleTimeout>0</idleTimeout>
    <authenticationURL/>
    <directoryURL/>
    <idleURL/>
    <informationURL/>
    <messagesURL/>
    <proxyServerURL/>
    <servicesURL/>
    <dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
    <dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
    <dscpForCm2Dvce>96</dscpForCm2Dvce>
    <transportLayerProtocol>4</transportLayerProtocol>
    <capfAuthMode>0</capfAuthMode>
    <capfList>
        <capf>
            <phonePort>3804</phonePort>
            <processNodeName>ccm-beta-5-1</processNodeName>
        </capf>
    </capfList>
    <certHash/>
    <encrConfig>false</encrConfig>
</device>

Inside the SEPmac.cnf.xml.template file, you’ll find entries like “%(first_name)s” and “%(extension)s”. These are replaced by the contents from the extensions.csv file. Each field as labeled in the first line of the extension.csv file will be used to replace the “%(field)s” entries in the SEPmac.cnf.xml.template file with the values found in each row. This allows me to easily keep the extension.csv file updated with the correct information and easily generate the SEPmmmmmmmmmmmm.cnf.xml files needed by the phones.

By running the sep_generator program with the listed extensions.csv and SEPmac.cnf.xml files a file called SEP001D705FA120.cnf.xml will be created. It has the phoneLabel set to Peter, the authName set to 100 and the authPassword set to xyzzy.

Final Notes
I’m not quote finished with the deployment of our new phone switch. I still have to flash the remaining 24 phones with the SIP image and then setup some more of the business logic needed. Things like the hold music, roll overs, etc. Hopefully this will go much more smoothly than the initial phone setup :wink:

I hope that this will help the next person trying to get a Cisco 7945 phone working with Asterisk. And if anyone has any questions on this, please let me know.

  • Peter