Creating a Home PBX Using Asterisk and Digium
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.
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.)
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.
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.
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.
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.
Win an iPhone 6
Enter to Win
|Microsoft and Linux: True Romance or Toxic Love?||Nov 25, 2015|
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
|diff -u: What's New in Kernel Development||Nov 17, 2015|
|Recipy for Science||Nov 16, 2015|
- Microsoft and Linux: True Romance or Toxic Love?
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Cipher Security: How to harden TLS and SSH
- Web Stores Held Hostage
- PuppetLabs Introduces Application Orchestration
- Simple Photo Editing, Linux Edition!
- Firefox's New Feature for Tighter Security
- diff -u: What's New in Kernel Development
- November 2015 Issue of Linux Journal: System Administration
- It's a Bird. It's Another Bird!