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.
Practical Task Scheduling Deployment
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.View Now!
|The Firebird Project's Firebird Relational Database||Jul 29, 2016|
|Stunnel Security for Oracle||Jul 28, 2016|
|SUSE LLC's SUSE Manager||Jul 21, 2016|
|My +1 Sword of Productivity||Jul 20, 2016|
|Non-Linux FOSS: Caffeine!||Jul 19, 2016|
|Murat Yener and Onur Dundar's Expert Android Studio (Wrox)||Jul 18, 2016|
- The Firebird Project's Firebird Relational Database
- Stunnel Security for Oracle
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Managing Linux Using Puppet
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide