1. Integrating Voice
through Adhearsion
Luca Pradovera
Telephony Devroom
FOSDEM 2013
Brussels, February 3rd, 2013
venerdì 1 marzo 13
2. 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
3. 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
5. Supported platforms
• Ruby 1.9 only - JRuby working
• Asterisk
• FreeSWITCH
• Voxeo PRISM
• Rayo protocol support (http://rayo.org/)
venerdì 1 marzo 13
6. Rayo sounds tasty.
• XMPP-based protocol for 3PCC
• Call control
• Audio and media control
• Telephony primitives
venerdì 1 marzo 13
7. 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
9. How does Ahn talk to
platforms?
• Asterisk: AsyncAGI (AMI)
• FreeSWITCH: Inbound Event Socket
• PRISM: Pure Rayo
venerdì 1 marzo 13
10. Anatomy of an app
• Configuration
• Call Controllers
• Routing
• The ahn command: create, daemon,
start, stop, restart, generate, help,
version
venerdì 1 marzo 13
11. Call Controllers
• Hold the application logic (dialplan)
• The #run method is used to invoke the
controller
class SimpleController < Adhearsion::CallController
def run
answer
play "tt-weasels"
hangup
end
end
venerdì 1 marzo 13
12. Other features
• Playback, menus, user input, recording
• Configuration system
• Plugin architecture
• Routing
• Testability
venerdì 1 marzo 13
14. Demo time!
class DemoController < Adhearsion::CallController def enter_number
def run number = ask "#{Adhearsion.config.platform[:root]}/sounds/
answer please-enter", :limit => 1, :timeout => 5.seconds
menu "#{Adhearsion.config.platform[:root]}/sounds/demo- if number
menu", :timeout => 5.seconds, :tries => 3 do play "#{Adhearsion.config.platform[:root]}/sounds/you-
match 1 do entered"
enter_number play "digits/#{number}"
end end
match 2 do end
record_message
end def record_message
play "#{Adhearsion.config.platform[:root]}/sounds/please-
timeout do speak-after"
play "#{Adhearsion.config.platform[:root]}/sounds/menu- record_result = record :start_beep => true, :max_duration
timeout" => 5_000
end logger.info "Recording saved to
invalid do #{record_result.recording_uri}"
play "#{Adhearsion.config.platform[:root]}/sounds/menu- play record_result.recording_uri.gsub(/file:///,
invalid" '').gsub(/.wav/, '')
end end
end
failure do
play "#{Adhearsion.config.platform[:root]}/sounds/menu-
failure"
hangup
end
end
end
venerdì 1 marzo 13
15. 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
16. Events over HTTP
Adhearsion::Events.draw do
punchblock do |event|
conn = Faraday.new("http://localhost:3000")
conn.post "/publish", { :event => event.inspect } if event.respond_to? :name
end
end
A Sinatra app with Faye can then distribute events to
browsers through Websockets
venerdì 1 marzo 13
17. Plugins
• Virginia provides a Reel interface for
Adhearsion
• It loads a Reel::App and makes all
methods available
require 'reel'
require 'reel/app'
class RequestHandler
include Reel::App
get('/dial') do
Adhearsion::OutboundCall.originate "SIP/100" do
invoke ConnectingController
end
[200, {}, "200 OK"]
end
end
venerdì 1 marzo 13
20. • Mobile wireless provider and enabler
(MVNO - MVNE)
• OTT applications
• In-call apps
• Adhearsion powers all call logic, billing,
and features
venerdì 1 marzo 13
21. • Voice conversation automation and
metrics
• Ad tracking
• Hosted IVR
• Lead tracking
• http://www.ifbyphone.com/
venerdì 1 marzo 13
22. • 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
23. • 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
24. 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
25. Adhearsion 3.0
• Currently at the planning stage
• Unified communication platform
• Better ASR support
• Revamped component structure
venerdì 1 marzo 13
26. AdhearsionConf
2013
• 2012 edition had over 120 attendants
• 2 days, 15 presentations, training, beer
• http://adhearsionconf.com/
venerdì 1 marzo 13
27. Thank you!
• http://adhearsion.com/
• http://mojolingo.com/
• @adhearsion, @mojolingo
• @lucaprado
• Demo source available at https://
github.com/polysics/fosdem2013
venerdì 1 marzo 13