Guest User

Untitled

a guest
Mar 1st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'rubygems'
  4. require 'adhearsion'
  5. require 'adhearsion/voip/asterisk/manager_interface'
  6. require 'timeout'
  7.  
  8. include Adhearsion::VoIP::Asterisk::Manager
  9.  
  10. class MyManagerInterface < Adhearsion::VoIP::Asterisk::Manager::ManagerInterface
  11. def event_message_received(event)
  12. if event.name.downcase == "newstate"
  13. puts "Got a newstate event! #{event.inspect}"
  14. end
  15. end
  16. end
  17.  
  18. status = Timeout::timeout(60) do
  19. asterisk = MyManagerInterface::connect(
  20. :host => "localhost",
  21. :username => "localconnect",
  22. :password => "ranchbone",
  23. :events => true)
  24.  
  25. asterisk.event_message_received
  26. end
Add Comment
Please, Sign In to add comment