SlideShare uma empresa Scribd logo
1 de 33
VOIP and Ruby


  The Convergence of Web and Voice
Applications using Open Source Software




             Justin Grammens
            Localtone Interactive
           justin@localtone.com
VOIP is NOT About Cheap
       Phone Calls




         Other companies are already
         doing this cheaper and better.
VOIP Applications!




It's about the applications
     that we can build!
What We Will Cover

    Why do VOIP now?
➢




    Asterisk
➢




    Adhearsion
➢




    Telegraph
➢




    Demos
➢
Why Now?

Only recently has good Open Source Software
      been developed ( Rails / Asterisk )

         Telecoms are slow to react

   Few applications merge voice and web

        Cell phone are everywhere!
Why Now?
    2.7 Billion mobile phones. 1.4 Billion fixed-lines.
➢




  1/3 of “Internet Users” access the internet from
➢

their mobile phone.

  iPhone has shown consumers why they need
➢

the interactive internet on their phone. Others will
follow.

 Most phone users can be identified by a
➢

standardized numerical system.
VOIP / Web Analogy
Technology               Web                   VOIP
                    HTTP
Protocol                               SIP – Industry Standard
                    FTP                IAX – Asterisk Specific
                    RTP                H.323 – Obsolete
                                       Jingle – Gtalk
                                       Skype - Proprietary

                   gzip, jpg, gif,     g.711 – high bandwidth
Codec
                   mp3, ogg, wma,      gsm – medium bandwidth
                   flv, mpeg, avi      g.729 – low bandwidth

                   Apache / Lighttpd   Asterisk, Freeswitch
Server

                                       AGI – Asterisk Gateway
Interactivity                          Interface
                   CGI
                                       AMI – Asterisk Manager
                                       Interface
Asterisk

    + Open Source Private Branch Exchange (PBX)
➢




    + Very powerful and flexible
➢




    + Relatively Stable
➢




  - Messy to deal with in terms of extending
➢

functionality.

    +++ Free!
➢
Asterisk : Terminology
  Channel – A channel is what can setup and
➢

receive calls.

  Dialplan – Script of what to do with a call. Written
➢

in the asterisk macro language.

 AGI – Stdin/out TCP method allowing external
➢

applications to dynamically write dialplans.

  AMI – Allows sending of commands and listen
➢

for stateful events.
Typical Voice System
                VOIP
                Clients      SIP



                                                            Rails
            Origination/
                                                              /
                                                  AGI /
            Termination
 PSTN
                           SIP / IAX               AMI
                                       Asterisk
Network       Server
                                                          Adhearsion
                                       Server
                                                              /

                                                          Telegraph
              Analog
PSTN                         Zaptel
             Interface
Network                     / Other
               Card
Asterisk Dialplan Language
[demo] ; Sample from Asterisk configuration extensions.conf file
;
; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1)           ; Wait a second, just for fun
exten => s,n,Answer            ; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5)         ; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
exten => s,n(restart),BackGround(demo-congrats)           ; Play a congratulatory message
exten => s,n(instruct),BackGround(demo-instruct); Play some instructions
exten => s,n,WaitExten              ; Wait for an extension to be dialed.

exten => 2,1,BackGround(demo-moreinfo)        ; Give some more information.
exten => 2,n,Goto(s,instruct)

exten => 3,1,Set(LANGUAGE()=fr)      ; Set language to french
exten => 3,n,Goto(s,restart)    ; Start with the congratulations

exten => 1000,1,Goto(default,s,1)
Difficulties in Asterisk
    Conditional Loops            Error Handling
➢                            ➢


    Complex Data                 Date and time
➢                            ➢

    Structure                    handling
    Database / LDAP              RegEx Pattern
➢                            ➢

    Integration                  Matching
    Extending the                Variables
➢                            ➢

    language                     Object Oriented
                             ➢

    Portability - Asterisk       Design
➢

    v.s Freeswitch, etc.
Ruby / Asterisk Integration Tools
 RAGI – Just for AGI. Not integrated with Rails.
