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.
14 15 16 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 14 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.
12 13 14 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 12 def id @id end |
Instance Method Details
#execute(ami_client) ⇒ Object
19 20 21 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 19 def execute(ami_client) AMIErrorConverter.convert { ami_client.send_action 'AGI', 'Channel' => @channel, 'Command' => agi_command, 'CommandID' => id } end |
#parse_result(event) ⇒ Object
23 24 25 26 |
# File 'lib/punchblock/translator/asterisk/agi_command.rb', line 23 def parse_result(event) parser = RubyAMI::AGIResultParser.new event['Result'] {code: parser.code, result: parser.result, data: parser.data} end |