Friday, January 18, 2008

Cat5e plus Asterisk / Trixbox

I bought my current house after the sheetrock was put in, so I wasn't able to specify the wiring.

One thing I learned from the last house is that I didn't want to rely exclusively on wireless anymore. Neighbors had 2.4GHz cordless phones and microwaves that really-must-be-dangerous-they-are-so-RF-leaky. Aside from the mysterious drop outs for 10 minutes to an hour, the performance difference was too great for work or for large file transfers.

Fortunately I discovered that the electrical contractor used Category 5e (Cat 5e) wiring for the telephone jacks. They has become fairly common because you can have 4 telephone lines carried over this kind of cable. I was happy because Cat5e is capable of carrying Gigabit Ethernet instead of phone signals.

I had two problems to overcome. I did still want phone service, and the jacks were daisy-chained (wires went from one jack to another) instead of home run (all jacks connected to the basement using independent wires).

For the phone service, I decided to use a Voice over IP (VOIP) solution that sends phone service over the data network I would deploy on the Cat5e. To do this, first I took one of my old notebooks, and installed Trixbox.

Trixbox can be downloaded from trixbox.org as an ISO image that can be used to burn a bootable CD. I rebooted the notebook with this CD, and it reformatted the hard drive, installed Linux (CentOS a Redhat clone), and installed all of the additional software to turn the notebook into a phone switch that is probably more capable than the ones at most offices. The only questions the installer asks are the time zone, what the root password should be, and some optional questions about network address. There is no Linux knowledge required to use the product. If you don't already own an old notebook with a Pentium III processor and 256MB of memory, you can buy one for $100 - $200 on eBay.

Now that I had the phone switch, I needed phones that could use the data network. There are two options - either buy a data phone or buy an analog adapter that translates between the analog phones most people use at home and the data network.

I mostly decided to buy new phones. The Cisco 7960 can often be bought used on eBay for as little as $100, and it is a great phone. This way you can put calls on hold, transfer calls from room to room, use the phone directory, conference calling or other advanced features. Cisco ships most phones configured to use their proprietary data signaling, but you can download a firmware update for free from cisco.com that supports the SIP standard.

If you prefer to use an analog phone or fax, you can buy a box that translates from analog to data, such as the Sipura spa-3000 or spa-2002 (Sipura is now also owned by Cisco / Linksys). These are available for around $50 on eBay. These boxes are about the size of a deck of cards, and have both a data network and analog phone modular jack. They have a web based admin utility to configure the phones to connect to the VOIP phone switch.

The daisy chained wiring was probably the least desirable aspect of the wiring. Modern data networks are switched, not shared, so the jacks needed a network switch to connect the two segments. So rather than directly connecting the two wires in each wall outlet box, I terminated them as two Cat5e jacks. This is very easy - Leviton makes keystone Cat5e jacks that allow you to connect the eight wires from the cable into the jack without special tools or soldering. These jacks then snap into a wall outlet cover that replaces the phone jack outlet cover.

If you use a Cisco phone, it has a built-in switch so you can just connect the two jacks on the phone to the two jacks on the wall outlet using two network cables. If you use the spa-20002 you need to also use an inexpensive ethernet switch, like the Netgear GS605. You'll also want such a switch if you want to connect PCs or Tivos to the wired network. For some rooms you might decide to use a WIFI access point with a built-in switch (like the D-Link DIR-655 Xtreme N Gigabit Router) to bridge the wired and wireless worlds.

After the network is assembled, you can then configure your phones to talk to the VOIP switch running on your laptop. Each phone can get a separate extension, so no more yelling to call the kids downstairs - the phone is your intercom. Each extension is also private so we don't have to worry about kids picking up the phone while we're on conference calls with clients on snow days.

You then need to decide how you will call the outside world. You can either get another spa-3000 and connect your phone company analog line to your network, sign up for VOIP service from an enlightened provider that will let you use your own equipment (such as Inphonex or VoipStreet, not Vonage or your cable/phone company's VOIP service usually won't let you do this). We have both - 1 analog phone line from Verizon for critical calls, and two different VOIP providers. We use two VOIP providers because VoipStreet gives you extra phone numbers very cheaply but doesn't let you call international and charges for 800# minutes, and Inphonex doesn't charge for toll-free calls and does let you call international. You can have different phones ring on different extensions very easily through the web based configuration on the Trixbox/Asterisk VOIP switch.

We're very happy with this phone setup. We get advanced features for the phones, can have eight people dialing out at the same time, and our monthly phone bill is less than half what it used to be. The system is very reliable, and so is my data network. Now that I can plug in when I am doing a webcast, snow days are a lot less disruptive than they used to be. But I saved my favorite feature for last - wake up calls that I can schedule for any room in the house from my computer, playing the mp3 music my children request (currently it is "It's the Best Day Ever" from SpongeBob - did I mention their ages are 6, 8, 8, and 10?).

For futher reading on Asterisk, I suggest:
http://nerdvittles.com/index.php?p=137
http://asteriskathome.sourceforge.net/handbook/
http://www.voip-info.org/wiki/view/Asterisk+Cisco+79XX+XML+Services
http://www.cisco.com/en/US/docs/voice_ip_comm/cuipph/7960g_7940g/sip/6_0_7_4/english/administration/guide/siptrb60.html

2 comments:

Kevie B. said...

I actually am glad I found this blog. I am thinking of doing the same thing, but re-wiring my houses phone lines or just running all new lines. Did you use regular nic cards with the software? Also how do you specify which phone is which in the setup, like if I plugged in a phone in my basement with an analog converter, how would the software know what phone that is when trying to ring it?

Peter Cousins said...

Yes, the laptop had an old ethernet PCMCIA card in it.

When you plug an analog phone into a spa-3000 (or spa-200x) you use a web based admin panel to configure all of the options.

A really cool feature of these devices is that they have a built-in IVR application (e.g., "Press 1 to set IP address, Press 2 to set DNS") for configuring the network information. All you have to do is plug in the analog phone to the phone jack and press a few keys to get the device ready to plug into your network.

The way the switch knows which phone to ring is by the SIP registration, which tells the switch the IP address and the extension.

Depending upon which sipura model you buy, you can hook up 1 or 2 analog phones to it. If you just want to use analog lines, you can have all the sipura boxes in the basement IF all your analog lines are run separately to the basement. I emphasize if because often the wires go from jack to jack in series instead of in parallel.