Module: Punchblock::Translator::InputComponent
- Included in:
- Asterisk::Component::Input, Freeswitch::Component::Input
- Defined in:
- lib/punchblock/translator/input_component.rb
Instance Method Summary collapse
- #execute ⇒ Object
- #execute_command(command) ⇒ Object
- #match(mode, confidence, utterance, interpretation) ⇒ Object
- #noinput ⇒ Object
- #nomatch ⇒ Object
- #process_dtmf(digit) ⇒ Object
Instance Method Details
#execute ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/punchblock/translator/input_component.rb', line 6 def execute validate @recognizer = DTMFRecognizer.new self, @component_node.grammar.value, (@component_node.initial_timeout || -1), (@component_node.inter_digit_timeout || -1) send_ref @dtmf_handler_id = register_dtmf_event_handler rescue OptionError => e with_error 'option error', e. end |
#execute_command(command) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/punchblock/translator/input_component.rb', line 25 def execute_command(command) case command when Punchblock::Component::Stop command.response = true complete Punchblock::Event::Complete::Stop.new else super end end |
#match(mode, confidence, utterance, interpretation) ⇒ Object
35 36 37 |
# File 'lib/punchblock/translator/input_component.rb', line 35 def match(mode, confidence, utterance, interpretation) complete Punchblock::Component::Input::Complete::Success.new(:mode => mode, :confidence => confidence, :utterance => utterance, :interpretation => interpretation) end |
#noinput ⇒ Object
43 44 45 |
# File 'lib/punchblock/translator/input_component.rb', line 43 def noinput complete Punchblock::Component::Input::Complete::NoInput.new end |
#nomatch ⇒ Object
39 40 41 |
# File 'lib/punchblock/translator/input_component.rb', line 39 def nomatch complete Punchblock::Component::Input::Complete::NoMatch.new end |
#process_dtmf(digit) ⇒ Object
21 22 23 |
# File 'lib/punchblock/translator/input_component.rb', line 21 def process_dtmf(digit) @recognizer << digit end |