Class: FSR::Cmd::SofiaContact
- Defined in:
- lib/fsr/cmd/sofia_contact.rb
Constant Summary
Constants inherited from Command
Instance Attribute Summary collapse
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
Instance Method Summary collapse
-
#initialize(fs_socket = nil, contact = {}) ⇒ SofiaContact
constructor
A new instance of SofiaContact.
-
#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, contact = {}) ⇒ SofiaContact
Returns a new instance of SofiaContact.
10 11 12 13 14 |
# File 'lib/fsr/cmd/sofia_contact.rb', line 10 def initialize(fs_socket = nil, contact = {}) @fs_socket = fs_socket # FSR::CommandSocket obj @contact = contact[:contact] #puts @contact end |
Instance Attribute Details
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
8 9 10 |
# File 'lib/fsr/cmd/sofia_contact.rb', line 8 def contact @contact end |
Instance Method Details
#raw ⇒ Object
This method builds the API command to send to the freeswitch event socket
25 26 27 |
# File 'lib/fsr/cmd/sofia_contact.rb', line 25 def raw orig_command = "sofia_contact #{@contact}" end |
#run(api_method = :api) ⇒ Object
Send the command to the event socket, using api by default.
17 18 19 20 21 22 |
# File 'lib/fsr/cmd/sofia_contact.rb', line 17 def run(api_method = :api) orig_command = "%s %s" % [api_method, raw] Log.debug "saying #{orig_command}" resp = @fs_socket.say(orig_command) resp["body"].match(%r{^error/}) ? nil : resp["body"] end |