Showing posts with label VoIP. Show all posts
Showing posts with label VoIP. Show all posts

Tuesday, October 9, 2012

Cisco 7911G, SIP and Trixbox

I have seen a few people experiment with VoIP phones running over a HSMM-MESHÔ link and thought this could be an interesting experiment.  I have been thinking of experimenting with VoIP for a couple of years but never found a good reason to as I use my cellphone for just about everything.  I figured I would

One day searching through eBay a couple of weeks ago, I found an auction from a local electronics warehouse that was selling 16 Cisco 7911G phones for a price I couldn't pass up.  Cursory look on-line seemed that the configuration files were adequately documented so I started off on my journey.

I was looking for a entry-level Asterisk server program that I could load on an old laptop for testing.  Searching through the Internet, I found Trixbox - which is a self-contained Linux distro with Asterisk and FreePBX already installed.  Configuration is done through a web page interface - perfect for a Linux Padawan like myself.

Setting Trixbox to talk to my Polycom IP501 phone was extremely easy: went through the extension and phone setup pages and had everything configured in less than an hour thanks to YouTube videos and online tutorials.  Same thing with a softphone application on my Ubuntu desktop - Twinkle.  The Cisco phones, however, were not as easy....



Upgrading the phones to SIP firmware

Cisco has two different firmwares that you can load into the phone which will change it's behavior: SIP (Session  Initiated Protocol) and SCCP (Skinny Call Control Protocol).  SCCP is a proprietary protocol created and defined by Cisco, where SIP is a more open protocol and generally universal from what I've seen.  Since I don't know where this project will go in the long term, I'd rather not limit myself to one brand of phone or equipment so I decided to go with SIP.  Unfortunately the phones I bought were pulled from a business environment so it had SCCP firmware installed and needed to be changed.

Changing the firmware is a relatively easy task.  It involves having a tftp server on the network that serves the firmware files to the phone upon bootup.  After registering for a free account on the Cisco website, I was able to download the SIP9-3-1-1S firmware files and followed the instructions at this link to upgrade 7911 phones to SIP firmware:
http://lodge.glasgownet.com/tech/upgrade-a-cisco-7911-to-sip-firmware/




The configuration file

The Cisco 7911G phones use a XML file that gets loaded during bootup for all of it's settings and configuration.  This file sets things like the time and date format, the IP address of the VoIP server, the username and password for debugging and registration, etc.  This is where it started to get hairy.


My hope was that with Trixbox, I would just go through the same motions that I did with the Polycom phone and it would be a simple matter to get it working.  Boy, was I wrong.  Trixbox apparently has limited support for Cisco phones and does not have a default configuration for the 7911G phones.  Off to the Internet I went, hoping I could find a valid configuration file that someone had posted but came up empty handed.  I found a lot of forum posts that were similar to my situation but none of the configuration files worked.

After a week of trying different configuration files, settings, searching online and just as I was about to write the phones off and re-sell them on eBay, I finally found a configuration file that worked!



