Sha256: a4f9813400c6a3fdd0adf2ae84347b0064fa6d38287775d000df21165248befa

Contents?: true

Size: 865 Bytes

Versions: 9

Compression:

Stored size: 865 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module Output
      class AsyncPlayer < AbstractPlayer

        #
        # @yield The output component before executing it
        # @raise [PlaybackError] if (one of) the given argument(s) could not be played
        #
        def output(content, options = {})
          options.merge! :ssml => content
          component = new_output options
          component.register_event_handler Punchblock::Event::Complete do |event|
            controller.logger.error event if event.reason.is_a?(Punchblock::Event::Complete::Error)
            throw :pass
          end
          controller.write_and_await_response component
          component
        rescue Punchblock::ProtocolError => e
          raise PlaybackError, "Async output failed due to #{e.inspect}"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
adhearsion-2.6.4 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.6.3 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.6.2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.6.1 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.6.0 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.5.4 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.5.3 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.5.2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.5.0 lib/adhearsion/call_controller/output/async_player.rb