Tuesday, April 21, 2009

Asterisk PBX System Install - 05 Cisco SIP Phone

Issue:
We have Cisco phones and need to load the SIP protocol on them and test Asterisk.

Quick/Visual/Learning:
The Cisco phones come loaded with the Cisco proprietary SKINNY protocol loaded. Asterisk apparently does support SKINNY but has better support for SIP. To load SIP on the phone we need to get the SIP files and use a TFTP server to load them.

Here is a link to information that may be helpful if you have problems.
Another good link. And antoher.

If you have access to Cisco support you can get the sip files from them. I got my files from a phone vendor when we were looking at converting our phones over to another sip based phone system.

Once SIP is loaded you are not required to have the TFTP server as you can manually configure the phone but TFTP and DHCP can help to automate the process where there are a lot of changes going on.

For the TFTP server I am going to use TFTPD32, which is an open source TFTP server that runs on windows. It is very easy to use and includes a DHCP server, which allow you to automatically configure the TFTP server settings. You can download it here

Note - If you want to run it all on the Linux CentOS box you can look in the book in chapter 4. There is a section on configuring Cisco 7960 Telephone that tells you how to install and configure a tftp-server. Remember to put the MAC addresses in ALL CAPS.cnf

I will load my downloaded TFTP server on a laptop and plug both the phone and the laptop running TFTP server into my test switch that is not on the network.

OK after you have downloaded the TFTP and put it on a windows machine it is time to configure it. Run the install program. Click Next







Except the default TFTP directory location (or change it if you like). Click Install
When it completes click close.



Put SIP configuration files from Cisco in the TFTP server directory (c:\program files\tftpd32 in my case).
The files I am putting in there from Cisco are (not sure if they are all needed):
P003-07-5-00.bin
P003-07-5-00.sbn
P0S3-07-5-00.bin
P0S3-07-5-00.loads
P0S3-07-5-00.sb2

Start the TFTP server.
In my case I go the start menu and start the TFTPD32 application.

On the TFTP Server Tab I can see the interface and it should be on the same subnet as your Asterisk Server (my example 172.17.X.X).




On the DHCP tab I give it a starting address to hand out to the phones and a pool size. I set it to 10 in this case.

Another important thing to notice here is in the Additional Option settings. Option 66 is the DHCP option that assigns a default tftp server. Here I set the default tftp server to be this one that I am configuring. The window is not big enough to show the whole IP address but it is the same as what is above in the server interface window. This is what tells the phone where to go to find the new configuration files so this is quite important.






At the bottom of the screen click on the setting button. Uncheck the DHCP box to “Ping Address before assignment”. This seems to cause a strange issue where DHCP fills up with requests from the MAC address 46-46-3A-46-46-3A (46:46:3A:46:46:3A 46463A46463A). I think this may be a bug with TFTPD32.




Click on the save button and leave the server up and running.

There are a couple of files that I need to create as well with a text editor (I will use notepad). These text files go into the root of the TFTP server directory as well.

First I need to get the hard coded address of the phone I will be configuring.
Plug an Ethernet cable into the 10/100 sw port on the back of the phone (if you use the wrong port it will not power up). Plug the phone into the Cisco switch. The switch provides power over Ethernet (POE) to power up the phone. Once the screen comes on you will see it trying to configure itself (never ending loop). Press the button with a check mark inside a square on it. See the picture below which points out the button.







This will bring up a setting screen.

Select the Network Configuration option and scroll down to see the MAC Address of the phone and write it down. It will be a 12 digit hexadecimal number that looks like this example here – 000d:28f3:5928

Now we need to configure a configuration file for the Phone:
Using Notepad create a file in this format: SIPMacAddress.cnf

For my example the file will be called SIP000d28f35928.cnf (SIP and address without the colons)

Note here that windows thinks that files that end in .cnf are SpeedDial files and you can not open them by browsing to them in Windows Explorer and opening them. You need to open notepad first and select to see all files and pick the .cnf file that way. Very annoying.

When you save these files in Notepad the first time put the name in "" otherwise it may save as a .txt file which is not what we want. I know, what a pain, if you have a better editor handy feel free to use that one instead.

Here is the contents of my SIP000d228f35928.cnf file:
###############
# Line 1 Setting
line1_name:207
line1_shortname:207
line1_displayname:207
line1_authname:207
#line1_password:takeaguess
################

The name 207 has to be the same name that is in my sip.conf file on the Asterisk server (see previous post). I have made all these names the same as the extension of phone 207.

