Asterisk: Bridging gaps between communications systems

With the advent of voice-over-IP (VoIP) technology, there has been a dramatic movement toward IP-only telecommunications, leaving the twisted pair of yesteryear in the dust. Lower costs, automated directories, centralized monitoring, and ease of call routing are just a few of the advantages that a good VoIP implementation can bring to a workplace. But many businesses have been held back from jumping on the VoIP bandwagon because it can seem daunting or expensive to set up. The reality of VoIP is that some very modest hardware and a suite of free software tools can make for an enterprise-class VoIP system that can serve up to 1,000 office users in a single building.

In this article, we’ll walk through the basics of doing VoIP with Asterisk, an open-source, software private branch exchange (PBX). Note that this isn’t a detailed how-to—it’s more of an overview of the basics of building a VoIP system, with some notes on best practices. After reading this article, you should have a sense of what’s involved in a moderately sized VoIP setup, and of what such a setup can do for your business.

ABCs of VoIP
Most people don’t know what goes on behind the scenes when they place a call on their telephone at home or at work. Historically, the phone line consisted of a single circuit from your desk to a closet on your floor or section of your building (whether your office building, apartment building or even your house). Calls were then punched over to what is called “house pairs,” or the internal wiring of the building that’s permanent and isn’t moved or modified. In most multi-story office buildings, these house pairs were arranged in blocks, and they went down into a master closet where the phone service provider had brought in either circuits or trunks for each of the individual phones.

In recent years, calls have been multiplexed into some sort of digital solution such as ISDN or PRIs on a T1, DS3, or a similar digital connection. When you dial a call, you’re dialling on a switch in the nearest calling office, which then routes the calls through the various telecommunications switches between you and your calling destination. Sometimes the call is routed over the Internet but on private circuits. Your call is “attended” during the entire duration, which means that, while you’re on the phone, the switch through which it’s routed has a busy circuit and one less resource that can be used, because it’s maintaining a single complete circuit from handset to handset.

This approach makes perfect sense if you’re in an office in Boston and you’re calling an office in Miami, but what if you’re calling downstairs? When it comes to inter-office calls, you’re inefficiently using up two switch ports in your private branch exchange (PBX) for that phone call, when those ports could instead be used to switch inbound or outbound calls.

VoIP, in contrast, uses an all-digital network between both call endpoints (using a VoIP phone or analog telephone adapter). This makes VoIP very dynamic because it can be set up and moved without causing any disturbance to the current building infrastructure. VoIP uses the same logical structure as an analog PBX, but does it in a much more efficient and far more cost-effective manner, by implementing that structure with standard data networking equipment.

In a VoIP scenario, if you’re in Boston and you call Miami, you pick up the phone and dial the number. Your VoIP phone contacts the call manager or proxy that it is registered with and requests that number. The call manager comes back and essentially says, “Yes, I have a path. Hold on, let me set it up for you.” The call manager then handles the protocol and codec negotiation for the call and makes the call to the remote gateway, whether to the telco’s gateway on its analog network or to the destination’s VoIP gateway. Most call managers then attend the call, meaning your audio traffic will pass through and even be processed by the call manager for the entire duration of the call, especially if both sides can’t use the same audio codec for some reason, which means that the call will need to be transcoded in real-time. (More on that later.)

If you make a call to your friend downstairs, though, the call goes to the PBX for setup and, once the connection is made, the PBX often steps out of the picture and directly connects both handsets together. There are times when the PBX wouldn’t do this, such as conference calling or when a specific feature on the PBX is needed (call recording, etc). These types of scenarios would be specific to the application being used and the environment that it resides in.

Keeping with protocol
As most anyone who has ever been involved with VoIP knows SIP is the protocol of choice, for many reasons, but first and foremost because it has the widest cross-platform device support. The device support ranges from softphones (pieces of computer software that act as a phone) to Cisco enterprise-class desktop phones, wireless handsets for use at home, and phones that support simultaneous real-time video and audio. SIP is the most extensible and network-friendly protocol, due to its ability to add multimedia to the equation, which is key to its success in the telecommunications world.

In the enterprise, SIP works especially well because the overhead for call setup traffic is virtually non-existent in a gigabit Ethernet world.

Private Branch Exchange
When you pick up the phone and dial your co-worker’s 4-digit extension, you’re dialling through a miniaturized version of a phone company. Internally, there isn’t a need for 7 or 10 digits, so most places have 3 or 4 (and sometimes 5) digits. The brilliance of VoIP is that this can be completely arbitrary.

