Sha256: 14b79756a4bdad70b428f51b660837fac966ed57dbb9b617290e0cc52f82013d

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 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

16 entries across 16 versions & 7 rubygems

Version Path
eric-adhearsion-0.7.999 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
eric-adhearsion-0.8.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
jicksta-adhearsion-0.7.999 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
jicksta-adhearsion-0.8.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
jicksta-adhearsion-0.8.2 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
jicksta-adhearsion-0.8.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
kenwiesner-adhearsioncw-0.8.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
mtrudel-adhearsion-0.8.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
sant0sk1-adhearsion-0.7.999 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
sevenscale-adhearsion-0.7.1000 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
sevenscale-adhearsion-0.7.1003 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
sevenscale-adhearsion-0.8.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.3 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.1 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.2 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
adhearsion-0.8.0 lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb