SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Enhancing FreePBX with Adhearsion
Luca Pradovera
Voice Application Developer, Mojo Lingo
Adhearsion
• Ruby framework for telephony applications
• Actively developed by Adhearsion community
• Interacts with Asterisk through AGI and AMI
• Also supports Tropo via AGI
• More platforms Coming Soon...
Installation
• Install RVM on the machine
• Install Ruby 1.9.3
• bundle install –no-ri –no-rdoc bundler adhearsion
Your new application
• ahn create <appname>
• Important files are dialplan.rb and config/startup.rb
 Edit startup.rb to set the correct argument delimiter
• Build a simple dialplan:
 fosdem {
     play “tt-monkeys”
 }
Asterisk configuration
• On a FreePBX machine, edit extensions_custom.conf to add a
  context and AGI extension
 [adhearsion]
 exten => s,1,AGI(agi://localhost/fosdem)
FreePBX configuration
• Tools > Custom Destination, Add Custom destination with
  a name of “adhearsion,s,1”
• Setup > IVR: Create an IVR with your custom destination
  in it
• Route the default DID to the IVR: Setup > Inbound Routes
  > All DIDs, set default to IVR and the name of your IVR
Time-based outbound call
restriction
• Requirement: restricting outbound calls based on the
  timezone at the destination or any other criteria
• Done by one of our customers
• Add to extensions_custom.conf, macro name is mandatory:
 [macro-dialout-trunk-predial-hook]
 exten => s,1,AGI(agi://localhost/time_of_day_filter)
TBOCR: Adhearsion context
time_of_day_filter {
# tz = Timezone.find_by_number(call.variables[:agi_dnid])
# time = Time.now.localtime(tz.offset)
time = Time.now
if time.hour > 12
    #reject the call
    play "something-terribly-wrong"
    execute "CONGESTION", 60
    hangup
    end
    # if you do not hang up the call here, the call
    # will go through and continue dialing
}
TBOCR: FreePBX
• Our macro will be executed every time an outside extension is
  dialed
• For demonstration purposes, we have added a simple
  outbound catch-all route
• Dial 4044754849 (my phone number at Mojo Lingo)
AMI Events in Adhearsion
• AMI allows you to do event monitoring and handling
• To enable AMI and events, first edit manager_custom.conf
  adding a new user
 [adhearsion]
 secret = ahn123
 deny=0.0.0.0/0.0.0.0
 permit=127.0.0.1/255.255.255.0
 read = all
 write = all
AMI Events in Adhearsion/2
• Reload the manager in the Asterisk console
• Edit startup.rb enabling AMI with the proper credentials
• Edit events.rb to add some monitoring code
• Restart the Adhearsion application if running
Thank you!
• http://adhearsion.com
• @adhearsion
• http://mojolingo.com

Más contenido relacionado

Similar a Enhancing FreePBX with Adhearsion

Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012Luca Pradovera
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Better Operations into the Cloud
Better Operations  into the CloudBetter Operations  into the Cloud
Better Operations into the CloudFabio Ferrari
 
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 Asteriskjicksta
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepThe Incredible Automation Day
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsBen Hall
 
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptxBSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptxJasonOstrom1
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?AFUP_Limoges
 
Setup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE networkSetup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE networkNazmul Hossain Rakib
 
Splunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsSplunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsAnthony D Hendricks
 
Using Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitchUsing Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitchMonica McArthur
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Parallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeParallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeAkihiro Suda
 
No drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwrightNo drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwrightMastacheata1
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
Windows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background AgentsWindows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background AgentsOliver Scheer
 

Similar a Enhancing FreePBX with Adhearsion (20)

Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012Enhancing Free PBX with Adhearsion at Fosdem 2012
Enhancing Free PBX with Adhearsion at Fosdem 2012
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Better Operations into the Cloud
Better Operations  into the CloudBetter Operations  into the Cloud
Better Operations into the Cloud
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimes
 
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
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by step
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
The FatRat
The FatRatThe FatRat
The FatRat
 
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptxBSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
Setup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE networkSetup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE network
 
Splunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsSplunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shells
 
Using Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitchUsing Asterisk in a SIP softswitch
Using Asterisk in a SIP softswitch
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Parallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeParallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-Mode
 
No drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwrightNo drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwright
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Windows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background AgentsWindows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background Agents
 

Más de Mojo Lingo

ConnectJS 2015: Video Killed the Telephone Star
ConnectJS 2015: Video Killed the Telephone StarConnectJS 2015: Video Killed the Telephone Star
ConnectJS 2015: Video Killed the Telephone StarMojo Lingo
 
AstriCon 2015: WebRTC: How it Works, and How it Breaks
AstriCon 2015: WebRTC: How it Works, and How it BreaksAstriCon 2015: WebRTC: How it Works, and How it Breaks
AstriCon 2015: WebRTC: How it Works, and How it BreaksMojo Lingo
 
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In Sight
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In SightFreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In Sight
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In SightMojo Lingo
 
Now Hear This! Putting Voice, Video, and Text into Ruby on Rails
Now Hear This! Putting Voice, Video, and Text into Ruby on RailsNow Hear This! Putting Voice, Video, and Text into Ruby on Rails
Now Hear This! Putting Voice, Video, and Text into Ruby on RailsMojo Lingo
 
Using Asterisk to Create "Her"
Using Asterisk to Create "Her"Using Asterisk to Create "Her"
Using Asterisk to Create "Her"Mojo Lingo
 
Tipping the Scales: Measuring and Scaling Asterisk
Tipping the Scales: Measuring and Scaling AsteriskTipping the Scales: Measuring and Scaling Asterisk
Tipping the Scales: Measuring and Scaling AsteriskMojo Lingo
 
WebRTC Overview by Dan Burnett
WebRTC Overview by Dan BurnettWebRTC Overview by Dan Burnett
WebRTC Overview by Dan BurnettMojo Lingo
 
AdhearsionConf 2013 Keynote
AdhearsionConf 2013 KeynoteAdhearsionConf 2013 Keynote
AdhearsionConf 2013 KeynoteMojo Lingo
 
Speech-Enabling Web Apps
Speech-Enabling Web AppsSpeech-Enabling Web Apps
Speech-Enabling Web AppsMojo Lingo
 
WebRTC: What? How? Why? - ClueCon 2013
WebRTC: What? How? Why? - ClueCon 2013WebRTC: What? How? Why? - ClueCon 2013
WebRTC: What? How? Why? - ClueCon 2013Mojo Lingo
 
Infiltrando Telecoms Usando Ruby
Infiltrando Telecoms Usando RubyInfiltrando Telecoms Usando Ruby
Infiltrando Telecoms Usando RubyMojo Lingo
 
Connecting Adhearsion
Connecting AdhearsionConnecting Adhearsion
Connecting AdhearsionMojo Lingo
 
Testing Adhearsion Applications
Testing Adhearsion ApplicationsTesting Adhearsion Applications
Testing Adhearsion ApplicationsMojo Lingo
 
Testing Telephony: It's Not All Terrible
Testing Telephony: It's Not All TerribleTesting Telephony: It's Not All Terrible
Testing Telephony: It's Not All TerribleMojo Lingo
 
Rayo for XMPP Folks
Rayo for XMPP FolksRayo for XMPP Folks
Rayo for XMPP FolksMojo Lingo
 
Talking To Rails
Talking To RailsTalking To Rails
Talking To RailsMojo Lingo
 
Building Real Life Applications with Adhearsion
Building Real Life Applications with AdhearsionBuilding Real Life Applications with Adhearsion
Building Real Life Applications with AdhearsionMojo Lingo
 
Keeping It Realtime!
Keeping It Realtime!Keeping It Realtime!
Keeping It Realtime!Mojo Lingo
 
Integrating Voice Through Adhearsion
Integrating Voice Through AdhearsionIntegrating Voice Through Adhearsion
Integrating Voice Through AdhearsionMojo Lingo
 
Infiltrating Telecoms Using Ruby
Infiltrating Telecoms Using RubyInfiltrating Telecoms Using Ruby
Infiltrating Telecoms Using RubyMojo Lingo
 

Más de Mojo Lingo (20)

ConnectJS 2015: Video Killed the Telephone Star
ConnectJS 2015: Video Killed the Telephone StarConnectJS 2015: Video Killed the Telephone Star
ConnectJS 2015: Video Killed the Telephone Star
 
AstriCon 2015: WebRTC: How it Works, and How it Breaks
AstriCon 2015: WebRTC: How it Works, and How it BreaksAstriCon 2015: WebRTC: How it Works, and How it Breaks
AstriCon 2015: WebRTC: How it Works, and How it Breaks
 
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In Sight
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In SightFreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In Sight
FreeSWITCH, FreeSWITCH Everywhere, and Not A Phone In Sight
 
Now Hear This! Putting Voice, Video, and Text into Ruby on Rails
Now Hear This! Putting Voice, Video, and Text into Ruby on RailsNow Hear This! Putting Voice, Video, and Text into Ruby on Rails
Now Hear This! Putting Voice, Video, and Text into Ruby on Rails
 
Using Asterisk to Create "Her"
Using Asterisk to Create "Her"Using Asterisk to Create "Her"
Using Asterisk to Create "Her"
 
Tipping the Scales: Measuring and Scaling Asterisk
Tipping the Scales: Measuring and Scaling AsteriskTipping the Scales: Measuring and Scaling Asterisk
Tipping the Scales: Measuring and Scaling Asterisk
 
WebRTC Overview by Dan Burnett
WebRTC Overview by Dan BurnettWebRTC Overview by Dan Burnett
WebRTC Overview by Dan Burnett
 
AdhearsionConf 2013 Keynote
AdhearsionConf 2013 KeynoteAdhearsionConf 2013 Keynote
AdhearsionConf 2013 Keynote
 
Speech-Enabling Web Apps
Speech-Enabling Web AppsSpeech-Enabling Web Apps
Speech-Enabling Web Apps
 
WebRTC: What? How? Why? - ClueCon 2013
WebRTC: What? How? Why? - ClueCon 2013WebRTC: What? How? Why? - ClueCon 2013
WebRTC: What? How? Why? - ClueCon 2013
 
Infiltrando Telecoms Usando Ruby
Infiltrando Telecoms Usando RubyInfiltrando Telecoms Usando Ruby
Infiltrando Telecoms Usando Ruby
 
Connecting Adhearsion
Connecting AdhearsionConnecting Adhearsion
Connecting Adhearsion
 
Testing Adhearsion Applications
Testing Adhearsion ApplicationsTesting Adhearsion Applications
Testing Adhearsion Applications
 
Testing Telephony: It's Not All Terrible
Testing Telephony: It's Not All TerribleTesting Telephony: It's Not All Terrible
Testing Telephony: It's Not All Terrible
 
Rayo for XMPP Folks
Rayo for XMPP FolksRayo for XMPP Folks
Rayo for XMPP Folks
 
Talking To Rails
Talking To RailsTalking To Rails
Talking To Rails
 
Building Real Life Applications with Adhearsion
Building Real Life Applications with AdhearsionBuilding Real Life Applications with Adhearsion
Building Real Life Applications with Adhearsion
 
Keeping It Realtime!
Keeping It Realtime!Keeping It Realtime!
Keeping It Realtime!
 
Integrating Voice Through Adhearsion
Integrating Voice Through AdhearsionIntegrating Voice Through Adhearsion
Integrating Voice Through Adhearsion
 
Infiltrating Telecoms Using Ruby
Infiltrating Telecoms Using RubyInfiltrating Telecoms Using Ruby
Infiltrating Telecoms Using Ruby
 

Enhancing FreePBX with Adhearsion

  • 1. Enhancing FreePBX with Adhearsion Luca Pradovera Voice Application Developer, Mojo Lingo
  • 2. Adhearsion • Ruby framework for telephony applications • Actively developed by Adhearsion community • Interacts with Asterisk through AGI and AMI • Also supports Tropo via AGI • More platforms Coming Soon...
  • 3. Installation • Install RVM on the machine • Install Ruby 1.9.3 • bundle install –no-ri –no-rdoc bundler adhearsion
  • 4. Your new application • ahn create <appname> • Important files are dialplan.rb and config/startup.rb Edit startup.rb to set the correct argument delimiter • Build a simple dialplan: fosdem { play “tt-monkeys” }
  • 5. Asterisk configuration • On a FreePBX machine, edit extensions_custom.conf to add a context and AGI extension [adhearsion] exten => s,1,AGI(agi://localhost/fosdem)
  • 6. FreePBX configuration • Tools > Custom Destination, Add Custom destination with a name of “adhearsion,s,1” • Setup > IVR: Create an IVR with your custom destination in it • Route the default DID to the IVR: Setup > Inbound Routes > All DIDs, set default to IVR and the name of your IVR
  • 7. Time-based outbound call restriction • Requirement: restricting outbound calls based on the timezone at the destination or any other criteria • Done by one of our customers • Add to extensions_custom.conf, macro name is mandatory: [macro-dialout-trunk-predial-hook] exten => s,1,AGI(agi://localhost/time_of_day_filter)
  • 8. TBOCR: Adhearsion context time_of_day_filter { # tz = Timezone.find_by_number(call.variables[:agi_dnid]) # time = Time.now.localtime(tz.offset) time = Time.now if time.hour > 12 #reject the call play "something-terribly-wrong" execute "CONGESTION", 60 hangup end # if you do not hang up the call here, the call # will go through and continue dialing }
  • 9. TBOCR: FreePBX • Our macro will be executed every time an outside extension is dialed • For demonstration purposes, we have added a simple outbound catch-all route • Dial 4044754849 (my phone number at Mojo Lingo)
  • 10. AMI Events in Adhearsion • AMI allows you to do event monitoring and handling • To enable AMI and events, first edit manager_custom.conf adding a new user [adhearsion] secret = ahn123 deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.255.255.0 read = all write = all
  • 11. AMI Events in Adhearsion/2 • Reload the manager in the Asterisk console • Edit startup.rb enabling AMI with the proper credentials • Edit events.rb to add some monitoring code • Restart the Adhearsion application if running
  • 12. Thank you! • http://adhearsion.com • @adhearsion • http://mojolingo.com