Class: Punchblock::Translator::Asterisk::Component::Asterisk::AMIAction

Inherits:
Component
  • Object
show all
Defined in:
lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb

Instance Attribute Summary (collapse)

Attributes inherited from Component

#call, #call_id, #id

Instance Method Summary (collapse)

Methods inherited from Component

#call_ended, #execute_command, #logger_id, #send_complete_event, #send_event, #setup

Constructor Details

- (AMIAction) initialize(component_node, translator, ami_client)

Returns a new instance of AMIAction



11
12
13
14
# File 'lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb', line 11

def initialize(component_node, translator, ami_client)
  super component_node, nil
  @translator, @ami_client = translator, ami_client
end

Instance Attribute Details

- (Object) translator (readonly)

Returns the value of attribute translator



9
10
11
# File 'lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb', line 9

def translator
  @translator
end

Instance Method Details

- (Object) execute



16
17
18
19
20
21
22
23
# File 'lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb', line 16

def execute
  send_ref
  response = send_action
  final_event = send_events response
  send_complete_event success_reason(response, final_event)
rescue RubyAMI::Error => e
  send_complete_event error_reason(e)
end