Cisco IP Phone 7942 w/ Asterisk

comments 12
Asterisk / VoIP

Cisco IP Phone 7942here is how I got my Cisco IP Phone 7942 provisioned with Asterisk. this is the result of a whole weekend on searching, flashing, codeing, rebooting, … I believe it applies to the 7962 model as well.

anyhow, all the flashing of firmware, provisioning of configuration, localization, … is done via TFTP. furthermore a DHCP server announces the TFTP server. so in a first step you have to …

prepare the environment

create a host entry with tftp-server-name option in your dhcp server.

host cisco7942 {
  hardware ethernet 00:24:c4:ab:cd:ef;
  option tftp-server-name "_TFTPSERVER_";
}

replace _TFTPSERVER_ with the IP or FQDN of your TFTP server.

install the TFTP server.

aptitude install atftpd

if not running by inetd also add port number in default config!

USE_INETD=false
OPTIONS="--port 69 --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /srv/tftp"

start atftpd by

/etc/init.d/atftpd start

don’t forget to drill a hole into your firewall for TFTP on UDP port 69.

iptables -A INPUT -p udp -s _LAN_ -m multiport --dport 69 -m state --state NEW -j ACCEPT

replace _LAN_ with your networks address like 192.168.1.0/24.

get latest firmware

get latest Cisco IP Phone 7942 SIP Software (firmware) and unzip it into /srv/tftp, the tftp root directory. remember the filename in line 6.

apps42.9-3-1ES26.sbn
cnu42.9-3-1ES26.sbn
cvm42sip.9-3-1ES26.sbn
dsp42.9-3-1ES26.sbn
jar42sip.9-3-1ES26.sbn
SIP42.9-3-1SR4-1S.loads
term42.default.loads
term62.default.loads

if you like you can already factory reset your phone. power cycle it. as the phone reboots, you should hold down the # key until the line buttons flash. once they begin to flash, press 123456789*0#, which should make your phone reboot again and the firmware you put in the tftp root directory will start loading. allow this process to run on its own for about 10 to 15 minutes. in the meantime you can watch the firmware served to your phone by issuing following command.

tail -f /var/log/dameon.log | grep tftp

global configuration

the XMLDefault.cnf.xml is the base file for global settings for all of the Cisco IP Phones to be used.

<Default>
  <callManagerGroup>
    <members>
      <member priority="0">
        <callManager>
          <ports>
            <ethernetPhonePort>2000</ethernetPhonePort>
            <mgcpPorts>
              <listen>2427</listen>
              <keepAlive>2428</keepAlive>
            </mgcpPorts>
          </ports>
          <processNodeName>_ASTERISK_</processNodeName>
        </callManager>
      </member>
    </members>
  </callManagerGroup>
  <loadInformation434 model="Cisco 7942">SIP42.9-3-1SR4-1S</loadInformation434>
  <authenticationURL></authenticationURL>
  <directoryURL></directoryURL>
  <idleURL></idleURL>
  <informationURL></informationURL>
  <messagesURL></messagesURL>
  <servicesURL></servicesURL>
</Default>

replace _ASTERISK_ with the IP or FQDN of your Asterisk in line 13. the loadInformation tags in line 18 are used to determine which firmware each device will download and apply. the tags value is the name of the file SIP*.loads without the extension .loads in the firmware (you remember now line 6 of the listing of the files of the phone’s firmware?).

the dialplan.xml contains information on the timeouts for various different patterns of dialled numbers.

<DIALTEMPLATE>
  <TEMPLATE MATCH="2.." Timeout="0" User="Phone"/>
  <TEMPLATE MATCH="*" Timeout="3" User="Phone"/>
</DIALTEMPLATE>

all my extensions start with 2 and have 3 digits, so the phone dials immediatly after match.

device specific configuration

most brainpower needs the device configuration file SEP_MAC_.cnf.xml, unfortunately the format of this config files has never been well documented so Cisco’s latest 79×1 lineup serves as a reference guide to getting these phones working with Asterisk.

