Sha256: 81f217374e26eba5976e54cc898e4258e0ac4f4b5c79e4afde89036163b1a873
Contents?: true
Size: 826 Bytes
Versions: 5
Compression:
Stored size: 826 Bytes
Contents
require 'ruby_ami' module Punchblock module Connection class Asterisk < GenericConnection attr_reader :ami_client, :translator attr_accessor :event_handler def initialize(options = {}) @ami_client = RubyAMI::Client.new options.merge(:event_handler => lambda { |event| translator.handle_ami_event! event }, :logger => pb_logger) @translator = Translator::Asterisk.new @ami_client, self super() end def run pb_logger.debug "Starting the RubyAMI client" ami_client.start end def stop translator.shutdown! ami_client.stop end def write(command, options) translator.execute_command! command, options end def handle_event(event) event_handler.call event end end end end
Version data entries
5 entries across 5 versions & 1 rubygems