Sha256: 00ad910993ba118dab2ee890416f57725e04ef6d1741d9c80e22ee4bead375ae

Contents?: true

Size: 768 Bytes

Versions: 5

Compression:

Stored size: 768 Bytes

Contents

# encoding: utf-8

module Punchblock
  module Translator
    class Asterisk
      module Component
        class Input < Component

          include InputComponent

          def execute
            @call.send_progress
            super
            @dtmf_handler_id = register_dtmf_event_handler
          end

          private

          def register_dtmf_event_handler
            call.register_handler :ami, [{:name => 'DTMF', [:[], 'End'] => 'Yes'}, {:name => 'DTMFEnd'}] do |event|
              process_dtmf event['Digit']
            end
          end

          def unregister_dtmf_event_handler
            call.unregister_handler :ami, @dtmf_handler_id if instance_variable_defined?(:@dtmf_handler_id)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
punchblock-2.7.5 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.7.3 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.7.2 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.7.1 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.7.0 lib/punchblock/translator/asterisk/component/input.rb