Note that # indicates when a line is just a comment field and right now I have the password commented out for now.

Another text file for the tftp root directory is SIPDefault.cnf and here is what is contains:
###########################
#Image Version
image_version:POS3-07-5-00 ;

#Proxy Server (this is the ip address of our Asterisk server)
proxy1_address: 172.17.1.31

#Message button assignment to extension 500
messagees_uri: “500”

#Time server ip and time zone settings
sntp_server: 172.22.1.30
time_zone: PST

#Template for phone dialing plan
dial_template: DIALPLAN
###################################
Here is a link to information about what you can put in the SIPDefault.cnf file

While we are at it, another text file to be configured is the DIALPLAN.xml file. This is the file that you see in the dial_template entry above. I still have problems putting code in the blog sometimes so here is a picture of the text in the DIALPLAN.xml file:



Update:
I found out that dial tone is provided by the SIP phone and n0t by Asterisk so you can not use ignorpat => 9 (as mentioned in the book) to keep the dial tone after pressing 9. To get dial tone to continue after pressing 9 you need to add a coma after the nine in this DIALPLAN.xml file:
"9,1.........."TIMEOUT="0" /
"9,......."TIMEOUT="0" /

Without this file the phone will wait a long time before trying to dial the numbers you enter.
This xml file tells the phone to not wait before dialing a 3-digit extension starting with a 2.
Also does not wait on 500, which will be our voicemail number, and numbers that we will later use for dialing outside numbers.

This gets saved into the root of our TFTP server as well.

One last file that needs to be there is a very small text file called "OS79XX.txt". The name should be just as you see it. OS79 followed by 2 Xs .txt.
In that file is a single line:
P003-07-5-00

This tells the phone what version of the .bin and .sbn files to load.

With the TFTP server running and plugged into my Cisco switch, I again plug my phone into the Cisco switch.

Now the phone configures itself. It takes a couple minutes so be patient but it should now load SIP.

When it is done the screen will display the name of the phone and SIP in the upper right corner (example 207SIP)

You can press the CheckMark button you used above and check that it is configured correctly.

Under Network Setup:
DHCP server should point to the one running on our tftp server (example 172.17.1.40)
IP Address should be in the range we assigned to the DHCP server pool above. (example 172.17.1.50)
Mask should be what was set on the DHCP server (example 255.255.0.0)
And the TFTP server should point to the one we configured. (example 172.17.1.40)

On phone as well we can get out of network configuration and look at SIP Configuration and should see under Line 1 Settings:
Names are all set to be the extension (example 207)
Proxy Address is pointing to our Asterisk server (example 172.17.1.31)

Note if you need or want to change any of the settings on the phone manually you will first need to unlock it. Press the check button, and scroll down to the bottom and select "Unlock Config". Use the phone keys to enter the password which is the word cisco.
With skinny loaded on the phone the proceedure is:
Enter the Settings Menu
Select Network Configuration
Enter **# to unlock configuration
Make changes
Enter **# to lock


With all the parts running and plugged into the switch:
-Asterisk server
-Phone
-TFTP Server

Make sure that the devices can see each other.
On the Asterisk server ping the phone using the ip address you saw in the configuration (from the DHCP server)
Using my example
#ping 172.17.1.50

You should see reply messages start to scroll up the screen.
If you see Destination unreachable messages scroll up the screen then asterisk cannot see the phone yet. Verify that Asterisk is on the switch and maybe restart the network services on the server as was discussed in the previous post.

Use CNTRL-C keys to break out of the ping

If the pings worked you should now be able to call extension 401 from the phone. 401 will not dial right away because we did not set that one up in the DIALPLAN.xml file above. If you wait long enough it will dial or you can press the DIAL soft button (third one from the left at the bottom of the phone display).

If all is working Asterisk should playback a message that “weasels have eaten the phone system”. If you got that then congratulations everything is working so far.

Next time we will work on the Asterisk configuration some more.
Asterisk PBX System Install - 06 Two SIP Phones

Asterisk PBX Install - Index

2 comments:

Unknown said...

Dear suppose we have two dns servers.When IP will assign automatically to device. Then tftpd32 add additional dns also.

VoIP PBX Express said...

It's really very Nice blog. Thanks for promoting. Click on the below links to know more about Voip phone systems.

voip phone system

best small business pbx

small business phone system

IP PBX

telephone systems for small business


office phone systems

phone systems for small business

business phone systems

cisco phone system

pbx phone system