This chapter introduces Asterisk, the Private Branch eXchange (PBX) implemented entirely in software. Asterisk is the hot new darling of the telephony set; it's both a replacement for existing outmoded and overpriced PBX systems, and it's a doorway to the future. Our current telephone system (at least in the U.S.) is excellent because it's pretty much the same technology invented by Mr. Bell. It has been extensively refined over the years, but hasn't seen much in the way of invention.We won't see videophones, video conferencing, or integration with all manner of software and portable devices on the old-fashioned public switched telephone network (PSTN). That's coming with Voice-over-Internet-Protocol (VoIP), packet-switched networks, and broadband Internet.
Asterisk is a PBX and a powerful IP telephony server. Asterisk supports multiple telephony protocols (including SIP, IAX, and H.323), integrates the PSTN with VoIP, and allows you to mix-and-match services and devices (analog, digital, wired, wireless, IP). You may use it as little more than a glorified answering machine, or as a local PBX that is integrated with your existing telephone service, or as part of a wide-area IP telephone network that spans continents. Anywhere the Internet goes, Asterisk goes.
This chapter covers installing and configuring Asterisk 1.4. We'll set up basic business PBX functions: voicemail, a digital receptionist, Internet call services, integration with analog phone service, user management, conferencing, and customizing hold music and voice prompts. The example configurations in this chapter are as stripped-down and simple as possible. They are fully functional, but needless complexities are left out. Don't let the other geeks pressure you into thinking you have to over-complicate your Asterisk configurations because that is the path to instability and madness.Figuring out dialplan logic is the hard part; once you have that down, you'll be able to easily expand on the recipes in this chapter to accommodate more users and functions.
Asterisk is free in two ways: free of cost and licensed under the GPL. Don't let the word free steer you in the wrong direction.VoIP call processing requires a substantial amount of processing power, so don't look to Asterisk as a way to keep old 486s in service. You'll want good-quality hardware and network bandwidth sufficient to handle your workload. How much capacity do you need? There are so many variables involved in calculating this that I'm going to dodge the question entirely, and refer you to the Asterisk support page (http://www.asterisk.org/support) and the Voip-info.org Wiki (http://voip-info.org/wiki/). These are the mother lodes of Asterisk help and information.
Asterisk's flexibility is its strength and main drawback—there are so many options that you can easily get lost. You can put together a three-node test lab for practically no money, if you have some old PCs lying around. We'll build one in this chapter consisting of an Asterisk server running on Linux, and two client PCs running software IP phones (softphones). You'll need a switch to connect the three PCs, sound cards, and sets of speakers and microphones or headsets. If you get USB headsets you won't need sound cards, speakers, or microphones.
You'll need a broadband Internet connection to place calls over the Internet.VoIP calls consume 30–90 Kbps each way. T1/E1 gives the best call quality. DSL is a decent option, especially if you have a dedicated DSL line just for VoIP. Even better is symmetric DSL instead of the usual ADSL, if you can get it. Cable Internet also works well, if you have a good service provider, and can get adequate upstream bandwidth.
Asterisk was designed to take advantage of all the cheap power we get in x86 hardware. Asterisk is CPU and memory-intensive, so don't skimp on these. The alternative is much-more-expensive specialized digital sound-processing hardware, so if you find yourself wishing for interface cards that take some of the load off your system's CPU, just remember that they cost more than a PC upgrade.
The types of IP phones you choose can either make your life easy or make it heck because they have a big effect on call quality. Hardware IP phones (hardphones) have Ethernet ports and plug directly into your network. Good ones start around $100, and offer all manner of options: speakerphones, headset ports, wireless, and multiple lines. They smooth out echo and jitter, and look and operate like normal office phones.
Headsets combined with softphones (software phones that run on a PC) can save some money because a lot of softphones are free of cost, or less expensive than hardphones. They also save on Ethernet ports and wiring. You'll have the option of wired or wireless headsets, and many different softphones to choose from. You'll want to test them first because there are considerable differences in call quality and usability. A common flaw in many of them is a tiny, cluttered, nonresizable interface. Another factor to watch out for is putting them on underpowered or overworked PCs—it takes a fair number of CPU cycles to process VoIP calls, so the computer must be able to handle call-processing and whatever other jobs the user needs to do.
If you have analog phones you can't bear to part with, you can get individual analog telephone adapters (ATA), or PCI adapters that install in the Asterisk server, like the Digium, Sangoma, or Rhino PCI analog interface cards. You can even get channel banks to handle large numbers of analog phones. There are a wealth of standalone multiport analog adapters with all manner of bells and whistles. These are nice and easy, but watch out for high prices and protocol support. Many of them do not support Inter-Asterisk Exchange (IAX), which is a useful and efficient native Asterisk protocol. Everything should support Session Initiation Protocol (SIP), which has become the most popular VoIP protocol.
Visit the Asterisk and AstLinux user list archives to get information on specific brands and models.
The debate over which type of IP phone to use rages on endlessly, but the reality is there are more differences between brands than between types of phones. In general, hardphones sound and perform the best. Good softphones coupled with decent-quality sound gear perform well. Analog phones require adapters, and have problems with echo. Analog adapter cards should have hardware echo cancellation, and Digium also offers a software High Performance Echo Canceller (HPEC). This is free to Digium customers, and $10 per channel for users of other PCI analog adapters.
Latency is the enemy of VoIP, so you need to ensure that your LAN is squeaky-clean: no hubs, because collision domains kill call quality, and are so last-millennium anyway; no antique cabling, incorrect cabling, flaky NICs, or virus-infected hosts clogging the wires with mass quantities of contagion.
You cannot control what happens when your VoIP bits leave your network. Talk to your ISP to see what it can do to help with your VoIP. It might even offer a service-level agreement with guarantees.
Mark Spencer, the inventor of Asterisk, wanted an affordable, flexible PBX for his small business. There was no such thing at the time, so he invented his own. Mr. Spencer sat down and started coding, and implemented PBX functionality in software that runs on Linux on ordinary x86 hardware. But it still couldn't do all that much, because Asterisk had no way to interface with ordinary telephony hardware.
That gap was filled when Jim Dixon of the Zapata Telephony Project invented an interface card to do just that. That first card was called Tormenta, or hurricane.
Asterisk and Zapata came together like chocolate and peanut butter and became Digium, Inc. The Tormenta card evolved into the Digium line of T1/E1 cards. Digium also supplies analog adapters for analog telephone lines and analog telephones.
Digium is not the only supplier of interface cards and adapters; a brief Google search will find all sorts of VoIP hardware vendors.
There are recipes in this chapter for recording your own voice prompts. Digium will also sell you professionally recorded custom voice prompts in English, French, or Spanish. English and Spanish voice prompts are recorded by Allison Smith. You can hear her voice in the sound files that come with Asterisk. French and English recordings are made by June Wallack.
AsteriskNOW (http://www.asterisknow.org/) is a software appliance that includes Asterisk, an rPath Linux-based operating system, and excellent web-based administration interfaces for both Asterisk and rPath Linux. It is freely available from Digium.
Asterisk Business and Enterprise Editions (http://www.digium.com/) are the commercially-supported versions available from Digium. These are closer to turnkey than the free edition, and Digium's support is good.
Trixbox (http://www.trixbox.org) is another popular Asterix bundle. This comes with everything: the CentOS operating system, a graphical management console, MySQL database backend, SugarCRM, HUDLite, and many more nicely integrated goodies. This is a large package—you'll need a couple of gigabytes of drive space just for the installation. The latest release has a modular installer that lets you choose which bits you want to install.
AstLinux (http://www.astlinux.org/) is a specialized Linux distribution that contains the operating system and Asterisk in about 40 MB, which makes it a perfect candidate to run on single-board computers like Soekris, PC Engines WRAP boards, and Gumstix Way Small Computers. It also runs fine on small form-factor boxes like Via, and ordinary PC hardware.
FreePBX (http://www.freepbx.org/) is a web-based graphical management interface to Asterisk. It used to be called AMP (Asterisk Management Portal), and is included in Trixbox.
The Asterisk Appliance Developer's Kit (http://www.digium.com/en/products/hardware/aadk.php) includes application development tools and a specialized hardware appliance for developing customized embedded PBXs. It's a complete package that includes an IP phone, all manner of documentation and training, and even Asterisk memorabilia. This is targeted at resellers, and businesses that have the in-house talent to develop a customized appliance.
You can have a test lab up and running in a couple of hours. Asterisk has a rather steep learning curve, so you'll pick it up more quickly if you have both telephony and Linux networking experience. But don't let a lack of experience stop you. Make a little test lab and learn your way around it before trying to build a production system. It's fun, it's endlessly flexible, and having control over your own systems is always good.
While you can compile and run Asterisk on any operating system (or try to), Asterisk works best on Linux. Asterisk is such a fast-moving target that by the time you read this it might run perfectly on all operating systems, so check the current documentation.
AsteriskNOW is an excellent Asterisk implementation that claims it will have you up and running in 30 minutes. See Recipe 5.22 and Recipe 5.23 near the end of this chapter for a good introduction to using AsteriskNOW.
The History of Zapata Telephony and How It Relates to the Asterisk PBX:
http://www.asteriskdocs.org/modules/tinycontent/index.php?id=10 |