<device>
   <deviceProtocol>SIP</deviceProtocol>
   <sshUserId>user</sshUserId>
   <sshPassword>pass</sshPassword>
   <devicePool>
      <dateTimeSetting>
         <dateTemplate>D-M-YA</dateTemplate>
         <timeZone>New Zealand Standard/Daylight Time</timeZone>
         <ntps>
              <ntp>
                  <name>xx.xx.xx.xx</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>xx.xx.xx.xx</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--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>false</remotePartyID>
         <userInfo>None</userInfo>
      </sipStack>
      <autoAnswerTimer>1</autoAnswerTimer>
      <autoAnswerAltBehavior>false</autoAnswerAltBehavior>
      <autoAnswerOverride>true</autoAnswerOverride>
      <transferOnhookEnabled>false</transferOnhookEnabled>
      <enableVad>true</enableVad>
      <preferredCodec>g729a</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>Version 3</phoneLabel>
      <stutterMsgWaiting>2</stutterMsgWaiting>
      <callStats>false</callStats>
      <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
      <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
      <startMediaPort>16384</startMediaPort>
      <stopMediaPort>32766</stopMediaPort>
      <sipLines>
         <line button="1">
            <featureID>9</featureID>
            <featureLabel>6003</featureLabel>
            <proxy>USECALLMANAGER</proxy>
            <port>5060</port>
            <name>cisco1</name>
            <displayName>Cisco Phone 1</displayName>
            <autoAnswer>
               <autoAnswerEnabled>2</autoAnswerEnabled>
            </autoAnswer>
            <callWaiting>3</callWaiting>
            <authName>user</authName>
            <authPassword>pass</authPassword>
            <sharedLine>false</sharedLine>
            <messageWaitingLampPolicy>3</messageWaitingLampPolicy>
            <messagesNumber>1111</messagesNumber>
            <ringSettingIdle>4</ringSettingIdle>
            <ringSettingActive>5</ringSettingActive>
            <contact>cisco1</contact>
            <forwardCallInfoDisplay>
               <callerName>true</callerName>
               <callerNumber>false</callerNumber>
               <redirectedNumber>false</redirectedNumber>
               <dialedNumber>true</dialedNumber>
            </forwardCallInfoDisplay>
         </line>
         <line button="2">
            <featureID>21</featureID>
            <featureLabel>Dial 6004</featureLabel>
            <speedDialNumber>6004</speedDialNumber>
         </line>
      </sipLines>
      <voipControlPort>5060</voipControlPort>
      <dscpForAudio>184</dscpForAudio>
      <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
      <dialTemplate>DRdialplan.xml</dialTemplate>
   </sipProfile>
   <commonProfile>
      <phonePassword></phonePassword>
      <backgroundImageAccess>true</backgroundImageAccess>
      <callLogBlfEnabled>2</callLogBlfEnabled>
   </commonProfile>
   <loadInformation>SIP11.9-2-1S</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>
      <spanToPCPort>1</spanToPCPort>
      <loggingDisplay>1</loggingDisplay>
      <loadServer></loadServer>
   </vendorConfig>
   <versionStamp>1143565489-a3cbf294-7526-4c29-8791-c4fce4ce4c37</versionStamp>
   <networkLocale>New_Zealand</networkLocale>
   <networkLocaleInfo>
      <name>New_Zealand</name>
      <version>5.0(2)</version>
   </networkLocaleInfo>
   <deviceSecurityMode>1</deviceSecurityMode>
   <authenticationURL>http://mako/authenticate.php</authenticationURL>
   <directoryURL>http://mako/directory.xml</directoryURL>
   <idleURL></idleURL>
   <informationURL>http://mako/GetTelecasterHelpText.jsp</informationURL>
   <messagesURL></messagesURL>
   <proxyServerURL></proxyServerURL>
   <servicesURL>http://mako/services.xml</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>


From this base, make sure you change the appropriate values for your setup:
  • Change the timezone information to whatever you prefer
  • Change the <name> tag in the <sipLines> block.  It needs to be the same as the username
  • Change xx.xx.xx.xx to the IP address of the Trixbox server
  • Check all the URLs to make sure they align with the files hosted on the server
    • make a authentication script for the <authenticationURL> field
  • Change the <loadInformation> tag to match the firmware you have loaded in the phone
Go through the Cisco Phone setup, make an extension as usual and a 7940 phone.  Then go in and replace the XML file with this one.

Make sure on the Trixbox extensions to change nat=no and qualify=never -- somehow this was restricting the registration process and not allowing it to complete.



Ongoing work: 
  • Working on the NAT firewall and forwarding so that phones behind a HSMM-MESH nodes will be able to talk to the Trixbox server
  • Coming up with a directory scheme for users
  • connecting multiple Asterisk servers together for redundancy/load sharing?
  • What is the difference between Trixbox SEP.cnf file and one that works?


I hope this helps someone down the line.

Wednesday, July 11, 2012

VoIP on HSMM-MESH

Since working on a HSMM-MESH™ installation at Mercy Medical Center here in town has been thrown into neutral for the time being, I've been focusing my attention on playing with VoIP over the mesh.

A while ago I acquired a Polycom IP500 phone to play with and it has been interesting to say the least in getting it working.

First off, the phone requires a FTP or TFTP boot server on the network to pull the application software and configuration files at bootup.  After many trial and error sessions I finally got the phone to boot from a TFTP server on my desktop and can make SIP phone calls directly between my computer and the phone, no SIP server required (after finding out that the sip phone address is SPIP@<ip_address>).

The only logical progression is to move the TFTP server from my computer to the HSMM-MESH™ router that the phone is plugged in to so I don't have to have a computer running to get the phone booted.  Of course, nothing is that simple.  Much consternation ensued again until I stumbled onto a forum post advising that apparently there is a bug in the Kamikaze 7.09 OpenWRT firmware that a dependency package for atftpd, libreadline, is not in the 7.09 repository so you have to install it manually from an earlier repository.  Easily done by executing the following command before installing atftpd:
ipkg install http://downloads.openwrt.org/kamikaze/7.06/brcm47xx-2.6/packages/libreadline_5.1-1_mipsel.ipk


The next goal will be to move the Polycom to a separate mesh node and try to make a call over the mesh.


Relevant links:
http://support.polycom.com/PolycomService/support/us/support/voice/soundpoint_ip/soundpoint_ip500.html

https://forum.openwrt.org/viewtopic.php?id=8495


ToTD: It would probably be a good idea to start keeping copies of any downloaded packages on a flash drive.  Never know when I'll have to do field work on this project without access to the Internet.