+ All Categories
Home > Technology > respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

Date post: 27-Jun-2015
Category:
Upload: jpalley
View: 5,071 times
Download: 1 times
Share this document with a friend
Description:
Presented at RailsConf 2007, this presentation introduces the Telegraph plugin for briding Asterisk and Rails. Telegraph brings the beauty of Rails programming to the VoIP world. It reshapes the mess of the Asterisk API into MVC cleanliness allowing the rapid development of Rails based voice and web applications.
Popular Tags:
27
respond_to :voice The Convergence of Web and Voice Interfaces with Rails and Asterisk or An introduction to Telegraph - Voice done MVC Jonathan Palley Co-Founder, Idapted Inc. [email protected]
Transcript
Page 1: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

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.

[email protected]

Page 2: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

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

It’s about the applications.

Page 4: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

Voice is Another Interface for Your Application

Page 5: respond_to :voice - the convergence of voice and web interfaces with Rails and Asterisk

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

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

• 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

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

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

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

• 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

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

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

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

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

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

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

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

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

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

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

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

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

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

• 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

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

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


Recommended