Class: FSR::Cmd::Fsctl

Inherits:
Command show all
Defined in:
lib/fsr/cmd/fsctl.rb

Constant Summary

Constants inherited from Command

Command::DEFAULT_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs_socket = nil) ⇒ Fsctl

Returns a new instance of Fsctl.



10
11
12
# File 'lib/fsr/cmd/fsctl.rb', line 10

def initialize(fs_socket = nil)
  @fs_socket = fs_socket # FSR::CommandSocket obj
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



8
9
10
# File 'lib/fsr/cmd/fsctl.rb', line 8

def command
  @command
end

Instance Method Details

#max_sessionsObject

Get max sessions



15
16
17
18
# File 'lib/fsr/cmd/fsctl.rb', line 15

def max_sessions
  @command = "max_sessions"
  run
end

#max_sessions=(sessions) ⇒ Object

Set max sessions



21
22
23
24
# File 'lib/fsr/cmd/fsctl.rb', line 21

def max_sessions=(sessions)
  @command = "max_sessions #{sessions}"
  run
end

#rawObject

This method builds the API command to send to the freeswitch event socket



34
35
36
# File 'lib/fsr/cmd/fsctl.rb', line 34

def raw
  orig_command = "fsctl #{@command}"
end

#run(api_method = :api) ⇒ Object

Send the command to the event socket, using api by default.



27
28
29
30
31
# File 'lib/fsr/cmd/fsctl.rb', line 27

def run(api_method = :api)
  orig_command = "%s %s" % [api_method, raw]
  Log.debug "saying #{orig_command}"
  @fs_socket.say(orig_command)
end