Class: FSR::Cmd::UuidSendDtmf
- Defined in:
- lib/fsr/cmd/uuid_send_dtmf.rb
Constant Summary
Constants inherited from Command
Instance Method Summary collapse
-
#initialize(fs_socket = nil, args = {}) ⇒ UuidSendDtmf
constructor
A new instance of UuidSendDtmf.
-
#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 = {}) ⇒ UuidSendDtmf
Returns a new instance of UuidSendDtmf.
6 7 8 9 10 11 12 |
# File 'lib/fsr/cmd/uuid_send_dtmf.rb', line 6 def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj @uuid, dtmf = args.values_at(:uuid, :dtmf) raise(ArgumentError, "No uuid given") unless @uuid raise(ArgumentError, "No dtmf data given") unless dtmf @dtmf = FSR::Utils::DTMF.from_string(dtmf) 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/uuid_send_dtmf.rb', line 22 def raw "uuid_send_dtmf #{@uuid} #{@dtmf}" 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/uuid_send_dtmf.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 |