You do, however, need the hardware and the software to do this. No longer is a PBX a giant box with hundreds of switching cards in it, making it look like it may attempt to take over the world at any moment. Now, it is simply one of the many servers in your data center.

PBX hardware and software
For the purposes of this article, we’ll only be using a single server to keep things simple (though redundancy would always call for a second or a backup server). We will utilize the following hardware configuration:

Dell R710 rackmount server
Dual quad-core Intel Xeon X5550’s for up to 16 threads
32GB of RAM
2TB of disk space
4 port Gigabit Ethernet
For software, we will use the bare-bones, free software PBX known as Asterisk. Asterisk is a Linux-based voice communications server software that is a one-step installation. You can install a bare version of Asterisk on top of a Linux distribution, but it can be problematic because Asterisk is typically distributed already pre-installed on pre-configured and compiled Linux distributions. It is the standard soft PBX implementation, and almost all other implementations are based on (or at the very least inspired by) Asterisk.

Picking a front-end
Asterisk, however, is only a part of the equation. To properly manage and configure the software, you need a front-end, of which there are many to choose from. Digium, the company that makes Asterisk, has a solution called AsteriskNOW that performs GUI installation and a customizable configuration for Asterisk. Although it’s free, it’s really not viable in an enterprise environment.

Digium also makes Switchvox, which is essentially an Asterisk appliance with a Web front-end which adds a multimedia concentrator, centralizing chat, voice, video, and fax. Although this solution sounds great, Switchvox isn’t free, and there is a subscription requirement for support. It’s geared more toward non-VoIP nerds who need a solution right now.

In the free realm, there really is no comparison for trixbox CE, formerly Asterisk@home. trixbox CE is the community edition of the trixbox front-end software and management system by Fonality, which also makes enterprise and service provider-class hardware appliances and even back-end hosting of a VoIP PBX. trixbox CE is free to download and is feature-rich. It is a self-contained, single-instance installer that will handle the entire hardware and software configuration to get a basic Asterisk setup up and running. The best setup feature of trixbox CE is the Bulk Extension tool (added in 2.6.1) that allows you to create a text file containing a format for each extension you want to add. This saves a ton of time if you have to add 1000 extensions, and it provides the ability to add all the extensions in one motion.

trixbox also has media convergence features such as recording incoming and outgoing calls, emailing voicemail to users using Postfix, and, in the latest version, an updated core set of Asterisk code for maximum security and a more robust feature set. One of my absolute favourite features of trixbox is its Endpoint Configuration manager. It runs a TFPT server and can set up and configure Cisco IP phones (with SIP firmware) via the Web interface just like Cisco CallManager does. You can even mass-upgrade firmware on Cisco phones simply by placing the appropriate configuration XML file and binary firmware file in the TFPT directory.

Can you hear me now? Codec compatibility
One of Asterisk’s core features is its ability to work with and around many of the industry-standard VoIP audio codecs, even the commercial ITU G.729. The importance of working with so many codecs is that not every endpoint supports every codec and not every application calls for specific codecs. For instance, most calls that have the luxury of copious amounts of bandwidth would benefit more from G.711, which is the clearer audio codec. This is obvious when you use a service such as Broadvoice or Vonage and turn the call quality all the way up in the Web interface. This is the G.711 codec at work. When you use Skype over your 3G connection on your iPhone, you’re most likely using the GSM codec, mostly used in mobile phones today on the carriers’ internal networks.

Asterisk has the ability to transcode audio in both directions in real-time, eliminating the need to coordinate endpoint compatibility. A good example would be interoffice phone calls. Let’s say you have one Asterisk shop running nothing but Cisco IP phones and G.711, but in the branch office out in the field, they’re forced to use GSM due to their limited connectivity. Each office’s local Asterisk server would transcode the calls for each other’s systems. All of this would be negotiated at call setup.

Application in the real world
The server that we have specified for this application has the ability to handle around 1000 concurrent calls through the gateway and enough storage for voicemail boxes for all users. Calls have no real effect on the server inside the PBX because of one of the amazing SIP features: REINVITE. The REINVITE feature allows the SIP proxy to set up the call and then directly connect the endpoints to each other for the audio flow. The server only hangs on for call control (for things such as call-waiting, caller ID, etc). REINVITE can only happen if both of the endpoints can agree on a codec, of course, because while many endpoints support multiple codecs, there are none that can perform any transcoding.

