Class: Adhearsion::Translator::Asterisk::Component::ComposedPrompt

Inherits:
Component
  • Object
show all
Includes:
InputComponent, StopByRedirect
Defined in:
lib/adhearsion/translator/asterisk/component/composed_prompt.rb

Instance Attribute Summary

Attributes inherited from Component

#call, #call_id, #id

Instance Method Summary collapse

Methods included from StopByRedirect

#execute_command, #stop_by_redirect

Methods included from InputComponent

#execute_command, #match, #noinput, #nomatch

Methods inherited from Component

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

Constructor Details

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

Instance Method Details

#executeObject


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/adhearsion/translator/asterisk/component/composed_prompt.rb', line 14

def execute
  validate
  output_command.request!
  setup_dtmf_recognizer

  @output_incomplete = true

  @output_component = Output.new(output_command, @call)
  call.register_component @output_component
  fut = Celluloid::Future.new { @output_component.execute }

  case @output_command.response
  when Adhearsion::Rayo::Ref
    send_ref
  else
    set_node_response @output_command.response
  end

  if @component_node.barge_in
    @barged = false
    register_dtmf_event_handler
    fut.value # Block until output is complete before starting timers
    @output_incomplete = false
    start_timers unless @barged
  else
    fut.value # Block until output is complete before allowing input
    register_dtmf_event_handler
    start_timers
  end
end

#output_commandObject


53
54
55
# File 'lib/adhearsion/translator/asterisk/component/composed_prompt.rb', line 53

def output_command
  @output_command ||= @component_node.output
end

#process_dtmf(digit) ⇒ Object


45
46
47
48
49
50
51
# File 'lib/adhearsion/translator/asterisk/component/composed_prompt.rb', line 45

def process_dtmf(digit)
  if @component_node.barge_in && @output_incomplete
    @output_component.stop_by_redirect Adhearsion::Event::Complete::Stop.new
    @barged = true
  end
  super
end