Friday, July 13, 2007

API of the Week : Adhearsion

OK, so maybe Adhearsion isn't a Web API, but it certainly is a programming API, and if you're involved in emerging telephony, you ought to know what it is.

Adhearsion is a Ruby library that takes over Asterisk's internal processing of calls and puts them into the Ruby framework. You setup the dial plan of an Asterisk server to forward all calls to the Adhearsion server, either running locally or an a remote server. Once the call hits the Adhearsion server, you have the call in Ruby Land, and the world is your burrito. What can you do from there? Tons. You have at your disposal all of the Ruby integration with databases, UIs, web services calls, etc.

An example would be a hyper dial plan, that would connect calls, but also provide a gateway out to a Web Services function that would retrieve the latest weather report. Here's what it looks like :

#This is an example extensions.rb file which
# would handle how calls are processed by
# Asterisk. This is all completely valid Ruby
internal {
case extension
when 100...200
callee = User.find_by_extension extension
unless callee.busy? then dial callee
else
voicemail extension

when 111 then exec :meetme

when 888
play weather_report('Dallas, Texas')

when 999
play %w(a-connect-charge-of 22
cents-per-minute will-apply)
sleep 2.seconds
play 'just-kidding-not-upset'
check_voicemail
end
}

Now, here's a proof point. When I was at the Cluecon show, I told the crowd about the demonstration application I wrote to do a daily collection of body weight for Congestive Heart Failure cases. As I was describing it to the crowd, Jay - the author of Adhearsion - implemented the same application in Adhearsion as I was speaking. It didn't have the insane scale that my Amazon EC2 and Voxeo implementation did, but it was an amazingly complete implementation. Completely impressive stuff. Check it out.

Technorati Tags: , ,

2 comments:

lexplay said...

Hi Thomas,

I'm a big fan of your blog and the information you share about telecom APIs, etc. Do you have a link to information about your cluecon demo?

I'm playing around with Voxeo and CCXML and I'd like to know what you worked on. thanks

Thomas Howe said...

Hey! Thanks for the encouragement!

Yes, I would love to. I'm chin deep in bringing a enterprise messaging gateway to life for a client, but as soon as I'm done (like next week?), I'll share big time.

Thomas