November 16, 2004

Asterisk: The open source PBX replacement

Author: David Coulson

Corporate voice communications have traditionally required expensive office exchange systems and service from big telephone companies. Today, however, organizations can use voice over Internet Protocol (VoIP) technology to provide internal voice communications, and continue to use a local telephone carrier for interfacing with the public switched telephone network (PSTN).

The equipment needed to interface a system onto a voice network is available for a variety of platforms, including the Intel architecture, allowing a PBX replacement to be built using readily available components. Linux makes an ideal platform for such hardware, being generally stable, as well as being able to provide the enhanced network capabilities that a VoIP installation demands, including Quality of Service at the IP level and 802.1q VLAN support for segmentation of an Ethernet network.

Asterisk is a Linux-based open source application that provides VoIP gateway features. Asterisk is distributed under a modified version of the GPL, requiring all developers who contribute patches to the Asterisk project to transfer the rights for the code over to Digium, the product's developer. This allows Digium to distribute a modified branch of the code tree to commercial clients without the changes the clients request being placed into the public CVS tree. While this goes against the open source way of thinking, Asterisk has a large number of developers who maintain and contribute code to the project. Digium sells devices for an Asterisk box to connect to a simple phone line such as one you may have coming into your fax machine. It also sells the cards necessary to interface with a trunk circuit used by larger businesses, including ISDN PRI and channelized T1.

Because Asterisk is a VoIP system, you do not need local telephone service to use it. VoIP can be used on a private LAN or a corporate WAN without even touching the Internet. Of course, many of the advantages of VoIP, including the ability to make cheap long distance calls and providing independence from the incumbent local telephone carrier, are only realized when the Internet becomes the transport for certain voice services. However, as the Internet is not as stable as users expect a voice infrastructure to be, companies should maintain a local circuit for emergency backup or local calls.

Asterisk-friendly
VoIP carriers
VoicePulse Connect
SimpleTelecom
IConnectHere
FreeWorldDialup

Asterisk can deliver voice traffic over the public Internet to a VoIP carrier -- see the table at right for some of them. VoIP carriers presently fit into two differing business models. Most use pre-paid accounts which are billed per-minute, so one can load up with $50 worth of calls and simply pay extra when the reserves start to run low. Other providers offer monthly billed services, generally in the region of $39.95 including unlimited US48 long distance, which often also include an inbound number in the area of your choice, if available. Unless one is handling thousands of minutes of calls each month, it is usually much cheaper to go with pre-paid, as at 2 cents per minute, $40 goes a long way.

Asterisk essentially acts as a voice router. The software supports a variety of protocols to both deliver voice across the Internet and interface handsets with the VoIP gateway. Almost all handsets and VoIP carriers use a protocol known as the Session Initiation Protocol (SIP), which can deliver a wide variety of media, including voice and video. The popular Cisco ATA-186 analog telephone adapter, which is used by the majority of residential VoIP providers, allows a standard telephone unit to be interfaced to a SIP gateway across a LAN or the Internet, and delivers voice traffic over IP between two devices. Asterisk includes extensive support for the SIP standard, as well as for H.232, MGCP, and SCCP. The latter is the protocol used by Cisco Call Manager, a system that provides telephone features similar to Asterisk and traditional PBX systems, although the cost of the hardware and licenses it requires restricts it to the realms of those who have a significant budget.

Asterisk also provides support for a customized trunking protocol known as IAX (pronounced "eeks"), which allows voice traffic to be delivered between two servers in the most efficient way possible. While IAX was originally developed for use between two Asterisk servers, it is quickly becoming a popular protocol supported by a number of other applications and hardware devices for delivering voice in place of SIP or H.232. Using IAX and the appropriate codec, the compression and encoding process for digitally delivering an audio channel, one can significantly reduce the bandwidth required for handling a voice call, and it is possible (although not entirely practical) to sustain multiple voice calls over a single 64Kbps channel, which previously could handle only a single call.

The dial plan

Asterisk is built around what its developers call a dial plan, which is a set of rules that decides how calls should be handled, which voice mailbox a particular number goes to, and how to get a call from the VoIP gateway onto the PSTN. Anyone accustomed to programming PBX devices will recognize that this is a similar call routing mechanism. When a call comes in via either an ISDN interface or the Internet, Asterisk can route it to the appropriate destination.

Each function in Asterisk is built as an application, allowing users to call a SIP phone using the Dial function, place a call in voicemail using VoiceMail, or if the call happens to be from a mass marketing company that refuses to listen to our requests to be removed from their lists, we can pretend our line is busy with the Congestion application. Handling applications is completely transparent, so if an administrator wants to change extension 105 from calling a SIP phone to going straight to voicemail, he can simply modify a section of the dial plan to call an alternative application.

We can define a sequence of voice providers (IP or local) to handle calls, and in the event one is unavailable Asterisk can use an alternative without having to reconfigure everything.

Asterisk vs. the world

While many of the features of Asterisk are typical of those found on traditional PBX systems and on other VoIP gateways, implementing Asterisk not only reduces the overall cost of building out a voice infrastructure, but also places a variety of cost-effective voice options at the fingertips of telecom administrators.

Managing a voice network is more demanding than managing other Internet services, as users have higher expectations when it comes to service quality and availability. However, you can implement Asterisk on a small scale for little investment; you can provision a 25-person office with voice using Asterisk for less than $12,000, including the $7,500 cost of the actual VoIP handsets. With a little creativity and time, you can integrate Asterisk into an existing voice infrastructure without replacing an existing PBX and take advantage of the cheap long distance service available across the Internet without having to completely reinvent the voice system.

Asterisk "just works." There are numerous examples on the Asterisk developer mailing lists of people who pick up a VoIP phone, dial a number, and have no clue that their call is being delivered over IP to the destination prior to jumping onto a local telephone network.

David Coulson is a Cleveland-based freelance writer, consultant, and open source advocate who specializes in network architecture and integration.

Click Here!