Personal VOIP/PBX using Asterisk, part 1


Voice over IP is simply placing phone calls over the Internet instead of  traditional phone lines. This means the calls are usually cheaper, but not free in many cases since often the telco lines have to get involved at some point to either originate or terminate a call. However, true voip calls are almost always free, no matter where in the world they are.

There are many commercial products out there already that makes this easy for a user, like Vonage and Comcast’s voice, but they have fairly hefty monthly fees. They do usually offer unlimited domestic (U.S.) calls.   But they also have drawbacks, like, ah not working if the power or cable goes out.

The next few posts will document my experience in rolling my own voip service.

Part 1 is compiling the support drivers on my “Linode” for Asterisk.

Click through for the details…

Reference Links

Roll your own VOIP

Instead of going the commercial route, I’m going to roll my own voip service. With roll-your-own you usually pay a per-minute charge to terminate a call to a land-line, but at only a penny or two a minute, you’d have to make a few thousand minutes of calls a month to cost more than a commercial voip service. It’ll also be far more flexible, and hence far more complicated to set up.

To do this I need four main building blocks.

  1. A server. I am adding it to my existing Linode. Linode is a VPS (virtual private server) provider. I use them for many things, including hosting this blog.
  2. Askterisk. An open source PBX software solution that has more features and capabilities than most commercial PBX systems costing hundreds of thousands of dollars. Yeah, it’ll be cool!
  3. A VOIP router for the house. I purchased a Cisco/Linksys SPA3102
  4. A provider to complete calls to landline phones and optional to provide a dial-in number to your PBX. I have been using Gizmo5 for a few years now, and already have a few dial-in numbers so going to attempt to marry that into this set up.


The first step is to install and configure Asterisk. Not for the faint of heart, but neither is any of this. Fortunately for me, Pat Hennessy, who also owns a Linode, has already done this and save me a lot of work. Also helpful is a copy of the Asterisk book by O’Reilly, which is actually free to download on their site (or was when I wrote this)

My distro is Centos 5, so this assumes that. I had to install some packages referenced in table 3-1 of above book first. I also decided to use Asterisk 1.6 instead of 1.4 which the book is written for.

Asterisk can require a few packages to operate, like dahdi (which used to be called zaptel and is still referenced in many docs as zaptel).  Dahdi on Linode requires some kernel mods, which is well documented on a blog post by Pat Hennessy.  The step below is from the script on Pat’s site.

  • (For Linode’s only) download kernel source that matches running kernel from Linode’s site to /tmp
  • mkdir /usr/src/kernel; cd /usr/src/kernel
    tar xjvf /tmp/`uname -r`.tar.bz2
    cd /lib/modules/`uname -r`
    ln -s /usr/src/kernel/`uname -r` build 
    cd /usr/src/kernel/`uname -r`
  • And that’s it, ready to compile dahdi. Loads of hours of hassle saved thanks to Pat!

Compiling dahdi was uneventul. Just ran make. However, to see what exactly dahdi was going to install everywhere, I tested it by mk’ing a /tmp/dahdi directory and then as root did a “make install DESTDIR=/tmp/dahdi” first. After that I did a “make install” as root.

Next step, compile and install the dahdi-tools package and finally make config. Look carefully for any errors. I had to install gtk+-devel, for example.

After make config, it warns you to edit /etc/dahdi/modules so only modules for hardware used is installed. Since there is no hardware on the linode for this, all are commented out.

Now to test. No need to reboot. Simply “service dahdi start”

# service dahdi start
Loading DAHDI hardware modules:

No hardware timing source found in /proc/dahdi, loading dahdi_dummy
Running dahdi_cfg:                                         [  OK  ]
# lsmod
Module                  Size  Used by
dahdi_dummy             5332  0
dahdi                 196904  1 dahdi_dummy

Piece of cake, thanks to Pat blazing the trail!

Next steps in another blog post (in a few days hopefully) will be compiling Asterisk and linking it up to be used with my Gizmo5 dial-out — and maybe dial-in services! After that, fun with the ATA adapter for my home.

Update 19 Jan 09: OK, this is bizarre. I rebooted my linode and dahdi modules would not load due to a version mismatch. 

FATAL: Error inserting dahdi (/lib/modules/2.6.28-linode15/dahdi/dahdi.ko): Invalid module format

OK, not unexpected since the version of gcc I used most likely differed from the version linode used to compile the kernel. BUT WHY DID IT WORK THE FIRST TIME? So the fix was to edit the /etc/init.d/dahdi startup script and find places where modprobe is used to load dahdi and dahdi_dummy and add a -f flag to it.    Bizarre.


8 thoughts on “Personal VOIP/PBX using Asterisk, part 1”


    1. No matter if you host your own Asterisk PBX, use someone else’s VOIP gateway services, or rig your own using a PTSN-VOIP gateway hardware device, you’re going to have to pay someone if it lands onto the traditional phone system.

  2. Hello,

    I was able to set up Asterisk on my Linode VPS thanks to your tips.

    Thank you very much!!!!

  3. You sir are a man of honour. Thanks for the tips and detail regarding this linode issue. Been driving me nuts for 2 days (well.. all 15 min. of time i spent researching.. lol).

    I hope it works with channel mixing now..

  4. This all solved some of my issue son but seem to encounter another:

    service dahdi start

    xpp_usb: FATAL: Module xpp_usb not found.

    /usr/share/dahdi/waitfor_xpds: Missing astribank_is_starting
    No hardware timing source found in /proc/dahdi, loading dahdi_dummy
    Running dahdi_cfg: Notice: Configuration file is /etc/dahdi/system.conf
    line 0: Unable to open master device ‘/dev/dahdi/ctl’

    My kernel is Linux (CentOS 5.5).

    1. I haven’t worked with this for over a year. So not sure if later kernels broke it.

      Probably best bet is to check and ask on the Linode forums.

      Good luck!

  5. got it working for with your directions. THANKS!

    one glitch with my dahdi distribution was that building dahdi_dummy was commented out in the Kbuild file. Just remove the comment and dummy builds and installs.

  6. I’m using kernel all was going well until i went to run “.” it seems to have disappeared. Any ideas? I’ve got a system down and driving me nuts. Any help would be greatly appreciated.

Leave a Reply to Percy Kwong Cancel reply

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