Last week we learned a bit about what Asterisk can do (short answer: everything but cook dinner), and what hardware is needed to make it go. Today we'll put together a basic iPBX using Asterisk@Home. Asterisk@Home is a nice bundle that includes a Web-based graphical configuration interface, a Flash-based Operator Panel that lets you monitor all activity on the network, and even barge in on calls. Plus hold music, fax support and a bunch of other goodies. It's not just a toy for home users; it's also great for business use.
Asterisk@Home is not Asterisk, but a nicely modified version of it. For the sake of my overworked typing fingers, I'll just call it Asterisk in this article.
Our example iPBX needs a dedicated PC to serve as the Asterisk server, and some VoIP-capable phones. Softphones, which are telephony software that run on a PC, can use your existing computer speakers; just add a microphone. But this is the least satisfactory setup; these tend to echo and blare loudly when you would rather they didn't. VoIP headsets cure the echo problem and add privacy. These start around $20 and go way up from there. These come with either mini-stereo plugs, to plug into the sound card, or USB connectors.
Or, you can purchase some standalone SIP phones which start around $40, and also go way up. Higher prices generally get you more features and better sound quality, but don't count on it. Ideally, you'll be able to try before you buy, or be able to return them without hassle if you don't like them.
Or, you can be super-leet and use your PDA as your IP phone – all you need is a softphone that supports PDAs, like Counterpath's X-Lite or X-Pro.
A number of softphones run on Linux, which is astounding and amazing and pleasing and a nice change of pace from the usual Windows-only lameness:
If you want to connect to the world and be able to dial anyone, just like with old-fashioned telephone service, you'll need a VoIP provider. Otherwise you can call anyone who is VoIP-equipped without needing any intermediary other than a broadband Internet account.
The Bandwidth Bottleneck
Asterisk can serve a number of lines without needing the latest, greatest, studliest hardware. See the Asterisk dimensioning page on voip-info.org to figure out your server hardware requirements. You're more likely to run out of bandwidth than processing power. VoIP calls can use 20 to 90kbps in each direction. If you're running VoIP over your Web-surfing Internet line, you could easily choke it into unusability, especially on outgoing (upstream) calls, since lower-cost Internet accounts are asymmetric, with the smaller bandwidth allocated to the upstream side. So you might consider getting a dedicated symmetrical VoIP line. Naturally this costs more money, but if you rack up a lot of long-distance calls, it's probably worth it.
Asterisk@Home comes in two installation packages: an ISO complete with the operating system, CentOS 4, or as an add-on to CentOS 4. The current version of Asterisk@Home is 2.0. Burn the ISO to a CD, boot to the CD, and away you go. It will overwrite everything on your hard drive, so don't try to share with anything else.
After CentOS installs and reboots, the Asterisk@Home installation takes place. This can take up to 30 minutes, so don't think it's hanging. It takes a long time because the installer builds Asterisk from sources.
To install it on an existing CentOS 4 server, download and unpack the tarball, and run the ./install.sh installation script. It should work on newer CentOS releases as well, though I make no promises.
Configuring the Server
The very first thing you must do is change the root password. Login to Asterisk using the default root login, which is the username "root" and the terribly secret password "password." Use the standard Linux command passwd.
It is best if your Asterisk server has a static IP, and is not running X Window, which creates unnecessary overhead. In fact you can run Asterisk headless. At the first login prompt you'll see an IP address assigned to the box by Asterisk. Administer Asterisk from a neighboring workstation by firing up a Web browser and typing http://[ip address] in the URL bar. The default user is "maint", the default password is "password". Again, change the password. (If you want to change the Asterisk server's IP, run netconfig.)
This brings you to the Asterisk Management Portal (AMP). Asterisk can do a lot of things, so there are a lot of configuration options. Start with the Setup tab. Let's create an extension and make a phone call. Click Extensions -> Add Extension. Use the default extension 200, then type in a password. Next, type in the name of the person assigned to this extension.
Now set up the voicemail by entering a password. Be nice to your users and make it all numbers. Then enter the user's email address, click Add Extension, and click the red Apply button. Don't forget to click the Apply button every time you make a change.
Setting Up Phones
Setting up the IP phone depends on the one you're using. You shouldn't need more than the username, which is the extension number, password, and the IP of the Asterisk server. Once that's configured, you can make a call. Hit *45 to do a local echo test. Then set up a second extension, and have them call each other. Leave and retrieve a voicemail message. Check to see if the message was emailed to the user. This is a basic list of user commands:
*45 Echo Test
*70 Activate Call Waiting (deactivated by default)
*71 Deactivate Call Waiting
*72 Call Forwarding System
*73 Disable Call Forwarding
*78 Enable Do-Not-Disturb
*79 Disable Do-Not-Disturb
*90 Call Forward on Busy
*91 Disable Call Forward on Busy
*97 Message Center
*98 Enter Message Center
Calling the Outside World
You'll need a VoIP provider to do this. The Asterisk@Home user guide tells how to connect to a free provider, Free World Dialup. It is free only to connect to other Free World Dialup VoIP users; calls to the PTSN world (ordinary analog phones) cost tiny money. It's good cheap practice and testing.
Connecting Analog Phones
You'll see references to channel banks for connecting analog phones to your nice new Asterisk PBX. They are ridiculously expensive, so you might be better off getting individual ATA (Analog Telecommunications Adapters). However, unless you get a deal on Ebay, they cost enough that you might want to put the money into some good SIP phones instead.
That wasn't so bad, was it? Just a few short steps to having your own PBX. Come back next week to learn how to do more things with your Asterisk server, like hook into home automation, faxing, conferencing, and custom hold music.
- The Serial Console: A Front Door Worth Leaving Open. How to set up a headless server.