Class: FSR::Cmd::UuidTransfer
- Defined in:
- lib/fsr/cmd/uuid_transfer.rb
Constant Summary collapse
- DEFAULTS =
{both: false, context: "default", dialplan: 'xml'}
Constants inherited from Command
Instance Method Summary collapse
-
#initialize(fs_socket = nil, args = {}) ⇒ UuidTransfer
constructor
A new instance of UuidTransfer.
-
#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 = {}) ⇒ UuidTransfer
Returns a new instance of UuidTransfer.
6 7 8 9 10 11 12 13 |
# File 'lib/fsr/cmd/uuid_transfer.rb', line 6 def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj args = DEFAULTS.merge(args) both, @uuid, @to, @context, @dialplan = args.values_at(:both, :uuid, :to, :context, :dialplan) @leg = both ? '-both' : '-bleg' 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
23 24 25 |
# File 'lib/fsr/cmd/uuid_transfer.rb', line 23 def raw "uuid_transfer #{@uuid} #{@leg} #{@to} #{@dialplan} #{@context}" end |
#run(api_method = :api) ⇒ Object
Send the command to the event socket, using bgapi by default.
16 17 18 19 20 |
# File 'lib/fsr/cmd/uuid_transfer.rb', line 16 def run(api_method = :api) orig_command = "%s %s" % [api_method, raw] Log.debug "saying #{orig_command}" @fs_socket.say(orig_command) end |