Sha256: a0031e1a1d77525ca20a1f931c705fcc97498e5bf676b64fc960fa7a5a3ea23e

Contents?: true

Size: 1.01 KB

Versions: 19

Compression:

Stored size: 1.01 KB

Contents

require 'adhearsion/voip/freeswitch/basic_connection_manager'
module Adhearsion
  module VoIP
    module FreeSwitch
      class InboundConnectionManager < BasicConnectionManager

        DEFAULTS = { :pass => "ClueCon", :host => '127.0.0.1', :port => 8021 }

        def initialize(arg)
          if arg.kind_of? Hash
            @opts = DEFAULTS.merge arg
            @io = TCPSocket.new(@opts[:host], @opts[:port])
            super @io
            unless login(@opts[:pass])
              raise "Your FreeSwitch Event Socket password for #{@opts[:host]} was invalid!"
            end
          else arg.kind_of? IO
            @io = arg
            super @io
          end
        end

        def enable_events!(which='ALL')
          self << "event plain #{which}"
          get_raw_header
        end

        # Only called when nothing has been sent over the socket.
        def login(pass)
          get_raw_header
          self << "auth #{pass}"
          get_raw_header.include? "+OK"
        end

      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
adhearsion-1.2.6 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.2.5 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.2.4 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.2.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.2.1 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.2.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.1.1 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.1.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.0.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.0.2 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-cw-1.0.2.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-cw-1.0.2.2 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-cw-1.0.2.1 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.0.1 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-1.0.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
rene-adhearsion-0.8.6 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.6 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.5 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.4 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb