Class: Adhearsion::VoIP::Asterisk::AGI::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/asterisk/agi_server.rb

Defined Under Namespace

Classes: RubyServer

Constant Summary collapse

DEFAULT_OPTIONS =
{ :server_class => RubyServer, :port => 4573, :host => "0.0.0.0" }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



62
63
64
65
66
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 62

def initialize(options = {})
  options                     = DEFAULT_OPTIONS.merge options
  @host, @port, @server_class = options.values_at(:host, :port, :server_class)
  @server                     = server_class.new(port, host)
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



60
61
62
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 60

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



60
61
62
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 60

def port
  @port
end

#serverObject (readonly)

Returns the value of attribute server.



60
61
62
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 60

def server
  @server
end

#server_classObject (readonly)

Returns the value of attribute server_class.



60
61
62
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 60

def server_class
  @server_class
end

Instance Method Details

#joinObject



76
77
78
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 76

def join
  server.join
end

#shutdownObject



72
73
74
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 72

def shutdown
  server.stop
end

#startObject



68
69
70
# File 'lib/adhearsion/voip/asterisk/agi_server.rb', line 68

def start
  server.start
end