Module: Adhearsion::Translator::Asterisk::Component::InputComponent

Included in:
ComposedPrompt, Input
Defined in:
lib/adhearsion/translator/asterisk/component/input_component.rb

Instance Method Summary collapse

Instance Method Details

#executeObject


11
12
13
14
15
16
17
18
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 11

def execute
  validate
  setup_dtmf_recognizer
  send_ref
  start_timers
rescue OptionError, ArgumentError => e
  with_error 'option error', e.message
end

#execute_command(command) ⇒ Object


26
27
28
29
30
31
32
33
34
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 26

def execute_command(command)
  case command
  when Adhearsion::Rayo::Component::Stop
    command.response = true
    complete Adhearsion::Event::Complete::Stop.new
  else
    super
  end
end

#match(match) ⇒ Object


36
37
38
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 36

def match(match)
  complete success_reason(match)
end

#noinputObject


44
45
46
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 44

def noinput
  complete Adhearsion::Rayo::Component::Input::Complete::NoInput.new
end

#nomatchObject


40
41
42
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 40

def nomatch
  complete Adhearsion::Rayo::Component::Input::Complete::NoMatch.new
end

#process_dtmf(digit) ⇒ Object


20
21
22
23
24
# File 'lib/adhearsion/translator/asterisk/component/input_component.rb', line 20

def process_dtmf(digit)
  @recognizer << digit
rescue Celluloid::DeadActorError
  logger.warn 'DTMF digit received into a dead recognizer. Dropping digit.'
end