<device>
  <deviceProtocol>SIP</deviceProtocol>
  <sshUserId>cisco</sshUserId>
  <sshPassword>cisco</sshPassword>
  <devicePool>
    <dateTimeSetting>
      <dateTemplate>D.M.Y</dateTemplate>
      <timeZone>W. Europe Standard/Daylight Time</timeZone>
      <ntps>
        <ntp>
          <name>_NTPSERVER_</name>
          <ntpMode>Unicast</ntpMode>
        </ntp>
      </ntps>
    </dateTimeSetting>
    <callManagerGroup>
      <members>
        <member priority="0">
          <callManager>
            <ports>
              <ethernetPhonePort>2000</ethernetPhonePort>
              <sipPort>5060</sipPort>
              <securedSipPort>5061</securedSipPort>
            </ports>
            <processNodeName>_ASTERISK_</processNodeName>
          </callManager>
        </member>
      </members>
    </callManagerGroup>
  </devicePool>
  <sipProfile>
    <sipProxies>
      <backupProxy></backupProxy>
      <backupProxyPort></backupProxyPort>
      <emergencyProxy></emergencyProxy>
      <emergencyProxyPort></emergencyProxyPort>
      <outboundProxy></outboundProxy>
      <outboundProxyPort></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>0</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>g711alaw</preferredCodec>
    <dtmfAvtPayload>101</dtmfAvtPayload>
    <dtmfDbLevel>3</dtmfDbLevel>
    <dtmfOutofBand>avt</dtmfOutofBand>
    <alwaysUsePrimeLine>false</alwaysUsePrimeLine>
    <alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
    <kpml>3</kpml>
    <natEnabled>false</natEnabled>
    <natAddress></natAddress>
    <phoneLabel>_NAME_</phoneLabel>
    <stutterMsgWaiting>0</stutterMsgWaiting>
    <callStats>false</callStats>
    <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
    <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
    <startMediaPort>16384</startMediaPort>
    <stopMediaPort>32766</stopMediaPort>
    <sipLines>
      <line button="1">
        <featureID>9</featureID>
        <featureLabel>_USER_</featureLabel>
        <proxy>USECALLMANAGER</proxy>
        <port>5060</port>
        <name>_USER_</name>
        <displayName>_USER_</displayName>
        <autoAnswer>
          <autoAnswerEnabled>2</autoAnswerEnabled>
        </autoAnswer>
        <callWaiting>3</callWaiting>
        <authName>_USER_</authName>
        <authPassword>_PASSWORD_</authPassword>
        <sharedLine>false</sharedLine>
        <messageWaitingLampPolicy>1</messageWaitingLampPolicy>
        <messagesNumber>*97</messagesNumber>
        <ringSettingIdle>4</ringSettingIdle>
        <ringSettingActive>5</ringSettingActive>
        <contact>_USER_</contact>
        <forwardCallInfoDisplay>
          <callerName>true</callerName>
          <callerNumber>true</callerNumber>
          <redirectedNumber>true</redirectedNumber>
          <dialedNumber>true</dialedNumber>
        </forwardCallInfoDisplay>
      </line>
    </sipLines>
    <voipControlPort>5060</voipControlPort>
    <dscpForAudio>184</dscpForAudio>
    <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
    <dialTemplate>dialplan.xml</dialTemplate>
  </sipProfile>
  <commonProfile>
    <phonePassword>1234</phonePassword>
    <backgroundImageAccess>true</backgroundImageAccess>
    <callLogBlfEnabled>2</callLogBlfEnabled>
  </commonProfile>
  <loadInformation>SIP42.9-3-1SR4-1S</loadInformation>
  <vendorConfig>
    <disableSpeaker>false</disableSpeaker>
    <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
    <pcPort>1</pcPort>
    <settingsAccess>1</settingsAccess>
    <garp>0</garp>
    <voiceVlanAccess>0</voiceVlanAccess>
    <videoCapability>0</videoCapability>
    <autoSelectLineEnable>0</autoSelectLineEnable>
    <sshAccess>0</sshAccess>
    <sshPort>22</sshPort>
    <webAccess>0</webAccess>
    <spanToPCPort>1</spanToPCPort>
    <loggingDisplay>1</loggingDisplay>
    <loadServer></loadServer>
  </vendorConfig>
  <versionStamp></versionStamp>
  <userLocale>
    <name>English_United_Kingdom</name>
    <langCode>en</langCode>
  </userLocale>
  <networkLocale>Germany</networkLocale>
  <networkLocaleInfo>
    <name>Germany</name>
  </networkLocaleInfo>
  <deviceSecurityMode>1</deviceSecurityMode>
  <authenticationURL></authenticationURL>
  <directoryURL></directoryURL>
  <idleURL></idleURL>
  <informationURL></informationURL>
  <messagesURL></messagesURL>
  <proxyServerURL></proxyServerURL>
  <servicesURL></servicesURL>
  <dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
  <dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
  <dscpForCm2Dvce>96</dscpForCm2Dvce>
  <transportLayerProtocol>2</transportLayerProtocol>
  <capfAuthMode>0</capfAuthMode>
  <capfList>
    <capf>
      <phonePort>3804</phonePort>
    </capf>
  </capfList>
  <certHash></certHash>
  <encrConfig>false</encrConfig>
