Class: Kipatra::Server

Inherits:
Object
  • Object
show all
Includes:
Cipango
Defined in:
lib/kipatra.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Server

Returns a new instance of Server.



8
9
10
11
12
13
# File 'lib/kipatra.rb', line 8

def initialize(opts)
  @war, @app_file, @tcp, @udp = opts[:war], opts[:app_file], opts[:tcp], opts[:udp]
  unless @war || @app_file
    raise ArgumentError, "Either :war or :app_file must be defined"
  end
end

Instance Method Details

#joinObject



29
30
31
# File 'lib/kipatra.rb', line 29

def join
  @server.join
end

#startObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kipatra.rb', line 15

def start
  @server = Cipango::Server.new

  @server.connector_manager.connectors = manage_connectors

  handler = SipContextHandlerCollection.new
  handler.add_handler sip_app

  @server.application_router = DefaultApplicationRouter.new
  @server.handler = handler

  @server.start
end