Integrating Asterisk with Wireless Technologies: Part 2

Exclusive offer: get 50% off this eBook here
Asterisk 1.4 – the Professional’s Guide

Asterisk 1.4 – the Professional’s Guide — Save 50%

Implementing, Administering, and Consulting on Commercial IP Telephony Solutions

$26.99    $13.50
by Colman Carpenter David Duffett Ian Plain Nik Middleton | August 2009 | Linux Servers Networking & Telephony Open Source

Read Part One of Integrating Asterisk with Wireless Technologies here.

Configuring wireless devices

Each device will have its own user interface-either through the display on the device (if it's a phone) or through a web interface that you can browse to (some Wi-Fi phones will have both).

The actual entries used for setting up the device to work with Asterisk are standard SIP parameters like username, password, host, and so on, and therefore, the next screenshot has been included (taken from the Siemens S460IP phone) as an example:

 Asterisk 1.4 – the Professional’s Guide

What is worth looking into in more detail are the Nokia dual-mode phones, as there are a couple of parameters necessary for successful connection with Asterisk, which are not as widely known as they should be. These "lesser known" parameters are responsible for many people giving up on connecting their devices to Asterisk.

I will use the Nokia E90 as an example:

Most of the parameters are self explanatory, but the two parameters we pay special attention to are the Public user name in the SIP profile itself, and the Realm in the submenus for both the Proxy server and the Registrar server. Further in this section, some screenshots of each of the screens you will need to go through to set up your Nokia phone as an extension on your Asterisk PBX have been included.

Start by selecting the Connection in the Settings screen:

 Asterisk 1.4 – the Professional’s Guide

Then select SIP settings:

 Asterisk 1.4 – the Professional’s Guide

Select or create the relevant SIP profile from the submenu:

 Asterisk 1.4 – the Professional’s Guide

Inside the SIP profile, complete the settings—the Public user name must be the SIP profile name (from sip.conf)@

 Asterisk 1.4 – the Professional’s Guide

Now move down to the Proxy server and Registrar server sections:

 Asterisk 1.4 – the Professional’s Guide

It is here that the all-important Realm must be entered—Asterisk sets this as "asterisk" by default, but you can change it in the [general] section of sip.conf.

 Asterisk 1.4 – the Professional’s Guide

The Registrar server screen needs to be the same as the previous one:

 Asterisk 1.4 – the Professional’s Guide

Although the IP address used (see preceding screenshot) is internal, it could equally be an Internet IP address such as

Note that the Realm is defined in the [general] section of sip.conf by the realm= line. If this line is missing, then the realm will default to "asterisk".

Asterisk 1.4 – the Professional’s Guide Implementing, Administering, and Consulting on Commercial IP Telephony Solutions
Published: August 2009
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

Configuring Asterisk to work with wireless technologies

This is going to be quite a short section. It is very easy to configure Asterisk to integrate with most wireless devices because they are just standard SIP devices; you don't need to learn any new stuff!

If you plan to use any devices (including wireless) outside of your own network domain, which will be true for a lot of cases, you will need to tell the Asterisk SIP channel about this—in terms of the NAT (Network address translation) arrangement and your external IP address.

Before we do that, here is a diagram to show why this is necessary.

 Asterisk 1.4 – the Professional’s Guide

Taking the Asterisk side of the diagram, the internal domain is 192.168.1.X, but the address our broadband router (or whatever) uses on the outside (the Internet) is different. This address is provided by our ISP.

We need to tell Asterisk about this, so that it recognizes both the internal addresses and the external address in the transactions it handles.

Here is how this is done in sip.conf:

context = default
realm = asterisk
externip =
localnet =

The key lines are the externip line (telling Asterisk the Internet IP address) and the localnet line (telling Asterisk the internal address range).

If you have a resolvable URL and access to DNS, then you can use externhost instead, for example,

Once you have let Asterisk know this information in the [general] section, then you just need to identify the individual endpoint(s) that will be used on the other side of the NAT on the right (which is your mobile or remote devices) by using the nat= line in their SIP profiles.


The nat=yes line tells Asterisk to disregard the internal (192.168.2.x) address the remote device will give during SIP interactions in favor of the external ( address by which the device will be recognized on the Internet. You will notice that, in addition to the nat=yes line, I have also included a qualify=yes line. This line tells Asterisk to periodically check with the device to ensure it is on the network. By using a figure (for example, qualify=200) instead of yes, we can instruct Asterisk not only to check on the device, but also to treat it as unavailable if the latency between it and Asterisk goes above 200 ms (in this case).

Deployment choices

The type of devices or combination of devices you choose for a particular implementation will depend on a number of factors and each job will be different, but I thought it would be useful to look at a few deployment scenarios together with the kind of device which may be best suited for them.

  • Office only
    • SIP/DECT (range, battery life, speech quality)
  • Mobile
    • Wi-Fi (only) if no 3G/GSM requirement
    • Dual-mode (for example, SIP client on all Nokia E phones)
    • PDA with SIP or IAX soft client
  • Remote
    • Laptop with SIP or IAX soft client
  • Least Cost Routing (mobile calls over the mobile network)
    • Gateway box
      • Easy SIP integration
      • No worries about "slot" compatibility
      • A range of boxes, easy to scale  
    • Gateway card
      • Neat—no other boxes or PSUs
      • up to four SIMs per card
  • Redundancy (successfully routing calls in the event of a landline failure)
    • Gateway box

Neat money saving tricks

Just before we end this article with a summary,it would be useful toshow you a couple of money saving tricks, which all fall under the category ofleast cost routing (or LCR), but are perhaps a little more creative.

Calling a mobile phone

If you have a dual-mode phone as an extension of Asterisk, always try to route the call over SIP first (in case the handset is within Wi-Fi coverage), even if the caller dials the standard mobile number. Then, if you do need to route the call to the mobile network, do it directly with a GSM gateway. When that fails, if you must govia the fixed network, can you route the call via an alternative carrier to reduce the cost of the call? Only after you have tried those, would you look to route the call in the "normal" way.

In the UK-based example that follows, the number starting with "077" is the standard mobile number, and there is a carrier called "18185" (, which,at the time of writing, provided the cheapest way to call a UK mobile phone from a UK fixed line. This dual-mode phone is also set up as endpoint 2001 of your Asterisk PBX.

Here is what your dialplan might look like:

exten => 07711223344,1,Dial(SIP/2001,30)
exten => 07711223344,n(gsm-gateway),Dial(SIP/gsm-gateway/${EXTEN})
exten => 07711223344,n(alternative),Dial(DAHDI/1/18185${EXTEN})
exten => 07711223344,n(pstn),Dial(DAHDI/1/${EXTEN})

Avoiding those nasty roaming charges that arise from receiving calls

One of the worst kinds of roaming charges (other than mobile data roaming, which seems to attract the mother of all sky-high rates), are the charges you incur when receiving calls while you are travelling out of your home country.

Different countries have different mobile charging plans, so the following example may not directly apply to your scenario, but you will see the principle, and you may be able to use it in some other way.

In the UK, there is no charge for receiving a voice call on your mobile phone in your home network, but the high level of the charges for receiving a call while abroad (when you pay for the international leg of the call) can only be described as wicked! Let's take a situation where someone from the UK is going on a two-week business trip to the US. They either have a dual-mode phone or soft client (on a laptop or PDA), which is set up as SIP endpoint 2005. Knowing that receiving calls over GSM is going to be very expensive, they take the SIM out of their phone and put it into a GSM gateway connected to their Asterisk PBX in the UK. Now, all they have to do is try to call their SIP extension when a call comes in on their mobile SIM, and, wonder of wonders, NO roaming charges!

Of course, this system does rely on them being in a Wi-Fi hotspot, with their dual-mode phone or soft client ready to take the call. If they are not, we could send the call to voicemail so that they can collect it later. Or we could also call the US number that they are available on (their hotel or office, or a US pay-as-you-go mobile)—as calls to the US from the UK are pretty cheap, especially over a SIP trunk provider. Here is the example dialplan (assuming that the SIP call coming in from the GSM gateway gets dropped into the [from-my-sim] context with extension s):

exten => s,1,Dial(SIP/2005&SIP/my-trunk/0012564286000,20)
exten => s,n,VoiceMail(2005@default)


The main thrust of this article was to acquaint you with the many options that exist to connect Asterisk with the wireless world.

The main options for handsets are Wi-Fi (only), wireless-enabled desk phones, dual-mode phones, and SIP/DECT setups.

We can connect Asterisk to wireless networks like the GSM network by using a gateway box or a GSM card installed in the Asterisk platform itself, similar options may be available for CDMA networks and others.

Armed with this knowledge, and the power and flexibility of the Asterisk dialplan, you can now be very creative—not just in terms of least cost routing, but in tailoring the perfect solution for your customer for any scenario. The limitations are few and the possibilities are great, so go for it!

Asterisk 1.4 – the Professional’s Guide Implementing, Administering, and Consulting on Commercial IP Telephony Solutions
Published: August 2009
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

About the Author :

Colman Carpenter

Colman Carpenter is the MD of Voicespan, a Kent-based company that offers Asterisk-based systems to the SME market across the UK. He is an IT professional of over 20 years standing, with experience in diverse areas such as IBM mid-range software development, Lotus Notes and Domino consultancy, Data Management, E-marketing consultancy, IT Management, Project Management, Wordpress Website Design, and lately, Asterisk consultancy. He is a qualified PRINCE2 practitioner.

Voicespan ( offers Asterisk-based systems as the cornerstone of a holistic VoIP-telephony service for SMEs. They offer companies a one-stop shop for implementing a VoIP-capable system, encompassing Asterisk-based systems, endpoints, trunks, telephony interfaces and network equipment, and the consultancy necessary to bring it all together into a coherent whole. This is his first book.

David Duffett

David Duffett delivers Asterisk training and consultancy around the world through his own company (TeleSpeak Limited,, in addition to designing and delivering training for a number of companies, including Digium, Inc.

A keen Asterisk enthusiast, David also enjoys podcasting, radio presenting, and teaching public-speaking skills. He is a Chartered Engineer with experience in fields including Air Traffic Control communications, Wireless Local Loop, Mobile Networks, VoIP, and Asterisk. David has been in the telecoms sector for nearly 20 years and has had a number of computer telephony, VoIP, and Asterisk articles published through various industry publications and web sites.

Ian Plain

Ian Plain has worked in the telecoms industry since 1981 and has designed some of the largest PBX networks in the UK. Since the late 1990s, he has been involved with VoIP initially for links between systems, and with IP PBX systems since 1999. Since 2003, he has been running a telecoms consultancy based near Bath in the UK, working primarily on high-availability Asterisk-based solutions for corporate customers.

Nik Middleton

Nik Middleton has been in wide-area communications since the mid-eighties. He spent most of the nineties working in the US, where he developed a shareware Microsoft mail to SMTP/POP3 connector that sold some 287,000 copies. He spent six years working for DuPont in VA, developing remote monitoring systems for their global Lycra business. In late 2000, he returned to the UK where he held various senior positions in British Telecom, LogicaCMG, and Computer Science Corp.

In 2005, tired of working in London, he set up his own company (Noble Solutions) providing VoIP solutions in rural Devon, where he now lives with his wife Georgina and three children, Mathew, Vicky, and Isabel. A keen amateur pilot, his favorite place when not in the office is flying over the beautiful Devon countryside.

Books From Packt


Scratch 1.4: Beginner’s Guide
Scratch 1.4: Beginner’s Guide

Drools JBoss Rules 5.0 Developer's Guide
Drools JBoss Rules 5.0 Developer's Guide

Cacti 0.8 Network Monitoring
Cacti 0.8 Network Monitoring

Building Enterprise Ready Telephony Systems with sipXecs 4.0
Building Enterprise Ready Telephony Systems with sipXecs 4.0

Plone 3 Theming
Plone 3 Theming

Asterisk Gateway Interface 1.4 and 1.6 Programming
Asterisk Gateway Interface 1.4 and 1.6 Programming

trixbox CE 2.6
    trixbox CE 2.6



Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software