Class: Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand

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

Instance Attribute Summary collapse

Attributes inherited from Component

#call, #call_id, #id, #internal

Instance Method Summary collapse

Methods inherited from Component

#call_ended, #execute_command, #initialize, #logger_id, #send_complete_event, #send_event

Methods included from DeadActorSafety

#safe_from_dead_actors

Constructor Details

This class inherits a constructor from Punchblock::Translator::Asterisk::Component::Component

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



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

def action
  @action
end

Instance Method Details

#executeObject



17
18
19
20
# File 'lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb', line 17

def execute
  send_ref
  @call.send_ami_action @action
end

#handle_ami_event(event) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb', line 22

def handle_ami_event(event)
  if event.name == 'AsyncAGI'
    if event['SubEvent'] == 'Exec'
      send_complete_event success_reason(event)
    end
  end
end

#handle_response(response) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb', line 30

def handle_response(response)
  case response
  when RubyAMI::Error
    set_node_response false
  when RubyAMI::Response
    send_ref
  end
end

#setupObject



13
14
15
# File 'lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb', line 13

def setup
  @action = create_action
end