AddThis Social Bookmark Button

Listen Print Discuss

Hacking Asterisk and Rails with RAGI

by Joe Heitzeberg
12/19/2005

Chances are that by now you are using Skype, Yahoo Instant Messenger with Voice, Google Talk, or one of the other PC VoIP phones that let you talk for free over the internet. You might also be a customer of Vonage, AT&T CallVantage, BroadVoice, or one of the other VoIP-based land-line replacements that give you flat-rate, unlimited calling and tons of great features like voicemail-to-email or click-to-call.

Thanks to VoIP, now anyone can talk for free; I get that. But what's next? Free calls and voicemail-to-email are just the beginning, right? You bet! Open protocols, low telephony cost, and a rapidly growing installed base of VoIP-capable PCs, phones, and networks mean a wave of innovation and opportunity, and we're just at the beginning.

In this world, hackers and entrepreneurs everywhere ought to be able to pioneer vastly new and powerful services, such as:

  • Mashing up RSS and voice to create a better kind of 411.
  • eBay virtual call centers: High-volume seller and not around to answer your inquiries? Click to provision some virtual call center agents across the globe.
  • Temporary phone numbers: Rent a temporary phone number for a week to use on Craigslist. Forward all calls to your real phone and log all messages on the Web.
  • Click and talk with other people who are viewing a given web page.
  • Learn Chinese: Fill out your profile, and we'll connect you with a qualified language instructor.

Joe Heitzeberg
Ruby on Rails with Asterisk

O'Reilly Emerging Telephony Conference 2006

O'Reilly Emerging Telephony Conference
January 24-26 2006
San Francisco Airport Marriott

You might have read about Google's latest foray into "Click to Dial" advertising. There is no reason you can't build a similar service.

In this article, I'll provide a quick overview of how Asterisk, the open source PBX, can be used as a general-purpose "telephony protocol server," and can be connected to Ruby on Rails to create a rapid prototyping environment for creating next-generation VoIP applications and services.

Asterisk in 30 Seconds

Asterisk is an open source PBX. It is designed to handle all of the basic office phone services an ordinary PBX might handle and more, including call routing, conferencing, call forwarding, and three-way calling. It also speaks more than half a dozen VoIP protocols and codecs, and runs on Linux. You might use Asterisk to:

  • Start a consulting business installing 25-person office phone systems.
  • Build the best home phone system ever. Calling China? Have the phone warn you, "It is 2 A.M. in China, are you sure you want to continue this call?" Away for the day? Have all your calls forwarded to your cell phone (unless they're from your employer; then play a Ferris Bueller movie audio clip).
  • Build a banking IVR product to sell.
  • Help your local politician get elected by auto-dialing a list of phone numbers and playing a message.

Ruby on Rails in a Jiffy

If you are building web apps, then you might consider running (don't walk) to get yourself outfitted with Ruby On Rails, a great new web-application development framework by David Heinemeier Hansson and many open source contributors. Rails is framework for creating database-driven web sites that manages to cut out a lot of the grunt work typically associated with Java- or Perl-based frameworks. Rails uses the Ruby language, which will feel familiar to any Java or C# programmer, and includes tons of libraries to help with common web development tasks and with newer things like Ajax.

Bird's-Eye View

Hopefully you are starting to get the picture: hosted VoIP-enabled apps that connect to VoIP phones like Skype and real phones, and operate on the same kind of open source development stack that powers the Web. Say goodbye to proprietary and closed telephony hardware and hosted voiceXML platforms that tie you to someone else's voice platform. Plug a Linux box into the internet, grab a domain name, and get in business.

figure 1

Diagram Notes:

  • You: Your Linux server is hosted on the internet, but instead of just serving web browsers, you also connect to phones and VoIP phones to serve mobile users, phone users, and VoIP users with voice interfaces.
  • VoIP/PSTN service: Providers such as Level3 and GlobalCrossing and a multitude of smaller providers such as VoipJet, VoicePulse, and LES.net provide the capability to place and receive calls to regular phones via the internet (it's like SkypeOut, but from your server). Any mobile or land-line phone can be reached at very low cost.
  • VoIP clients: Currently, Gizmo is the most open VoIP client out there, and the others (i.e. Skype and GoogleTalk) won't accept directly connected SIP traffic. However, as a workaround, you can connect to users of SkypeIn (the dotted line), or use Jabber for a limited interaction with GoogleTalk.

Pages: 1, 2

Next Pagearrow