Sha256: 8f147f1c434c9eba5c3d918dd81605d73a6115ecb0a466b18aeb3305f3191b66

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

# encoding: utf-8

require 'active_support/core_ext/string/filters'

module Punchblock
  module Translator
    class Asterisk
      module Component
        module StopByRedirect
          def execute_command(command)
            return super unless command.is_a?(Punchblock::Component::Stop)

            component_actor = current_actor
            call.register_handler :ami, lambda { |e| e['SubEvent'] == 'Start' }, :name => 'AsyncAGI' do |event|
              component_actor.send_complete_event! Punchblock::Event::Complete::Stop.new
            end
            command.response = true
            call.redirect_back!
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
punchblock-1.2.0 lib/punchblock/translator/asterisk/component/stop_by_redirect.rb
punchblock-1.1.0 lib/punchblock/translator/asterisk/component/stop_by_redirect.rb
punchblock-1.0.0 lib/punchblock/translator/asterisk/component/stop_by_redirect.rb
punchblock-0.12.0 lib/punchblock/translator/asterisk/component/stop_by_redirect.rb
punchblock-0.11.0 lib/punchblock/translator/asterisk/component/stop_by_redirect.rb