Class: FSR::Cmd::Fsctl
Constant Summary
Constants inherited from Command
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(fs_socket = nil) ⇒ Fsctl
constructor
A new instance of Fsctl.
-
#max_sessions ⇒ Object
Get max sessions.
-
#max_sessions=(sessions) ⇒ Object
Set max sessions.
-
#raw ⇒ Object
This method builds the API command to send to the freeswitch event socket.
-
#run(api_method = :api) ⇒ Object
Send the command to the event socket, using api by default.
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
#command ⇒ Object (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_sessions ⇒ Object
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 |
#raw ⇒ Object
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 |