Integrating Voice through Adhearsion Luca Pradovera Telephony Devroom FOSDEM 2013 Brussels, February 3rd, 2013 venerdì 1 marzo 13
Dec 18, 2014
Integrating Voice through Adhearsion
Luca PradoveraTelephony Devroom
FOSDEM 2013Brussels, February 3rd, 2013
venerdì 1 marzo 13
Who am I?
• Italian computer engineer
•No, I didn’t vote for Berlusconi
• Voice application developer at Mojo Lingo LLC, Atlanta (GA)
•Managed to learn Ruby without doing Rails work!
venerdì 1 marzo 13
What is Adhearsion?
• Ruby voice application framework
• Provides logic for telephony apps
•Open source and managed by a Foundation
• Version 2.2.1 released on 06/01
• 2.0 was released in April 2012
venerdì 1 marzo 13
ADHEARSION 101
venerdì 1 marzo 13
Supported platforms
• Ruby 1.9 only - JRuby working
• Asterisk
• FreeSWITCH
• Voxeo PRISM
• Rayo protocol support (http://rayo.org/)
venerdì 1 marzo 13
Rayo sounds tasty.
• XMPP-based protocol for 3PCC
• Call control
• Audio and media control
• Telephony primitives
venerdì 1 marzo 13
Why should I use Adhearsion?
•Dialplan applications only get you so far
• Every platform has its own syntax
• Some features are simply impossible to achieve
• It’s Ruby. Everybody likes Ruby.
venerdì 1 marzo 13
What can I do?
venerdì 1 marzo 13
How does Ahn talk to platforms?
• Asterisk: AsyncAGI (AMI)
• FreeSWITCH: Inbound Event Socket
• PRISM: Pure Rayo
venerdì 1 marzo 13
Anatomy of an app
• Configuration
• Call Controllers
• Routing
• The ahn command: create, daemon, start, stop, restart, generate, help, version
venerdì 1 marzo 13
Call Controllers
class SimpleController < Adhearsion::CallController def run answer play "tt-weasels" hangup endend
•Hold the application logic (dialplan)
• The #run method is used to invoke the controller
venerdì 1 marzo 13
Other features
• Playback, menus, user input, recording
• Configuration system
• Plugin architecture
• Routing
• Testability
venerdì 1 marzo 13
Sounds great, huh?
venerdì 1 marzo 13
Demo time!class DemoController < Adhearsion::CallController def run answer menu "#{Adhearsion.config.platform[:root]}/sounds/demo-menu", :timeout => 5.seconds, :tries => 3 do match 1 do enter_number end match 2 do record_message end
timeout do play "#{Adhearsion.config.platform[:root]}/sounds/menu-timeout" end invalid do play "#{Adhearsion.config.platform[:root]}/sounds/menu-invalid" end
failure do play "#{Adhearsion.config.platform[:root]}/sounds/menu-failure" hangup end end end
def enter_number number = ask "#{Adhearsion.config.platform[:root]}/sounds/please-enter", :limit => 1, :timeout => 5.seconds if number play "#{Adhearsion.config.platform[:root]}/sounds/you-entered" play "digits/#{number}" end end
def record_message play "#{Adhearsion.config.platform[:root]}/sounds/please-speak-after" record_result = record :start_beep => true, :max_duration => 5_000 logger.info "Recording saved to #{record_result.recording_uri}" play record_result.recording_uri.gsub(/file:\/\//, '').gsub(/\.wav/, '') endend
venerdì 1 marzo 13
Event support
• Adhearsion allows you to trace and react to events
•Guarded handlers in apps
• A specialized block for everything else
venerdì 1 marzo 13
Events over HTTPAdhearsion::Events.draw do punchblock do |event| conn = Faraday.new("http://localhost:3000") conn.post "/publish", { :event => event.inspect } if event.respond_to? :name endend
A Sinatra app with Faye can then distribute events to browsers through Websockets
venerdì 1 marzo 13
Plugins• Virginia provides a Reel interface for
Adhearsion
• It loads a Reel::App and makes all methods availablerequire 'reel'require 'reel/app'
class RequestHandler include Reel::App get('/dial') do Adhearsion::OutboundCall.originate "SIP/100" do invoke ConnectingController end [200, {}, "200 OK"] endend
venerdì 1 marzo 13
Are you sold now?
venerdì 1 marzo 13
Adhearsion in the wild
venerdì 1 marzo 13
•Mobile wireless provider and enabler (MVNO - MVNE)
•OTT applications
• In-call apps
• Adhearsion powers all call logic, billing, and features
venerdì 1 marzo 13
• Voice conversation automation and metrics
• Ad tracking
•Hosted IVR
• Lead tracking
• http://www.ifbyphone.com/
venerdì 1 marzo 13
•House remodeling
• Robo-dialing for appointment sign-up and confirmation
• Real-time data pushed to mobile CRM
•Over 5 million calls in 2012 (one every 5 seconds!)
venerdì 1 marzo 13
• Pre-paid translation service for travelers
• Billing and credit management
• Translator search with AMD detection and adaptive selection
• http://www.sostravelcard.it/
venerdì 1 marzo 13
What the future holds...
•WebRTC: Adhearsion can perform all 3PCC functions
•Multiple device tracking and switching
• Protocol convergence
• Some of these are already implemented in upcoming products
venerdì 1 marzo 13
Adhearsion 3.0
• Currently at the planning stage
• Unified communication platform
• Better ASR support
• Revamped component structure
venerdì 1 marzo 13
AdhearsionConf 2013
• 2012 edition had over 120 attendants
• 2 days, 15 presentations, training, beer
• http://adhearsionconf.com/
venerdì 1 marzo 13
Thank you!
• http://adhearsion.com/
• http://mojolingo.com/
•@adhearsion, @mojolingo
•@lucaprado
•Demo source available at https://github.com/polysics/fosdem2013
venerdì 1 marzo 13