Guest Post: Asterisk Brings You Home

June 27, 2008 by Garrett Smith

Being far away from home for a long period of time is a trying experience; leaving your life behind and relocating away from your support systems – family and friends – is even more so. The first three months of living in Silicon Valley after moving here from Israel could easily be the toughest I ever had, and frequent phone calls with the people I left behind were a considerable part of the coping process. Being able to make them relatively cheap helps too.

Most people think of a VoIP phone service as something that parallels a traditional phone: You hook up with a provider who gives you a phone number, people call you on your phone, and you call people on their phone. As simple as it sounds, this service is actually comprised of two different services:


A service that you supply with a phone number in the PSTN (Public Switched Telephone Network) and the service takes care of “Terminating” the call at the destination number. That term might be more intuitive if you figure that a phone call has an origin point and a termination point – you originate the call and the service terminates it for you.

There are different termination services around, some terminate locally for a country, and some are global and are called A-Z services, after the alphabetized list of destination countries. Prices and plans vary, and it’s relatively easy to shop around on-line. If you have an Asterisk PBX, the easiest to hook with are those that offer IAX2 connectivity, although Asterisk will deal with SIP termination just fine.

DID – Direct Inward Dialing

This slightly anachronistic name is basically the opposite service.

The DID service provider provides you with a phone number, which in the PSTN network routes to that provider. Whenever someone calls the number, the DID provider relays the call signaling information and (if you pick up) the call audio data to your PBX. Again, the easiest way is IAX2 when your PBX is Asterisk.

Like termination service providers, DID providers vary in their offering and pricing. Some provide numbers in specific countries, and some are more or less global.

Some providers like Vonage provide both services seamlessly.

So the first order of things was to give myself the ability to call Israel. I’ve set up an Astrix server, which was relatively painless on the Ubuntu distribution I was using at the time at home – Asterisk comes as a set of packages. I chose a termination provider, opened an account, put some funds in it, and I was set. A little Asterisk hacking and I was able to make calls world-wide from my soft-phone on my laptop. Very cool. This setup alone, took me – an Asterisk newbie at the time – around a day’s work.

The next step was to inbound calls for my Asterisk box. The primary reason for that was my parents. While the price of international calls has fallen down dramatically, my parents still have the psychological barrier for “calling abroad”, set back in the days when a minute on the phone from Israel to the US cost around $1, which it was in the early 1980s. Although it is about 10 times cheaper today, my parents would simply not call.

Luckily, I found an international DID provider that gave me a phone number in Israel for a low flat monthly rate. Setting it up to receive calls was a breeze, and I was up and running in no time. Empirically it has increased the number of calls I get from my parents dramatically, just because of the convenience of dialing a local number.

So far I was placing and receiving calls on my laptop using my soft-phone. This setup has some limitations when placing calls, but receiving calls means that I’m unavailable when I am away from my computer. Now if only I could route them to my cell phone… throw in another couple hours, mostly spent browsing through the Asterisk documentation, and my cell phone and soft-phone ring in tandem. I’ve used my international termination provider to dial my cell phone US number; the rate is reasonable and the convenience is worth it.

Now that I was receiving the calls on my cell phone, I wanted to make those international phone calls to Israel using my cell phone too. To facilitate that I checked my DID provider’s web site. Sure enough, it will sell me a DID in the US. Then off to my Asterisk again, where very little scripting makes sure that I can make calls calling my US DID only when the caller ID matches my cell phone. Being somewhat paranoid, I added a PIN on top of that.

The system is easily extensible. When a friend of mine moved to France, I added a French DID, allowing him to call me on a Paris number. This has resulted in a few telemarketing calls, which seem to come from a certain called ID. Calls from that number get Asterisk’s chirping monkeys these days and fail to ring my phone. When I move to Australia in a month, I plan to have a DID there, and route my calls to my Australian cell phone.

Another problem with having DIDs in different time-zones is calls in the middle of the night from people who just don’t realize where you are. My plan to deal with that is to set up a recording announcing (in the language appropriate to the DID) that I might be sleeping and that the caller should reconsider. I’m sure there’s some way to make it play only on the hours of the day that are night at my locale.

Finally, hosting the system at my home is relatively unreliable, especially when I download a big file. A tiny hosted VPS (Virtual Private Server) is enough to keep my Asterisk running in a reliable high-bandwidth environment. My VPS has 2.5GB of disk space, 64MB of RAM and a dedicated IP address. For Asterisk – that’s plenty, and it costs very little.


  • Nasser

    Thanks Arik for the inspiring article. I have been dreaming for longtime now of installing Asterisk for a calling card business purpose. What do you think of Asterisk for this purpose. What harwares do you think I would need. Last, but not least, would virtual dedicated server hosting account be enough or I will have to go with Dedicated Servers hosting account. I would also appreciate if you tell me who you would recommend for hosting my asteris.


  • Fun stuff! I’m looking to experiment with Asterisk in similar ways. Its amazing how accessible this level of functionality is now.

    On a similar note (but not as sophisticated as what you’ve done with Asterisk), I recently realized how easy it would be to roll your own VoIP home phone service (I had no idea all the pieces were so readily available). Now I’m using it instead of Vonage. I wrote up the details here:

  • Hello ya Nasser,

    I didn’t quite understand – do you want this setup for your own business or to set up a calling card business?

    Either case, I’m the sole user of my setup. The virtual machine mentioned runs ONLY asterisk, and for me it’s enough, even with protocol re-encoding. I don’t have the sizing experience to tell you about your setup – I suggest you test it out and decide.

    My VPS provider is VPSLink at – I don’t get money from them to say that I found their service reliable and convenient to use. I use their cheapest deal. That’s all I can say – I never tested their stronger machines or dedicated server. Shop around, they’re not the only game in town.

    — Arik

  • Hello Scotty,

    I read your article; cool setup. When phone routing is a technology that can be used by mere mortals, the sky is the limit! 🙂

    — Arik

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Featured Posts

  • Popular Posts

  • Read Our Feed

  • Latest

  • VoIP Post Categories

  • Archives