Tuesday, September 15, 2009

Setting up your Nokia N95 with Asterisk

I've been playing around with the Internet Telephony settings on my Nokia N95 for some time now and since I've been spending a lot of time with Asterisk these days, I decided to set the phone up as an extension on the office Asterisk PBX.

Once it's set up, you can choose to dial a number as an Internet call as apposed to a voice call.
My dial plan is configured so that I can dial out from my phone using the office line by prefixing the number with a 9 and choosing Internet Call from the options menu.
I've even been able to conference an inbound call from the cellular network by dialing out via the office PBX over VoIP.
And since our PBX is on a static IP, I can get calls on my office extension as long as I'm in a WiFi zone. (Yeah.. I do get work calls at home now.. But atleast that's better than having to wait at the office for a con call while I could be chilling at home :))

Here's how it's done:

On your phone, Go to
Tools>Settings>Connection>Sip Settings>Options>New Sip Profile

Put the following settings in:
Profile Name - Asterisk (You'l use this later as your Internet Telephony profile)
Service Profile - IETF
Default Access Point - Select your WLAN Access Point
Public User Name - sip:<user>@:<ip address>
Use Compression - No
Registration - Always on
Use Security - No

Proxy Server -
Proxy Server Address - sip:<user>@<Asterisk box ip address>
Realm: ip address from your sip.conf realm setting
(If more than ip is specified in sip.conf, put
the full comma separated list)
User Name: User Name from your sip.conf file
(The name within [])
Password: Password from your sip.conf file
Allow loose routing: Yes
Transport Type: UDP
Port: 5060

Registrar Server -
Registrar Server IP Address - sip:
<Asterisk box ip address>
Realm:
ip address from your sip.conf realm setting
(If more than ip is specified in sip.conf, put
the full comma separated list)
User Name: User Name from your sip.conf file
(The name within [])
Password: Password from your sip.conf file
Transport Type: UDP
Port: 5060

Go to Tools>Settings>Internet tel>Options>New Profile
Put the following settings in:
Name: Enter a profile name
SIP Profile: Choose the profile that we just crated above.

This should do it.

Now goto Tools>Settings>Connection>Sip Settings>

The SIP Profile we created earlier should show up as "Registered"
If not, restart your phone a couple of times. That did it for me.

If your still having trouble, you can also debug the SIP messages on your Astyerisk CLI by typing SIP SET DEBUG ON. This should give you an idea of what's happening. SIP's such a nice protocol that way, plain text and easy to understand. My days of writing protocol stacks always come in handy when I'm stuck configiuring an IP phone at 3 in the morning :))

You should see a register message coming in from your phone and a 200 OK being sent back.
If you see a Not Found going back to the phone, check that the user you have set up your phone with is configured in sip.conf.
If you see an Unauthorized going back, check the password you are using.

BTW, I've heard that Nokia has had a change of heart in terms of providing built in VOIP on their phones.. The N95 is the last model that has this feature which is one reason that I'm never giving mine up.

P.S. I've been having problems with getting incomming calls if the handset is idle for more than five minutes... Could be something to do with the SIP Register timeout..