If this page does not print out automatically, select Print from the File menu.

Dial A for advanced VoIP

Asterisk and Nokia’s N95 open up a whole new VoIP world

Nigel Whitfield, Personal Computer World 07 Aug 2007

While Apple’s iPhone may have grabbed all the headlines lately, for many, Nokia’s N95 is much more interesting.

For starters, it has 3G capabilities, plus it’s based on the Symbian operating system, with a wealth of third-party applications available. Then there’s the built-in GPS and Wifi connectivity.

However, one of the really interesting applications is Voice over IP (VoIP) telephony, using standards-based Sip (Session Initiation Protocol). The phone networks aren’t keen on it – Vodafone and Orange have removed the functionality from the handsets they sell – but with a little careful work you can put it back again and find even more uses for the N95. And that’s precisely what we’re going to demonstrate in this article.

What’s so great about VoIP?
The N95 isn’t the first mobile phone to have VoIP functionality built in, or the first to have Wifi. And thanks to the Symbian operating system, you can add third-party VoIP software such as Truphone to other handsets quite easily.

What makes the N95 special is that its integrated VoIP capability works with everything else fairly seamlessly. You can use the same address book, so you don’t have to enter caller’s details into a separate VoIP application, and you can just look up a number and choose whether to make a mobile or internet call.

Thanks to Wifi and cheap VoIP deals, the savings could be huge, especially when overseas. So it’s no great surprise that the mobile networks aren’t encouraging VoIP. Not only do the conditions for internet access in many contracts now exclude voice and instant messaging over 3G, but they’d rather you don’t use VoIP over Wifi – lest you cut into their profits – which is presumably why some of them have removed the facility from the firmware they ship on their branded N95s.

VoIP at home
VoIP doesn’t have to mean using your N95 at public hotspots, though. Many people have a wireless network at home and cordless Dect phones. Convergence has been much talked about over the years, where you can use the same handset on your landline or as a mobile phone (using a mobile network or VoIP over Wifi) when you’re out and about. But the N95 can do all these functions.

The key to all this is Asterisk, the open-source PBX (private branch exchange) software. Originally designed for Linux, it now runs on a variety of platforms. For the sake of simplicity, we’re going to use the 32-bit Windows version from www.asteriskwin32.com, so we can run it in the background on an existing PC. On its own, Asterisk can work with Sip phones – products such as the Grandstream Budgetone range, for example – or with software phones such as X-Lite, or with the Sip software in the N95.

Asterisk can route calls between the phones, giving you internal extensions, and use your broadband connection to make calls via a range of VoIP providers. With a suitable voice modem or telephony card in your PC, it can also link to your existing landline.

Getting started
Asterisk looks pretty complicated at first, but there’s quite a lot of information available at www.asterisk.org/support. You’ll find a link to download a book published by O’Reilly, Asterisk: The Future of Telephony, free of charge. It’s well worth a read as it has a lot of useful information about the concepts that underlay Asterisk. You’ll also find it on this month’s cover disc.

If you have an N95 from Orange or Vodafone, you’ll also need to update it with firmware that has not had the VoIP functionality removed. If you don’t see the ‘Internet tel’ application when you select Tools from the menu, then you’ll need to do this. But note that while we didn’t have any problems, it’s possible for this to go wrong and you could end up with a phone that needs to be restored – at your cost.

You may invalidate your warranty, too, or your network may refuse to replace a phone if you’ve changed from its firmware to Nokia’s generic version, so we can’t accept any responsibility. You have been warned, so read the fine print of your contract very carefully. If you have a Sim-free model, this doesn’t apply, of course.

We can say, however, that many people have done the firmware update without problems. You’ll find details on how to do it, and how to configure the Sip settings, in our walkthrough.

Asterisk will run in the background on any modest Windows system.

The software comes with a simple installer, and will detect Capi and Tapi telephony devices connected to your PC.

The latter are analogue, and if you have a full-duplex voice modem, there’s a good chance you’ll be able to use it to work with an analogue phone line, without needing to do any configuration. Capi is a similar interface, used for ISDN connections.

In our test configuration, we plugged the system into two phone lines – a standard BT line via a voice modem, and piggybacking on our small-office phone system via ISDN. We also have an account with Voiptalk, which provides Sip telephony and supports IAX, the Asterisk protocol for linking between exchanges.

Before you install Asterisk, install the Cygwin environment on your PC. Install it into C:\cygwin, then download the Asterisk for Windows installer. Make sure you tell it to use the same directory.

You can start using it out of the box, as the default configuration will let you connect a Sip phone to extension 3000. Start the PBX Manager application, click the Admin menu and supply a blank password. Then you can alter details such as passwords or voicemail settings via a basic graphical interface.

Configuring Asterisk
Now let’s look at tailored configuration using the N95 as a single phone to work with mobile, landline and VoIP calls when we’re at home. Configuration is done via text files, which will be in the asterisk/etc folder beneath the location where you installed Cygwin. The most important is called extensio ns.conf, and it’s here that the ‘dialplan’ is laid out, specifying what happens when different devices send specific sequences of numbers to Asterisk.

