Successfully reported this slideshow.
Enhancing FreePBX with AdhearsionLuca PradoveraVoice Application Developer, Mojo Lingo
Adhearsion• Ruby framework for telephony applications• Actively developed by Adhearsion community• Interacts with Asterisk...
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 t...
Asterisk configuration• On a FreePBX machine, edit extensions_custom.conf to add a  context and AGI extension [adhearsion]...
FreePBX configuration• Tools > Custom Destination, Add Custom destination with  a name of “adhearsion,s,1”• Setup > IVR: C...
Time-based outbound callrestriction• Requirement: restricting outbound calls based on the  timezone at the destination or ...
TBOCR: Adhearsion contexttime_of_day_filter {# tz = Timezone.find_by_number(call.variables[:agi_dnid])# time = Time.now.lo...
TBOCR: FreePBX• Our macro will be executed every time an outside extension is  dialed• For demonstration purposes, we have...
AMI Events in Adhearsion• AMI allows you to do event monitoring and handling• To enable AMI and events, first edit manager...
AMI Events in Adhearsion/2• Reload the manager in the Asterisk console• Edit startup.rb enabling AMI with the proper crede...
Thank you!• http://adhearsion.com• @adhearsion• http://mojolingo.com
Upcoming SlideShare
Loading in …5
×

Enhancing FreePBX with Adhearsion

1,005 views

Published on

Enhancing FreePBX with Adhearsion presented by Luca Pradovera at FOSDEM 2012

  • Be the first to comment

Enhancing FreePBX with Adhearsion

  1. 1. Enhancing FreePBX with AdhearsionLuca PradoveraVoice Application Developer, Mojo Lingo
  2. 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. 3. Installation• Install RVM on the machine• Install Ruby 1.9.3• bundle install –no-ri –no-rdoc bundler adhearsion
  4. 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. 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. 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. 7. Time-based outbound callrestriction• 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. 8. TBOCR: Adhearsion contexttime_of_day_filter {# tz = Timezone.find_by_number(call.variables[:agi_dnid])# time = Time.now.localtime(tz.offset)time = Time.nowif 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. 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. 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. 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. 12. Thank you!• http://adhearsion.com• @adhearsion• http://mojolingo.com

×