In order to connect this phone system to the outside world, we’ll need a trunk or a path to the PSTN phone system. Many office buildings and companies will either use a good old-fashioned twisted pair from the provider or ISDN/T1 PRI-BRI channels to handle these lines. This works well with Asterisk, but more hardware is required to properly translate VoIP into one of these provider-based points of entry into the system.

The best method is simply using a SIP trunk, which requires no additional hardware. There is a huge list of SIP trunk providers that can provide you with 10s, 100s or even 1000s of trunks with numbers and features, or simple bare-bones trunks since Asterisk provides all the calling features that any major provider can offer. For home customers, Vonage, Broadvoice, Verizon, Comcast, and AT&T all serve as SIP trunks with their voice options for their customers. Some of these same companies have enterprise solutions that don’t cost much more than their residential counterparts, especially in bulk. Additionally, adding or removing lines is only a matter of going to the provider’s website and provisioning a new trunk or removing one. Gone are the days of having to have a service provider technician come out and run a pair to your house pairs.

Moving lines from cubicle to cubicle is easier than ever. Instead of having to punch twisted pair at the block, you simply have the user take their phone when they move. When they plug it in, it’s still their number, with their voicemail and all of their pre-programmed features. This takes the workload off of system and infrastructure administration staff and makes massive space reconfigurations a nightmare of the past.

Workplace integration
When using SIP endpoints, it’s possible to integrate your SIP phone system into your workstation software. For instance, you can give users the ability to receive their voicemail via email in a format compatible with a mobile device such as a BlackBerry, Windows Mobile device or iPhone. Additionally, there is a lot of potential for integration into Microsoft Outlook and Office Communicator. The ability to dial straight out of your Outlook Contacts or the Global Address list without ever having to touch the phone on the desk is powerful.

Asterisk can also be configured to support Bluetooth-based presence awareness, meaning that you could pair your Bluetooth phone with the PC in your office. When they can “hear” each other over Bluetooth, your calls would go to your desktop phone naturally. Should you go out of range of your computer, your calls would automatically be forwarded to your mobile phone until the end of the workday, at which time they’d go directly to voicemail or back to the desktop phone (or until you came back within range of your office computer). This would be handled by a simple piece of client software running on the user’s workstation to communicate the presence information back to the Asterisk server.

trixbox has a switchboard interface which adds the ability to have a receptionist take and route calls, conference calls together, and arrange dial-in conference rooms. The receptionist can also use the Web interface to monitor call activity and see whether a user is busy or available.

There are even initiatives in place to allow a reasonably powerful server to transcribe the conversations held in a teleconference meeting using voice recognition software, break up the conversations by an audio stream, and then identify the speaker in the transcript.

Employers who wish to monitor their employees’ usage can generate reports of a specific employee or group of employees, in usable and presentable formats.

For offices that don’t need to provide each individual person with their own trunk, they can have an auto-attendant handle incoming calls and route them via a voice menu which can be recorded at the handset (or studio-recorded) and uploaded to the Asterisk server.

These are just a few of the many ways you can make your phone system a part of your overall environment.

Best Practices
This scenario depicts only one server for enterprise use, but as most data center managers will tell you, for any high-availability service such as email or telephone, there has to be a way to back it up. Asterisk doesn’t inherently have this built in, but with a few simple scripts, it’s quite simple to create failover or a load-balancing cluster of machines to minimize downtime.

Most of these implementations are open-sourced, community-based solutions, but they work well.

One of my favourites for redundancy is Flip1405, which is a scripted solution to failover Asterisk services with only about 20-30 seconds of downtime. They have also crafted another one of my favourite solutions, Safe1405, an automated Asterisk backup and Auto-FTP system to back up your priceless configuration files. For massive deployments or in instances where you may not have any single server powerful enough for your user base, there is a fantastic open source load balancing software called OpenSIPS.

Implementing the update features of trixbox can keep your Asterisk server healthy, safe, and up-to-date via the Web interface. You can remove and add features that didn’t initially come with trixbox or your Asterisk distribution, or even add new ones that were released to the community since installation. The package manager is extensive and robust and is updated regularly.

Conclusions
To maximize performance and reduce costs, Asterisk proves to be a forward-thinking, formidable solution for almost any size environment. Scalable and extensible, and with many options for integration into the workplace, VoIP and Asterisk are a logical choice for a business on a budget that’s looking to cut costs without cutting services.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s