Creating a Home PBX Using Asterisk and Digium

Use Asterisk and Digium to give all your family members their own phone extension and voice mail.

Some open-source projects have a certain perverse economic madness about them. For example, as I wrote about last month, you can use $600–$700 US worth of hardware and MythTV to re-create the TiVo box you can get at Best Buy for half the price. Of course, there are philosophical and technical reasons for wanting to use MythTV, but for most of the general public, it really doesn't make sense.

On the other hand, you occasionally run across an open-source product that is, in fact, a much cheaper solution than the commercial offerings in the same space. One example is Asterisk, which bills itself as the open-source PBX. A PBX, for those not in the know, is a Private Branch Exchange. It's essentially a mini-phone company inside a business or (as in our example here) a home. A certain number of outside lines come into the building, but there can be many more individual extensions that can call each other or request an outside line. Anyone who's worked at a company of even moderate size should be familiar with the concept (dial 9 to get an outside line—ring any bells?).

Unfortunately, as handy as PBXes are, they are also mucho dinero. Thankfully, Asterisk can provide a full-function PBX with voice mail and even VoIP bridging, without breaking the bank. It's cheap enough that it even makes sense in a residential setting, assuming your home is large enough that you spend half your time shouting at the spouse to pick up the phone. With that in mind, let's see how you might set up Asterisk in a home environment.

To begin, you'll need a garden-variety Linux server with a spare PCI slot. Asterisk has been reported to have performance issues running with the X Window System, so you'll probably want to dedicate a server just for the purpose. You don't need an absolute speed demon of a box, but low-balling your processor probably isn't a great idea either. You'll need some disk space to store voice mail, but Asterisk is fairly efficient at compressing sound, so a 40GB drive should be more than enough for the OS, swap and voice data.

Phone Calls Are in the Cards for You

Figure 1. The TDM400P provides four ports to mix and match between external lines and extensions.

You will need one piece of specialized hardware, a Digium Wildcard TDM400P. This card allows you to hook traditional handsets and POTS (plain-old telephone service) lines to your server. It's what Asterisk uses to receive and send calls over the phone network, and to ring the various PBX lines inside the house. A TDM400P has four available ports—you can mix and match them between outside lines and internal handsets. So, for example, you could configure it to have one outside line and three internal lines. You need to order the card with the mix you want; you can't change a line from outside to inside. Fully loaded, the cards go for about $250 US retail. Basically, to figure out how many you'll need, add up the number of outside lines you have or intend to get plus the number of internal extensions you plan to provision (you can have more than one handset on a single extension), then divide by four. So, two outside lines plus six extensions would be eight ports, or two cards. In a corporate setting, you'd probably be bringing in your outside lines via a T1 line, and Digium makes cards for that purpose as well, but since you're probably not running a call center out of your Tudor mini-mansion, the TDM400P will probably be all you need.

At this point, you need to set up your OS and the Asterisk software. I know the almost irresistible temptation is to install your favorite distro and then try to install the Zaptel drivers needed for the TDM400P and the Asterisk software from source. Resist, resist! I spent a good three days trying to get things working that way. First I couldn't get the drivers running right, then I had to configure udev support for those Zaptel devices, then spend a good day poring over the available documentation for Asterisk trying to get the software to talk to the card. I even had an engineer from Digium logged in to my system poking around for an hour, and he couldn't get it to work either. (This, by the way, is a really nice service offered by Digium to folks who purchase their cards; they'll assist in the setup and basic configuration of an Asterisk system.)

Feeling @Home with Asterisk

Finally, I saw the light (possibly stars brought on by repeated pounding of my head on the desk), and downloaded the ISO of Asterisk@Home, a complete Linux distribution that comes up running right out of the box. An initial caveat: the install procedure is extremely automatic, to the extent that it will repartition and reformat your disk without a second glance. This is definitely not something you want to “trial install” on a machine with important data sitting on it.

Figure 2. The Asterisk@Home Main Screen

Once the install is finished (about 20 minutes on a fast machine), you should be able to browse (from another machine) to a newly installed Web server on your Asterisk host. Clicking on the Asterisk Management Portal link brings you to the main AMP screen. From here, you can set up your entire PBX using a well-documented and simple-to-use GUI interface.

Figure 3. Adding an Extension

For example, adding an extension is as simple as a couple mouse clicks. In Figure 3, we're associating port 1 on the Digium card with extension 10. We also can configure the voice-mail options at the same time. Recording automated voice response messages is just a matter of calling an extension from one of the system phones and talking.

Figure 4. Configuring Incoming Calls

Incoming calls can be routed to a set of phones or to an operator. You also can set different rules for business and after-hours calls. Certain lines can be restricted from making long-distance phone calls or even from calling outside the house at all. Asterisk@Home also comes with an application called Flash Operator Panel, which lets authorized users see which lines are in use, transfer calls to different extensions and generally perform the functions normally handled by a receptionist at a company. It's probably overkill for a simple home application, but it comes as part of the package and may prove useful on occasion.

Figure 5. Using the Operator Panel, you can drop and drag phone calls.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

One of the main advantage of

Anonymous's picture

One of the main advantage of having a MythTV other than purely philosophical reasons is that you know you're in control of it. Every now and then I hear some controvery over whether TiVo records what shows you watch and sell it to advertisers, or that it's decided to remove some feature. If you build your own DVR however you're in absolute control and your media and privacy aren't in control of some corporation and you can modify it however you want (and are able to). Of course this isn't perfect since it's less convenient, there's no customer service, and it requires a bit of knowledge (or the willingness to learn it).

Besides that however, I'm not so sure building your own MythTV (or similar open source DVR) is that uneconomical compared to TiVo. It may be more expensive for the initial equipment, but there aren't any monthly payments. Like cell phone providers, they sell you the equipment for relatively cheap because you'll sign a contract and provide a constant revenue for them. Over several years, the $10-20 for monthly TiVo service does add up. Since it's built with off-the-shelf components if you already have any spare computer parts (or an older computer) they might be used as well to bring down the cost. And you can easily upgrade it when you want, unlike with Tivo where you have to buy the latest one to get the newest features. In the long run it would probably save a good deal of money.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix