Sha256: b56e5587f2247d9a78d12e9b44c2553ef5888eff1681cda123325f7900515bd7
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
# encoding: utf-8 module Punchblock module Translator class Asterisk module Component class ComposedPrompt < Component include InputComponent include StopByRedirect def execute validate output_command.request! setup_dtmf_recognizer output_component = Output.new_link(output_command, @call) call.register_component output_component fut = output_component.future.execute case output_command.response when Ref send_ref else set_node_response output_command.response end fut.value unless @component_node.barge_in # Block until output is complete register_dtmf_event_handler start_timers end def process_dtmf(digit) call.async.redirect_back if @component_node.barge_in super end def output_command @output_command ||= @component_node.output end private def input_node @input_node ||= @component_node.input end def register_dtmf_event_handler component = current_actor @dtmf_handler_id = call.register_handler :ami, :name => 'DTMF', [:[], 'End'] => 'Yes' do |event| component.process_dtmf event['Digit'] end end def unregister_dtmf_event_handler call.async.unregister_handler :ami, @dtmf_handler_id if instance_variable_defined?(:@dtmf_handler_id) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems