Enhancing Free PBX with Adhearsion at Fosdem 2012


Published on

Adhearsion is a Ruby telephony framework that can be used to add functionality to FreePBX in a simple way.

Published in: Technology, Design
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Enhancing Free PBX with Adhearsion at Fosdem 2012

  1. 1. 2012E n h a n c in g F r e e P B X w it h A d h e a r s io nLuca PradoveraVoice Application Developer, Mojo Lingo
  2. 2. Ad h e ars io nRuby framework for telephony applicationsActively developed by Adhearsion communityInteracts with Asterisk through AGI and AMIAlso supports Tropo via AGIMore platforms Coming Soon...
  3. 3. In s tallatio nInstall RVM on the machine https://gist.github.com/843946The script: Installs RVM Installs the build requirements Installs Ruby 1.9.3 and the Gem system Sets up Ruby Installs Adhearsion and required gems
  4. 4. Vo ic e ap p lic atio nIs a way to add logic to telephony systemsCan interact with external databases and protocolsExamples: MySQL, Rails, XMPP, LDAP
  5. 5. Yo u r n e w ap p lic atio nahn create <appname>Important files are dialplan.rb and config/startup.rbEdit startup.rb to set the correct argument delimiterBuild a simple dialplan:fosdem { play “tt-monkeys”}
  6. 6. As te ris k c o n fig u ratio nOn a FreePBX machine, edit extensions_custom.conf to add a context and AGI extension[adhearsion]exten => s,1,AGI(agi://localhost/fosdem)Start the Adhearsion application with “ahn start .”
  7. 7. Fre e P B X c o n fig u ratio nTools > Custom Destination, Add Custom destination with a name of “adhearsion,s,1”Setup > IVR: Create an IVR with your custom destination in itRoute the default DID to the IVR: Setup > Inbound Routes > All DIDs, set default to IVR and the name of your IVRCreate a SIP user if needed and dial 7777 to simulate an incoming callPress 1 and hear the sweet sound of monkeys!
  8. 8. Tim e -b as e d o u tb o u n d c allre s tric tio nRequirement: restricting outbound calls based on the timezone at the destination or any other criteriaDone by one of our customersAdd to extensions_custom.conf, macro name is mandated by FreePBX:[macro-dialout-trunk-predial-hook]exten => s,1,AGI(agi://localhost/time_of_day_filter)
  9. 9. TB O C R : Ad h e ars io n c o n te x ttime_of_day_filter {# tz = Timezone.find_by_number(call.variables[:agi_dnid])# time = Time.now.localtime(tz.offset)time = Time.nowif time.hour > 11 #reject the call play "something-terribly-wrong" execute "CONGESTION", 5 hangup
  10. 10. TB O C R : Fre e P B XOur macro will be executed every time an outside extension is dialedFor demonstration purposes, we have added a simple outbound catch-all routeDial 4044754849 (my phone number at Mojo Lingo!)
  11. 11. AM I E ve n ts in Ad h e ars io nAMI allows you to do event monitoring and handlingTo enable AMI and events, first edit manager_custom.conf adding a new user[adhearsion]secret = ahn123deny= = allwrite = all
  12. 12. AM I E ve n ts in Ad h e ars io n /2Reload the manager in the Asterisk consoleEdit startup.rb enabling AMI with the proper credentialsEdit events.rb to add some monitoring codeRestart the Adhearsion application if running
  13. 13. Th an k yo u !Adhearsion Projecthttp://adhearsion.comgithub.com/adhearsion@adhearsionLuca Pradovera@lucaprado on Twitter – polysics on Githublpradovera@mojolingo.com (Email/XMPP)