Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'adhearsion'
- require 'adhearsion/voip/asterisk/manager_interface'
- require 'timeout'
- include Adhearsion::VoIP::Asterisk::Manager
- class MyManagerInterface < Adhearsion::VoIP::Asterisk::Manager::ManagerInterface
- def event_message_received(event)
- if event.name.downcase == "newstate"
- puts "Got a newstate event! #{event.inspect}"
- end
- end
- end
- status = Timeout::timeout(60) do
- asterisk = MyManagerInterface::connect(
- :host => "localhost",
- :username => "localconnect",
- :password => "ranchbone",
- :events => true)
- asterisk.event_message_received
- end
Add Comment
Please, Sign In to add comment