Class: Quaff::TCPSIPEndpoint

Inherits:
BaseEndpoint show all
Defined in:
lib/endpoint.rb

Instance Attribute Summary collapse

Attributes inherited from BaseEndpoint

#msg_trace, #uri

Instance Method Summary collapse

Methods inherited from BaseEndpoint

#add_call_id, #generate_call_id, #get_new_call_id, #get_new_message, #incoming_call, #initialize, #local_port, #mark_call_dead, #outgoing_call, #register, #send_msg, #unregister

Constructor Details

This class inherits a constructor from Quaff::BaseEndpoint

Instance Attribute Details

#socketsObject

Returns the value of attribute sockets.



128
129
130
# File 'lib/endpoint.rb', line 128

def sockets
  @sockets
end

Instance Method Details

#add_sock(sock) ⇒ Object



144
145
146
# File 'lib/endpoint.rb', line 144

def add_sock sock
  @sockets.push sock
end

#initialize_connection(lport) ⇒ Object



130
131
132
133
134
# File 'lib/endpoint.rb', line 130

def initialize_connection(lport)
    @cxn = TCPServer.new(lport)
    @parser = SipParser.new
    @sockets = []
end

#new_source(host, port) ⇒ Object Also known as: new_connection



140
141
142
# File 'lib/endpoint.rb', line 140

def new_source host, port
  return TCPSource.new host, port
end

#terminateObject



148
149
150
151
152
153
154
155
# File 'lib/endpoint.rb', line 148

def terminate
  oldsockets = @sockets.dup
  @sockets = []
  oldsockets.each do |s| s.close unless s.closed? end
  mycxn = @cxn
  @cxn = nil
  mycxn.close
end

#transportObject



136
137
138
# File 'lib/endpoint.rb', line 136

def transport
  "TCP"
end