Class: FSR::Cmd::SchedHangup
- Defined in:
- lib/fsr/cmd/sched_hangup.rb
Constant Summary collapse
- DEFAULTS =
{when: 1, cause: "UNKNOWN"}
Constants inherited from Command
Instance Method Summary collapse
-
#initialize(fs_socket = nil, args = {}) ⇒ SchedHangup
constructor
A new instance of SchedHangup.
-
#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 bgapi by default.
Constructor Details
#initialize(fs_socket = nil, args = {}) ⇒ SchedHangup
Returns a new instance of SchedHangup.
6 7 8 9 10 11 |
# File 'lib/fsr/cmd/sched_hangup.rb', line 6 def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj args = DEFAULTS.merge(args) @when, @uuid, @cause = args.values_at(:when, :uuid, :cause) raise(ArgumentError, "No uuid given") unless @uuid end |
Instance Method Details
#raw ⇒ Object
This method builds the API command to send to the freeswitch event socket
21 22 23 |
# File 'lib/fsr/cmd/sched_hangup.rb', line 21 def raw "sched_hangup +#{@when} #{@uuid} #{@cause.dump}" end |
#run(api_method = :api) ⇒ Object
Send the command to the event socket, using bgapi by default.
14 15 16 17 18 |
# File 'lib/fsr/cmd/sched_hangup.rb', line 14 def run(api_method = :api) orig_command = "%s %s" % [api_method, raw] Log.debug "saying #{orig_command}" @fs_socket.say(orig_command) end |