Method: Voyager::SIP::BasicSipClient#initialize

Defined in:
lib/voyager/sip/basic_client.rb

#initialize(host, port) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/voyager/sip/basic_client.rb', line 12

def initialize(host, port)
  Rails::logger.info "SIPClient: Connecting with #{host}:#{port}" if VERBOSE
  @socket = TCPSocket::new(host, port)

  if block_given?
    begin
      yield self
    ensure
      # When given a socket, we automatically close connection
      close
    end
  end
end