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…
- Asterisk Community Wiki
- O’Reilly book on Asterisk 1.4 (pdf)
- Main site for Asterisk
- Asterisk Reference Information, version 184.108.40.206
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.
- 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.
- 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!
- A VOIP router for the house. I purchased a Cisco/Linksys SPA3102
- 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 linode-kernel-prepare.sh 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` ./linode-kernel-prepare.sh
- 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.