respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk
-
Upload
jpalley -
Category
Technology
-
view
5.075 -
download
1
description
Transcript of respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk
![Page 1: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/1.jpg)
respond_to :voice
The Convergence of Web and Voice Interfaces with Rails and Asterisk
or
An introduction to Telegraph - Voice done MVC
Jonathan PalleyCo-Founder, Idapted Inc.
![Page 2: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/2.jpg)
VoIP Development Is NOT about cheaper phone calls
Already done and telcos can do cheaper...
![Page 3: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/3.jpg)
It’s about the applications.
![Page 4: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/4.jpg)
Voice is Another Interface for Your Application
![Page 5: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/5.jpg)
The Plan
• Voice as the next Killer Interface
• The Voice/Web Analogy
• Asterisk in 5 minutes
• Telegraph - Bridging Voice and Rails
![Page 6: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/6.jpg)
Why add voice? Why now?
Only Recently Available
Ripe for Innovation
Ubiquitous
![Page 7: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/7.jpg)
• DB Driven applications (Rails/etc.)
• Phone system (VoIP/OSS PBX)
Lowered Barriers to Voice App Development
![Page 8: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/8.jpg)
Space To Innovate
• Existing Voice Design Thinking = Phone Prompt Hell
• Few applications merge voice and web. Most users do.
• Underlying OSS Servers/Technology Available
![Page 9: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/9.jpg)
Ubiquity
• 2.7 Billion mobile phones. 1.4 Billion fixed-lines.
• 1/3 of “Internet Users” access the internet from their mobile phone.
• Each of those 4.1 billion users can be uniquely identified by a standardized numerical system
Source: http://communities-dominate.blogs.com/brands/2007/02/mobile_the_7th_.html
![Page 10: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/10.jpg)
Technology Web VoIP
Protocol
HTTPFTPRTPetc
SIP - Ind. StandardIAX - Asterisk onlyH.323 - Obsolete
Jingle - GtalkSkype - Proprietary
Codecgzip
jpg/gif/etc.wmv/rm/etc
g.711 - high bandwidthgsm - medium bandwidth
g.729 - low bandwidthiLBC - low bandwidth
Server apache/lighttpd asterisk
Interactivity CGI AGIAMI
The Voice/Web Analogy: Technology
![Page 11: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/11.jpg)
• OSS Multipurpose PBX
• Very powerful/flexible
• Relatively Stable
• Very messy to deal with
Asterisk: The 5min Tutorial
![Page 12: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/12.jpg)
Concept Explanation
Channel A “Channel” in Asterisk is what can setup/receive calls
Dialplan
Determines what to do with call. Given a call and a dialed number, what sounds should be played, input
received or connections made? Written in a “BASIC like language.
AGI Stdin/out or TCP method that allows external applications to dynamically write dialplans
AMI Method to send commands to Asterisk (independent of calls) and listen for stateful events
Asterisk: Key Concepts
![Page 13: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/13.jpg)
Asterisk Server
PSTN Network
Origination/Termination
Server
SIP/IAX Rails/Telegraph
Server
AGI/AMI
VoIP Clients
SIP/IAX
AnalogInterface
Cards
Zaptel/OtherPSTN Phones/Network
Voice System Setup
![Page 14: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/14.jpg)
Existing Ruby/Asterisk Integration Tools
RAGIJust for AGI.
Not well integrated into railsNot active.
RAMIAMI.
No Rails Integration.Not Active.
AdhearsionActive. Real Apps?
Good for writing pure voice appsNot tied to Rails or concept of shared voice/web
interfaces.
![Page 15: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/15.jpg)
Introducing Telegraph
• Extracted from Real Application (Idapted’s distributed voice system for oral language training - EnglishQuad) with input of others.
• Started with RAGI/RAMI
• Tightly Integrated with Rails/Web Interfaces.
• Embraces the Voice/Web analogy.
![Page 16: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/16.jpg)
Telegraph 1: Making Interfaces (AGI)
• Setup Dialplan
exten => 1, 1, AGI(agi://localhost/my_route?param1=value)
• Add respond_to and voice DSL.
wants.voice do render_voice do |voice| voice.play “hello-world” voice.link_to_dtmf 'bank-lineitem-menu' do link 1, :action=>"new" link 2, :action=>"list" link 3, :action=>"index" end endend
![Page 17: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/17.jpg)
Demo I: Adding Voice Interface to Standard Scaffolding Application.
Look at account controller in demo app. Description/docs attelegraph.rubyforge.org
![Page 18: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/18.jpg)
Sessions can be shared between voice and web. Making it easy to link
voice and web actions
![Page 19: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/19.jpg)
Demo II: Phone Number Confirmation
Look at verify_number controller in demo app. Description/docs attelegraph.rubyforge.org
![Page 20: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/20.jpg)
Telegraph II: Manipulating the System (AMI)(follows CRUD)
Create CallsRecordings
ReadCall/Channel/Queue Status
VariablesMailbox
UpdateContext
RecordingVariable
Delete Call (Hangup)Recording
![Page 21: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/21.jpg)
Telegraph II: Deal with system info
• Create a model-like class:
class VoiceConnection < Telegraph::AsteriskManager
end
• Use CRUD technique’s to get Asterisk parameters, place calls, etc. Examples:
VoiceConnection.create(:call, :channel=>”SIP/dave”, :context=>”some_context”, :exten=>3)
VoiceConnection.destroy(:call, :channel=>my_channel)
VoiceConnection.find(:sip_peer, :peer=>”SIP/joe”)
VoiceConnection.update(:monitor, :channel=>my_channel, :file=>new_file)
![Page 22: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/22.jpg)
Demo III: Placing a call and getting channel status
Look at dialer controller in demo app. Description/docs attelegraph.rubyforge.org
![Page 23: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/23.jpg)
Telegraph III: Dealing with stateful events
• Add a special AMILogic class to your project
• Add methods to deal with events, use params to access info sent by asterisk.
• For example
class AmiLogic < Telegraph::AMIHandler
def link
puts "Linked #{params[:channel1]} to #{params[:channel2]}"
end
end
![Page 24: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/24.jpg)
Look at documentation on AMI Events at telegraph.rubyforge.orgfor Examples
![Page 25: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/25.jpg)
• AGI and AMI Events handled by independent rails processes that can be load balanced.
• AMI runs through distributed Ruby process.
• Deployment/daemonization very easy. Like mongrel, works with Capistrano
Easy Deployment/Scaling
![Page 26: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/26.jpg)
Thanks To Rabble and John Shulty for their contributions to the source.
Contact Me:Jonathan Palley
[email protected]: jpalley, gizmo: jonathanpalley
idapted.com || englishquad.com
telegraph.rubyforge.orgtalkingruby.org
Questions/Discussion
![Page 27: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk](https://reader034.fdocuments.net/reader034/viewer/2022042614/558e0ccf1a28ab6a318b4667/html5/thumbnails/27.jpg)
Appendix: The Voice/Web Analogy: Interfaces
Concept Web Voice
Interacting with system Web Browser IVR Like Systems
Get/set info system Database/Models DB + Voice Connection Parameters
Handling Stateful Events -Handling connections/
disconnections/registrations