Class: Punchblock::Translator::Asterisk::AGICommand
- Defined in:
- lib/punchblock/translator/asterisk/agi_command.rb
Constant Summary collapse
- ARG_QUOTER =
/["\\]/.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #execute(ami_client) ⇒ Object
-
#initialize(id, channel, command, *params) ⇒ AGICommand
constructor
A new instance of AGICommand.
- #parse_result(event) ⇒ Object
Constructor Details
#initialize(id, channel, command, *params) ⇒ AGICommand
Returns a new instance of AGICommand.
13 14 15 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 13 def initialize(id, channel, command, *params) @id, @channel, @command, @params = id, channel, command, params end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 11 def id @id end |
Instance Method Details
#execute(ami_client) ⇒ Object
17 18 19 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 17 def execute(ami_client) ami_client.send_action 'AGI', 'Channel' => @channel, 'Command' => agi_command, 'CommandID' => id end |
#parse_result(event) ⇒ Object
21 22 23 24 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 21 def parse_result(event) parser = RubyAMI::AGIResultParser.new event['Result'] {code: parser.code, result: parser.result, data: parser.data} end |