➢

No longer active.

  RAMI – Just for Management Interface. No Rails
➢

Integration. Not Active.

 Adhearsion – Active. Good for writing pure voice
➢

applications. Not tied with Rails (but can be
without too much effort).

 Telegraph – Active. Tightly integrated with Rails.
➢

Embraces the Voice/Web Analogy.
Adhearsion
  Standalone server that talks with Asterisk

  Developed by Jay Phillips of Codemecca

                Open Source

           Current version is 0.7.7

Development on 0.8 is nearly complete. Lots of
              new changes.
Adhearsion
 Put the line below in extensions.conf
Tells Asterisk to process all calls by our
           Adhearsion server

  exten => _X.,1,Agi(agi://127.0.0.1)

  or... when extension 888 is dialed.

  exten => 888,1,Agi(agi://127.0.0.1)
Adhearsion - dialplan.rb
adhearsion {
  play %w(press-1 for minneapolis press-2 for chicago or
press-3 for dallas weather otherwise-press 4)
  selection = input()
  w = new_weather
  case selection
  when '1' then play w.weather_report(quot;Minneapolis, MNquot;)
  when '2' then play w.weather_report(quot;Chicago, ILquot;)
  when '3' then play w.weather_report(quot;Dallas, TXquot;)
  else
   simon = new_simon_game
   simon.start
  end
}
Adhearsion - Demos


SIP Phone
                                     Adhearsion
                      Asterisk
  XLite
                                      dialplan.rb
                  extensions.conf
                                     adhearsion {
                   [ adhearsion ]
                                        code..
                                        code..
                  exten => 8000,1,
                                          }
                    Agi(agi://...)
Adhearsion - Demo
Notes:
Start up Asterisk : sudo asterisk
Show asterisk CLI.

Start up Adhearsion 0.8 Server :
~/development/adhersion/trunk/bin/ahn start .
in the rumadhearsion directory

Point Xlite Phone to Localhost dial extension 8000
Adhearsion – Weather Demo
Demo #1 - Weather - Parses data from
Yahoo RSS feed <yweather:forecast
day=quot;Monquot; date=quot;31 Dec 2007quot; low=quot;6quot;
high=quot;19quot; text=quot;Flurriesquot; code=quot;13quot; />

rep = %W(weather is-currently
#{w.current.temp} degrees today high
#{today.high} low #{today.low}) +
w.current.desc
Adhearsion – Simon Says

Demo #2 - Play Simon Says Game

def verify_attempt
   if attempt_correct?
     call_context.play 'good'
   else
     call_context.play %W(#{number.size - 1}
times wrong-try-again-smarty)
     reset
   end
  end
Adhearsion
         Write Ruby in our dial
     ●

         plans!
         Ability to use any
     ●

         Ruby gems we need
         (Active Record, etc.)
         Test and debug our
     ●

         application in
         isolation.
         Bring OO practices to
     ●

         VOIP development
Adhearsion
         It's abstracted and
     ●

         portable across other
         PBXes
         It's simple
     ●


         It's extensible
     ●


         It's readable
     ●


         It's maintainable
     ●


         It's fun!
     ●
Adhearsion

              Where's the Rails?

Not directly integrated with Rails – by choice.
Written to stand on it's own, but you can link in
       your models using ActiveRecord.

  Looking for VOIP in the MVC framework?
      Look no further than Telegraph...
Telegraph
Written by a company named Idapted.
➢




 Extracted from production application ( Idapted's
➢

distributed voice system for English language
learning – EnglishQuad )

    Started with RAGI / RAMI
➢




    Tightly Integrated with the Rails/Web Interface
➢




    They claim it “embraces the Voice/Web analogy”
➢
Telegraph
Installs into any Rails project as a plugin

script/plugin install
svn://rubyforge.org/var/svn/telegraph/trunk

start up the server

script/agi_server – Interfaces with the gateway
(incoming calls)
script/ami_server – Interfaces with the Asterisk
manager
Telegraph – Banking Demo


                          Rails
SIP Phone
                        Application
  XLite

             Asterisk




                        AGI Server
Telegraph

Add this to your extensions.conf
exten => s, n, AGI(agi://localhost/account)

respond_to do |wants|
   #r index.html
   wants.html { render }
   # Telegraph allows render_voice
    # which uses the index.voice file
   wants.voice{ render_voice }
end
Banking Demo

index.voice:

voice.play quot;welcome-to-demo
#{say_amount(@balance)}quot;

voice.link_to_dtmf 'banking-main-menu' do
  link 1, :action=>'new'
  link 2, :action=>'list'
  link :default, :action=>'index'
end
Telegraph - Demo

Start up telegraph server :
telegraph/banking_demo

ruby script/asterisk_server
ruby script/server

Visit http://localhost:3000/account

Dial Extension 9000
Real World Application
           eStara
           Offers a service where a
            user browsing a site
            can enter their phone
            number. The system
            will dial their number,
            ask the person to hold
            and then dial customer
            service.
           We'll do this.
Demo Topology


  Cell
                   Origination/                            Rails Application
 Phone
                   Termination
                     Server
      PSTN                           Internet
                                                Asterisk


                                                                 AGI


                                                                 AMI
Demos:
1. Using the browser to initiate phone call.
2. “Who Wants To Be A Billionaire” game.
Demo – Using PSTN
 Telegraph Demos -
➢

➢ Use the browser to initiate a wakeup call.

➢ Use the browser to initiate phone calls to 10 digit

phone numbers and bridge the calls
➢ Use the browser to initiate a call and verify

correct code was entered.

 Adhearsion Demo -
➢

➢ Adhearsion – My “Who Wants To Be A

Billionaire” application.
Resources
http://rubyhoedown2007.confreaks.com/session03.htm

http://www.slideshare.net/jpalley/respondto-voice-
the-convergence-of-voice-and-web-interfaces-
with-rails-and-asterisk

http://adhearsion.com/

http://telegraph.rubyforge.org

http://www.voip-info.org

Mais conteúdo relacionado

Mais procurados

Ambari: Agent Registration Flow
Ambari: Agent Registration FlowAmbari: Agent Registration Flow
Ambari: Agent Registration Flow
jsposetti
 
Overview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing EnvironmentsOverview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing Environments
Mark Hinkle
 

Mais procurados (11)

Asterisk sip channel performance
Asterisk sip channel performanceAsterisk sip channel performance
Asterisk sip channel performance
 
Kamailio practice Quobis-University of Vigo Laboratory of Commutation 2012-2...
Kamailio practice Quobis-University of Vigo Laboratory of Commutation  2012-2...Kamailio practice Quobis-University of Vigo Laboratory of Commutation  2012-2...
Kamailio practice Quobis-University of Vigo Laboratory of Commutation 2012-2...
 
Ambari: Agent Registration Flow
Ambari: Agent Registration FlowAmbari: Agent Registration Flow
Ambari: Agent Registration Flow
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16x
 
Otto AI
Otto AIOtto AI
Otto AI
 
SIP in action Itexpo West
SIP in action Itexpo WestSIP in action Itexpo West
SIP in action Itexpo West
 
Cisco APIs: An Interactive Assistant for the Web2Day Developer Conference
Cisco APIs: An Interactive Assistant for the Web2Day Developer ConferenceCisco APIs: An Interactive Assistant for the Web2Day Developer Conference
Cisco APIs: An Interactive Assistant for the Web2Day Developer Conference
 
BlackHat EU 2012 - Zhenhua Liu - Breeding Sandworms: How To Fuzz Your Way Out...
BlackHat EU 2012 - Zhenhua Liu - Breeding Sandworms: How To Fuzz Your Way Out...BlackHat EU 2012 - Zhenhua Liu - Breeding Sandworms: How To Fuzz Your Way Out...
BlackHat EU 2012 - Zhenhua Liu - Breeding Sandworms: How To Fuzz Your Way Out...
 
Overview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing EnvironmentsOverview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing Environments
 
Tales About Scala Performance
Tales About Scala PerformanceTales About Scala Performance
Tales About Scala Performance
 
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
 

Semelhante a Adhearsion and Telegraph Framework Presentation

Asterisk - Glen Bastes
Asterisk - Glen BastesAsterisk - Glen Bastes
Asterisk - Glen Bastes
soss
 
My speech at AstriCon 2007
My speech at AstriCon 2007My speech at AstriCon 2007
My speech at AstriCon 2007
stefanocarlini
 
Tc 2008 11 19
Tc 2008 11 19Tc 2008 11 19
Tc 2008 11 19
jeffiel
 
Enabling rcs service delivery telesemana august2012 rev2_mx
Enabling rcs service delivery telesemana august2012 rev2_mxEnabling rcs service delivery telesemana august2012 rev2_mx
Enabling rcs service delivery telesemana august2012 rev2_mx
Rafael Junquera
 
Asterisk quick start Guide
Asterisk quick start GuideAsterisk quick start Guide
Asterisk quick start Guide
King Asterisk
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
grandyho
 

Semelhante a Adhearsion and Telegraph Framework Presentation (20)

Ruby voip
Ruby voipRuby voip
Ruby voip
 
respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...
 
Pwning Your Phone with Adhearsion and Asterisk
Pwning Your Phone with Adhearsion and AsteriskPwning Your Phone with Adhearsion and Asterisk
Pwning Your Phone with Adhearsion and Asterisk
 
Stuff we noticed while building "Asterisk in the cloud"
Stuff we noticed while building "Asterisk in the cloud"Stuff we noticed while building "Asterisk in the cloud"
Stuff we noticed while building "Asterisk in the cloud"
 
Asterisk - Glen Bastes
Asterisk - Glen BastesAsterisk - Glen Bastes
Asterisk - Glen Bastes
 
My speech at AstriCon 2007
My speech at AstriCon 2007My speech at AstriCon 2007
My speech at AstriCon 2007
 
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/HeartbeatBuild HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGIPhpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
 
Using Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitchUsing Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitch
 
Tuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on MobicentsTuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on Mobicents
 
CloudCrowd - RazorFish Presentation on Building Hybrid Public/Private Cloud
CloudCrowd - RazorFish Presentation on Building Hybrid Public/Private CloudCloudCrowd - RazorFish Presentation on Building Hybrid Public/Private Cloud
CloudCrowd - RazorFish Presentation on Building Hybrid Public/Private Cloud
 
Cloud Crowd - Mandhir Gidda Razorfish " Building a Public / Private Hybrid Cl...
Cloud Crowd - Mandhir Gidda Razorfish " Building a Public / Private Hybrid Cl...Cloud Crowd - Mandhir Gidda Razorfish " Building a Public / Private Hybrid Cl...
Cloud Crowd - Mandhir Gidda Razorfish " Building a Public / Private Hybrid Cl...
 
Twilio Web Service API for building Voice Applications
Twilio Web Service API for building Voice ApplicationsTwilio Web Service API for building Voice Applications
Twilio Web Service API for building Voice Applications
 
Tc 2008 11 19
Tc 2008 11 19Tc 2008 11 19
Tc 2008 11 19
 
Enabling rcs service delivery telesemana august2012 rev2_mx
Enabling rcs service delivery telesemana august2012 rev2_mxEnabling rcs service delivery telesemana august2012 rev2_mx
Enabling rcs service delivery telesemana august2012 rev2_mx
 
Asterisk quick start Guide
Asterisk quick start GuideAsterisk quick start Guide
Asterisk quick start Guide
 
Asterisk quick start Guide
Asterisk quick start Guide Asterisk quick start Guide
Asterisk quick start Guide
 
02 asterisk - the future of telecommunications
02   asterisk - the future of telecommunications02   asterisk - the future of telecommunications
02 asterisk - the future of telecommunications
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
 
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
 

Mais de Justin Grammens

Mais de Justin Grammens (18)

Scope Creep - Damned if I Do, Damned if I Don't
Scope Creep - Damned if I Do, Damned if I Don'tScope Creep - Damned if I Do, Damned if I Don't
Scope Creep - Damned if I Do, Damned if I Don't
 
Deep Learning with TensorFlow
Deep Learning with TensorFlowDeep Learning with TensorFlow
Deep Learning with TensorFlow
 
Speaking at John Carrol University on the Internet of Things
Speaking at John Carrol University on the Internet of ThingsSpeaking at John Carrol University on the Internet of Things
Speaking at John Carrol University on the Internet of Things
 
NDC Minnesota 2019 - Fundamentals of Azure IoT
NDC Minnesota 2019 - Fundamentals of Azure IoTNDC Minnesota 2019 - Fundamentals of Azure IoT
NDC Minnesota 2019 - Fundamentals of Azure IoT
 
This Time, It’s Personal: Why Security and the IoT Is Different
This Time, It’s Personal: Why Security and the IoT Is DifferentThis Time, It’s Personal: Why Security and the IoT Is Different
This Time, It’s Personal: Why Security and the IoT Is Different
 
Looking into the Future: Using Google's Prediction API
Looking into the Future: Using Google's Prediction APILooking into the Future: Using Google's Prediction API
Looking into the Future: Using Google's Prediction API
 
The Internet of Things - What It Is, Where Its Headed and Its Applications
The Internet of Things - What It Is, Where Its Headed and Its ApplicationsThe Internet of Things - What It Is, Where Its Headed and Its Applications
The Internet of Things - What It Is, Where Its Headed and Its Applications
 
Internet of Things: What It Is, Where's Headed and Its Applications
Internet of Things: What It Is, Where's Headed and Its ApplicationsInternet of Things: What It Is, Where's Headed and Its Applications
Internet of Things: What It Is, Where's Headed and Its Applications
 
Collaborative Learning - The Role Communities Play in IoT
Collaborative Learning - The Role Communities Play in IoTCollaborative Learning - The Role Communities Play in IoT
Collaborative Learning - The Role Communities Play in IoT
 
Internet of Things: What it is, where it is going and how it is being applied.
Internet of Things: What it is, where it is going and how it is being applied.Internet of Things: What it is, where it is going and how it is being applied.
Internet of Things: What it is, where it is going and how it is being applied.
 
Arduino, Open Source and The Internet of Things Landscape
Arduino, Open Source and The Internet of Things LandscapeArduino, Open Source and The Internet of Things Landscape
Arduino, Open Source and The Internet of Things Landscape
 
Gobot Meets IoT : Using the Go Programming Language to Control The “Things” A...
Gobot Meets IoT : Using the Go Programming Language to Control The “Things” A...Gobot Meets IoT : Using the Go Programming Language to Control The “Things” A...
Gobot Meets IoT : Using the Go Programming Language to Control The “Things” A...
 
Physical Computing Using Go and Arduino
Physical Computing Using Go and ArduinoPhysical Computing Using Go and Arduino
Physical Computing Using Go and Arduino
 
The State of Arduino and IoT
The State of Arduino and IoTThe State of Arduino and IoT
The State of Arduino and IoT
 
Android Minnebar
Android MinnebarAndroid Minnebar
Android Minnebar
 
Android TCJUG
Android TCJUGAndroid TCJUG
Android TCJUG
 
Voice Enabled Applications
Voice Enabled ApplicationsVoice Enabled Applications
Voice Enabled Applications
 
Android Intro
Android IntroAndroid Intro
Android Intro
 

Adhearsion and Telegraph Framework Presentation

  • 1. VOIP and Ruby The Convergence of Web and Voice Applications using Open Source Software Justin Grammens Localtone Interactive justin@localtone.com
  • 2. VOIP is NOT About Cheap Phone Calls Other companies are already doing this cheaper and better.
  • 3. VOIP Applications! It's about the applications that we can build!
  • 4. What We Will Cover Why do VOIP now? ➢ Asterisk ➢ Adhearsion ➢ Telegraph ➢ Demos ➢
  • 5. Why Now? Only recently has good Open Source Software been developed ( Rails / Asterisk ) Telecoms are slow to react Few applications merge voice and web Cell phone are everywhere!
  • 6. Why Now? 2.7 Billion mobile phones. 1.4 Billion fixed-lines. ➢ 1/3 of “Internet Users” access the internet from ➢ their mobile phone. iPhone has shown consumers why they need ➢ the interactive internet on their phone. Others will follow. Most phone users can be identified by a ➢ standardized numerical system.
  • 7. VOIP / Web Analogy Technology Web VOIP HTTP Protocol SIP – Industry Standard FTP IAX – Asterisk Specific RTP H.323 – Obsolete Jingle – Gtalk Skype - Proprietary gzip, jpg, gif, g.711 – high bandwidth Codec mp3, ogg, wma, gsm – medium bandwidth flv, mpeg, avi g.729 – low bandwidth Apache / Lighttpd Asterisk, Freeswitch Server AGI – Asterisk Gateway Interactivity Interface CGI AMI – Asterisk Manager Interface
  • 8. Asterisk + Open Source Private Branch Exchange (PBX) ➢ + Very powerful and flexible ➢ + Relatively Stable ➢ - Messy to deal with in terms of extending ➢ functionality. +++ Free! ➢
  • 9. Asterisk : Terminology Channel – A channel is what can setup and ➢ receive calls. Dialplan – Script of what to do with a call. Written ➢ in the asterisk macro language. AGI – Stdin/out TCP method allowing external ➢ applications to dynamically write dialplans. AMI – Allows sending of commands and listen ➢ for stateful events.
  • 10. Typical Voice System VOIP Clients SIP Rails Origination/ / AGI / Termination PSTN SIP / IAX AMI Asterisk Network Server Adhearsion Server / Telegraph Analog PSTN Zaptel Interface Network / Other Card
  • 11. Asterisk Dialplan Language [demo] ; Sample from Asterisk configuration extensions.conf file ; ; We start with what to do when a call first comes in. ; exten => s,1,Wait(1) ; Wait a second, just for fun exten => s,n,Answer ; Answer the line exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message exten => s,n(instruct),BackGround(demo-instruct); Play some instructions exten => s,n,WaitExten ; Wait for an extension to be dialed. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. exten => 2,n,Goto(s,instruct) exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french exten => 3,n,Goto(s,restart) ; Start with the congratulations exten => 1000,1,Goto(default,s,1)
  • 12. Difficulties in Asterisk Conditional Loops Error Handling ➢ ➢ Complex Data Date and time ➢ ➢ Structure handling Database / LDAP RegEx Pattern ➢ ➢ Integration Matching Extending the Variables ➢ ➢ language Object Oriented ➢ Portability - Asterisk Design ➢ v.s Freeswitch, etc.
  • 13. Ruby / Asterisk Integration Tools RAGI – Just for AGI. Not integrated with Rails. ➢ No longer active. RAMI – Just for Management Interface. No Rails ➢ Integration. Not Active. Adhearsion – Active. Good for writing pure voice ➢ applications. Not tied with Rails (but can be without too much effort). Telegraph – Active. Tightly integrated with Rails. ➢ Embraces the Voice/Web Analogy.
  • 14. Adhearsion Standalone server that talks with Asterisk Developed by Jay Phillips of Codemecca Open Source Current version is 0.7.7 Development on 0.8 is nearly complete. Lots of new changes.
  • 15. Adhearsion Put the line below in extensions.conf Tells Asterisk to process all calls by our Adhearsion server exten => _X.,1,Agi(agi://127.0.0.1) or... when extension 888 is dialed. exten => 888,1,Agi(agi://127.0.0.1)
  • 16. Adhearsion - dialplan.rb adhearsion { play %w(press-1 for minneapolis press-2 for chicago or press-3 for dallas weather otherwise-press 4) selection = input() w = new_weather case selection when '1' then play w.weather_report(quot;Minneapolis, MNquot;) when '2' then play w.weather_report(quot;Chicago, ILquot;) when '3' then play w.weather_report(quot;Dallas, TXquot;) else simon = new_simon_game simon.start end }
  • 17. Adhearsion - Demos SIP Phone Adhearsion Asterisk XLite dialplan.rb extensions.conf adhearsion { [ adhearsion ] code.. code.. exten => 8000,1, } Agi(agi://...)
  • 18. Adhearsion - Demo Notes: Start up Asterisk : sudo asterisk Show asterisk CLI. Start up Adhearsion 0.8 Server : ~/development/adhersion/trunk/bin/ahn start . in the rumadhearsion directory Point Xlite Phone to Localhost dial extension 8000
  • 19. Adhearsion – Weather Demo Demo #1 - Weather - Parses data from Yahoo RSS feed <yweather:forecast day=quot;Monquot; date=quot;31 Dec 2007quot; low=quot;6quot; high=quot;19quot; text=quot;Flurriesquot; code=quot;13quot; /> rep = %W(weather is-currently #{w.current.temp} degrees today high #{today.high} low #{today.low}) + w.current.desc
  • 20. Adhearsion – Simon Says Demo #2 - Play Simon Says Game def verify_attempt if attempt_correct? call_context.play 'good' else call_context.play %W(#{number.size - 1} times wrong-try-again-smarty) reset end end
  • 21. Adhearsion Write Ruby in our dial ● plans! Ability to use any ● Ruby gems we need (Active Record, etc.) Test and debug our ● application in isolation. Bring OO practices to ● VOIP development
  • 22. Adhearsion It's abstracted and ● portable across other PBXes It's simple ● It's extensible ● It's readable ● It's maintainable ● It's fun! ●
  • 23. Adhearsion Where's the Rails? Not directly integrated with Rails – by choice. Written to stand on it's own, but you can link in your models using ActiveRecord. Looking for VOIP in the MVC framework? Look no further than Telegraph...
  • 24. Telegraph Written by a company named Idapted. ➢ Extracted from production application ( Idapted's ➢ distributed voice system for English language learning – EnglishQuad ) Started with RAGI / RAMI ➢ Tightly Integrated with the Rails/Web Interface ➢ They claim it “embraces the Voice/Web analogy” ➢
  • 25. Telegraph Installs into any Rails project as a plugin script/plugin install svn://rubyforge.org/var/svn/telegraph/trunk start up the server script/agi_server – Interfaces with the gateway (incoming calls) script/ami_server – Interfaces with the Asterisk manager
  • 26. Telegraph – Banking Demo Rails SIP Phone Application XLite Asterisk AGI Server
  • 27. Telegraph Add this to your extensions.conf exten => s, n, AGI(agi://localhost/account) respond_to do |wants| #r index.html wants.html { render } # Telegraph allows render_voice # which uses the index.voice file wants.voice{ render_voice } end
  • 28. Banking Demo index.voice: voice.play quot;welcome-to-demo #{say_amount(@balance)}quot; voice.link_to_dtmf 'banking-main-menu' do link 1, :action=>'new' link 2, :action=>'list' link :default, :action=>'index' end
  • 29. Telegraph - Demo Start up telegraph server : telegraph/banking_demo ruby script/asterisk_server ruby script/server Visit http://localhost:3000/account Dial Extension 9000
  • 30. Real World Application eStara Offers a service where a user browsing a site can enter their phone number. The system will dial their number, ask the person to hold and then dial customer service. We'll do this.
  • 31. Demo Topology Cell Origination/ Rails Application Phone Termination Server PSTN Internet Asterisk AGI AMI Demos: 1. Using the browser to initiate phone call. 2. “Who Wants To Be A Billionaire” game.
  • 32. Demo – Using PSTN Telegraph Demos - ➢ ➢ Use the browser to initiate a wakeup call. ➢ Use the browser to initiate phone calls to 10 digit phone numbers and bridge the calls ➢ Use the browser to initiate a call and verify correct code was entered. Adhearsion Demo - ➢ ➢ Adhearsion – My “Who Wants To Be A Billionaire” application.