Module: Punchblock::Translator::InputComponent

Included in:
Asterisk::Component::ComposedPrompt, Asterisk::Component::Input, Freeswitch::Component::Input
Defined in:
lib/punchblock/translator/input_component.rb

Instance Method Summary collapse

Instance Method Details

#executeObject


6
7
8
9
10
11
12
13
# File 'lib/punchblock/translator/input_component.rb', line 6

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


21
22
23
24
25
26
27
28
29
# File 'lib/punchblock/translator/input_component.rb', line 21

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

#match(match) ⇒ Object


31
32
33
# File 'lib/punchblock/translator/input_component.rb', line 31

def match(match)
  complete success_reason(match)
end

#noinputObject


39
40
41
# File 'lib/punchblock/translator/input_component.rb', line 39

def noinput
  complete Punchblock::Component::Input::Complete::NoInput.new
end

#nomatchObject


35
36
37
# File 'lib/punchblock/translator/input_component.rb', line 35

def nomatch
  complete Punchblock::Component::Input::Complete::NoMatch.new
end

#process_dtmf(digit) ⇒ Object


15
16
17
18
19
# File 'lib/punchblock/translator/input_component.rb', line 15

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