It’s divided into ‘contexts’, so an internal phone, such as our N95, might appear by default in the ‘internal’ context, from where you might choose a particular prefix to select the landline, just as you would in an office. An incoming line may be in another context and direct calls to a particular extension. You can also arrange for calls to be transferred, or data passed to programs on the PC, but that’s beyond the scope of this article and you’ll find plenty of details in the PDF book mentioned earlier.

For our setup, there are some extra configuration files: iax.conf controls calls via Asterisk’s own protocol, routed via Voiptalk, so we can benefit from cheap international calls; sip.conf is where we define the details that allow our N95 to connect to the system; capi.conf is for the ISDN line; and tapi.conf is for the analogue voice modems.

Let’s start with a look at sip.conf. It’s pretty simple to define settings that match those in our N95 walkthrough:

[nigel]

type=friend

secret=LetMeIn

qualify=yes

nat=no

host=dynamic

canreinvite=no

context=internal

The ‘secret’ line is the password, and the username we need on the phone is in the square brackets. The context tells Asterisk which part of the dial plan in extensions.conf to use when this phone tries to dial. In our capi.conf file, we tell the system about our ISDN line and that it’s running in MSN mode, where we have several numbers available. In the tapi.conf file – which is what most users will be using – you can modify the settings from the default supplied with Asterisk for Windows and choose how many rings before Asterisk answers.

You’ll probably also want to change the context for incoming calls.

That’s because next, in extensions.conf, we’re going to say that we want incoming calls to ring on our N95. Here’s how we do it for the ISDN line.

The PC appears to the other office phones as extension 33:

[capi-in]

; direct calls to Nigel’s N95

exten => 33,1,Dial(SIP/nigel)

exten => 33,2,Hangup()

So, when a call arrives in this context, the Asterisk Dial command is used to contact the Sip phone called ‘nigel’. When the call is finished, the next action takes place and the call is disconnected using the Hangup command. You can also specify alternative functions, such as diverts to voicemail. And if all calls in a context do the same, use ‘s’ instead. So, if we set the context for the modem to be ‘analogue-in’ we might have a section in extensions.conf saying:

[analogue-in]

exten => s,1,Dial(SIP/nigel)

exten => s,2,Hangup()

But what about calling out? Well, we said in the sip.conf file that our N95 was in the ‘internal’ context, so rules to help it dial out need to go there. We can start with a test:

[internal]

exten => 611,1,Answer()

exten => 611,2,Echo()

exten => 611,3,Hangup()

Now enter 611 on your N95, press Options and choose Internet call. You should hear your voice echoed back. Remember, as you make changes to the config files, you’ll need to tell Asterisk to reload them. The most reliable way is by exiting and restarting the Asterisk Win32 application.

Outgoing calls
We can add a rule in extensions.conf to say that any number beginning with ‘0’ is sent as an outside call, with a line like this:

exten => _0Z.,1,Dial(Capi/g1/${EXTEN})

The underscore signifies the start of a pattern. The rest means that if the number starts with a 0 followed by 1-9, and then more numbers, dial it using the Capi (ISDN) interface. For an analogue modem, change Capi to Tapi. But even more clever is this:

exten => _+44X.,1,Dial(Capi/g1/0${EXTEN:3})

It means that if you dial a number you’ve stored in your phone in international format, and the country code is 44 for the UK, Asterisk will dial a 0, and then strip off the first three digits, so +442073169000 becomes 020 7316 9000. With more of these rules, you can fine tune things, so international calls go via Voiptalk. For example, if your Voiptalk ID is 12348765, create an iax.conf file like this:

[voiptalk]

type=peer

username=12348754

secret=MyPassword

host=iax5.voiptalk.org

In the extensions.conf file, do this:

[international]

exten => _+X.,1,Dial(IAX2/12348765@voiptalk/${EXTEN:1})

A similar rule could match calls dialled with 00 instead of +. Putting rules in a section of their own helps, and you can then use ‘include’ to get them in the right order. ‘Emergency’ is a set of numbers we want to send via the BT line no matter what, such as 999 or 112. ‘National’ is our rule above for matching +44 numbers:

[internal]

include => emergency

include => national

include => international

Unfortunately, there’s not enough space to include our whole extensions.conf file here, but it is on this month’s cover disc in the ‘From the Mag’ section. In essence, any UK number, whether dialled with +44 or starting with a 0, is sent via the ISDN phone line, as are emergency calls or the speaking clock.

International numbers are sent to Voiptalk, as are four-digit numbers beginning 09, which are Voiptalk’s special numbers. We can force a call to use the analogue modem by dialling 9 followed by any number starting with 0. And if we want to force a call over the BT line no matter what, we prefix it with 1280, just as you would on a real phone.

Even so, it’s still a basic Asterisk configuration, without voicemail or other fancy features – which we hope to be able to return to later. Meanwhile, if you have an N95 or other phone with Sip, we hope we’ve given you a few ideas to help explore its potential.

www.whatpc.co.uk/2195730
This article was printed from the WhatPC? web site
© Incisive Media Ltd. 2008
Incisive Media Limited, Haymarket House, 28-29 Haymarket, London SW1Y 4RX, is a company registered in the United Kingdom with company registration number 04038503
Close this window to return to the website