Integrating Asterisk with Wireless Technologies: Part 2

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".

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!

You've been reading an excerpt of:

Asterisk 1.4 - The Professional's Guide

Explore Title