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