Sha256: e6d8257466145d90dea3e249559fb60b30549916b6eb3ac10a513fd6f29f1886

Contents?: true

Size: 796 Bytes

Versions: 7

Compression:

Stored size: 796 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
            component = current_actor
            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

7 entries across 7 versions & 1 rubygems

Version Path
punchblock-2.1.1 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.1.0 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.0.2 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.0.1 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.0.0 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.0.0.beta2 lib/punchblock/translator/asterisk/component/input.rb
punchblock-2.0.0.beta1 lib/punchblock/translator/asterisk/component/input.rb