Asterisk and Adhearsion

I tend to get excited about the oddest things. One that I’ve been fascinated with for a couple of years now is an open source project called Asterisk, originally created by a company called Digium. Loaded on a Linux system, it gives you a complete PBX phone system comparable to the ones corporations spend tens or hundreds of thousands of dollars on.

Several things make Asterisk really compelling from a business standpoint. Most obvious, of course, is the money. If your business goes the likely route and pays for the Business Edition or a plug and play Asterisk appliance, the upfront price is still a lot less than comparable VOIP systems from Cisco, Avaya, or Nortel. Factor in the yearly maintenance contacts, and the Asterisk total cost of ownership is going to be a lot less.

One of the other benefits of an open source VOIP system is its capacity to support a wider range of open standards and protocols than proprietary providers. That means you’re not locked into one company’s phones, but can instead choose from any that support the SIP standard. It also means you’re more likely to see faster support of new standards since the established telephony companies tend to move at glacial speeds.

Another less obvious advantage of using an open source phone system is its capability ot integrate with other systems and software already in use within the business. Cisco and the other guys do offer varying degrees of programming interfaces, but Asterisk is a phone hacker’s dream come true.

While I can’t vouch for it first hand though, learning and using the internals of Asterisk tends to be nightmarish. That’s where an amazing open source project called Adhearsion comes in. Adhearsion is a programming framework written in Ruby that hides all the complexity of interacting with Asterisk. This really breaks down the barriers preventing organizations from integrating their phone system with their other applications. Here’s a small code example that you can probably follow without trouble:

# File extensions.rb
internal {
case extension
when 101...200
employee = User.find_by_extension extension
if employee.busy? then voicemail extension
dial employee, :for => 10.rings
voicemail unless last_call_successful?
when 888
play weather_report("Dallas Texas")
when 999 then +joker_voicemail
joker_voicemail {
play %w"a-connect-charge-of 22
cents-per-minute will-apply"
sleep 2.seconds
play 'just-kidding-not-upset'

There are thousands of amazing things that could be done with Asterisk and Adhearsion to improve productivity, improve customer service, and drive innovation. For example, you could tie it into your customer relationship management system so that when someone calls, their purchase and support history pop-up automatically on your screen. Or, you could setup complex call groups that would only ring certain groups of employees for a given incoming phone number.

For some great background information on Adhearsion, there are a couple of things you can checkout from its creator, Jay Phillips. First, there’s an great article on O’Reilly’s website called Sophisticated Asterisk Development with Adhearsion. Second, there’s an online video of Jay’s Ruby Hoedown 2007 presentation titled Next-Gen VoIP Development with Ruby and Adhearsion.