Class: FSR::Cmd::Fsctl

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

Constant Summary

Constants inherited from Command

DEFAULT_OPTIONS

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Command

#default_options

Constructor Details

- (Fsctl) initialize(fs_socket = nil)

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

- (Object) command (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

- (Object) max_sessions

Get max sessions



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

def max_sessions
  @command = "max_sessions"
  run
end

- (Object) max_sessions=(sessions)

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

- (Object) raw

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

- (Object) run(api_method = :api)

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