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