</device>

replace

  • _NTPSERVER_ with NTP servers IP or FQDN,
  • _ASTERISK_ with Asterisk IP or FQDN,
  • _NAME_ with phones name,
  • _USER_ with the username or extension in sip.conf,
  • _PASSWORD_ with the password in sip.conf.

define your own timezone in line 8 referring to Time Zones.

the loadInformation tags in line 132 are used to determine which firmware this device will download and apply. the tags value is the name of the file SIP*.loads without the extension .loads in the firmware.

find appropriate values for the user and the network locale in lines 150 – 157 referring to System-Defined User and Network Locales.

Asterisk configuration

just for completeness I will also provide a sip.conf for your Asterisk.

[_USER_]
type=friend
username=_USER_
secret=_PASSWORD_
callerid=_NAME_ <_USER_>
context=from-internal
nat=no
canreinvite=no
host=dynamic

splash into the pool

if you have put all the above mentioned configuration files into the TFTP servers root directory a ls should show you:

apps42.9-3-1ES26.sbn
cnu42.9-3-1ES26.sbn
cvm42sip.9-3-1ES26.sbn
dsp42.9-3-1ES26.sbn
jar42sip.9-3-1ES26.sbn
SIP42.9-3-1SR4-1S.loads
term42.default.loads
term62.default.loads
dialplan.xml
SEP0024C4ABCDEF.cnf.xml
XMLDefault.cnf.xml

if you have not already factory reset your phone it’s time to do! power cycle it. as the phone reboots, you should hold down the # key until the line buttons flash. once they begin to flash, press 123456789*0#, which should make your phone reboot again and the firmware you put in the tftp root directory will start loading. allow this process to run on its own for about 10 to 15 minutes.

or reboot your phone by pressing **#** quickly from the settings menu and wait.

in the meantime you can watch the firmware served to your phone by issuing following command.

tail -f /var/log/daemon.log | grep tftp

you could also have a look if your phone is registering by connecting to a running Asterisk and obtaining a console interface for controlling it on a very high verbosity level.

asterisk -rvvvvvv

to display the current status of the phones additionally execute in Asterisks console interface.

sip show peers

if no entry appears in the list for this phone then review the username=_USER_ and secret=_PASSWORD_ in sip.conf to ensure they match the entries provisioned into the phone. also doublecheck in Asterisks console interface.

sip show users

good luck!

references

how-to

Setup Cisco 7941 or 7961 with Asterisk, en, 2009-10-22
Cisco IP Phones 79XX with Asterisk, en, 2011-11-25
Configure Cisco IP Phones with Asterisk using SIP, en, 2009-12-16
How to load SIP or SCCP on a Cisco 7940 7960 7941 7961 Ip Phone, en, 2011-02-16

SEP_MAC_.cnf.xml

Cisco’s latest 79×1 lineup, en, 2013-03-15
Cisco 7942 with local PBX, en, 2013-08-21
Cisco 7941 7942 7975 SIP Project with PFSense, en, 2012-03-18
Cisco 7942 configuration files, en, 2011-12-15

configuration

Complete Guide for configuring various Cisco 79XX IP Phones with Asterisk, en, 2014-03-14
How-To guide for Cisco 7945/7965/7970/7975/7941/7961, en, 2008-03-25

software/firmware

Cisco Unified IP Phone 7942G, en

lookup tables

System-Defined User and Network Locales, en
Time Zones, en

12 Comments

  1. Rishipal singh says

    HI Kommentar

    I have followed you steps . But we did not successed cisco phone 7942G with sip (asterisk)
    phone continure showing registering….
    thanks

    • Sergio Lora says

      Hello

      Was you be able for solve your issue with 7942 phone in registering state?

    • Maybe a little of a late reaction, but I had the same problem with the devices. This specific problem has to do with the codec which is used. Change the codec to for example:

      g722

      and make sure that this codec is enabled in Asterisk as well.

      That should do the trick!

  2. Michel says

    Hello,
    I am struggling since few days with the Error “ Protocol Application Invalid” on my Cisco 7940, just bought on the web .

    I understood that I have to upload/flash the “new” image but I have no clues on which one I already have in my 7940 and which one I should look for to upload.
    Could you please provide me with the right image ?
    if you are available I can call you or give you access to my Laptop.

    Many Thanks for your help & support.

    Michel

  3. bravo says

    Hi,

    Thanks for the great tutorial and the sample files. This is the most comprehensive set of instructions that I was able to find for 7942. I got most of it working, except that the audio codec g711ulaw/g711alaw used by phone is not recognized by Asterisk. On Asterisk end, it is ulaw/alaw. And this results in the error: “chan_sip.c: No audio format found to offer. Cancelling call to xxxxxxxxxx”.

    Can you please help me? Any pointer or workaround to try out will be appreciated.

    Thanks

    • bravo says

      I was able to get past this error by adding allow = ulaw in sip.conf entry for the phone. Thanks

  4. Oladapo Makanjuola says

    Hello there,
    I have 12 pcs of Cisco 7942g which have all been converted to SIP, i must say that your website has really opened my eyes. But which of the Asterisk ipbx box can u recommend that wil work seamlessly with these sets of CIsco box. Thanks

  5. Saulo Fraga says

    Good tuto.

    I have a question, its possible to 1013 checking me out the user name?

  6. Akhil says

    I am unable to do a “Conference” over the Cisco 7942 ie Joining 2 calls. I make a call, press conf, this places the call on hold I dial another call, the other party answers. Then press the Conf button again.

    It gives me error .

    Can you confirm if its working with the above load?

  7. Carlos says

    Hi.

    your tutorial is great, i need it for a fine tune of my already settings because with the new firmware ( i think its above 9 ) you need the USECALLMANAGER instead ip.
    What im looking for right now is the language pack. Do you have any idea how to get it? Because cisco web site isnt clear about this and i dont know which version of the JAR files do i need for spanish ( corresponding for the last firmware so far im writing this ).

    On the other hand, I suggest you to change the settings of Germany to default or state that if you change the default language in the xml, the jar files will be asked while upgrading via TFTP and therefore the phone will not register or give some weird errors. This is because the default is US ( i dont know why cisco dont want to share the other jars for customization, if you need it you need to have a contract or sort of ).

    Thanks.

  8. Sandip says

    I have also faced same kind of issue which Akhil faced.

    I am unable to do a “Conference” over the Cisco 7942 ie Joining 2 calls. I make a call, press conf, this places the call on hold I dial another call, the other party answers. Then press the Conf button again.

    Can you confirm if its working with the above load?

  9. I will add some more tips in my quest to get a 7942G working off Asterisk.

    1. Provide a firmware newer than the one on the phone – which you won’t be able to know if you haven’t connected it to anything, therefore use the latest release from Cisco. If it isn’t, it won’t reconfigure. Symptom: Repeated tftp access to term42.default.loads (twice in a row, repeated every three minutes or so).

    2. Use a short password. This is one that stumped the heck out of me until I found someone else griping about the same. 7 bytes works. Symptom: Asterisk sip set debug [ip-of-phone] will report e.g.

    SIP/2.0 401 Unauthorized
    Via: SIP/2.0/UDP 192.168.46.169:5060;branch=z9hG4bK18829dcb;received=192.168.46.169
    From: ;tag=bcf1f2e92cc0001800978936-b8f9f835
    To: ;tag=as43cedb51
    Call-ID: bcf1f2e9-2cc00018-9715a1d0-574c77df@192.168.46.169
    CSeq: 132 REGISTER
    Server: FPBX-12.0.76.4(11.13.1)
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
    Supported: replaces, timer
    WWW-Authenticate: Digest algorithm=MD5, realm=”asterisk”, nonce=”3e6a63fc”
    Content-Length: 0

Leave a Reply

Your email address will not be published. Required fields are marked *