Sha256: c78318180e12b79f1b0edf90b837dd071deccaa591d4e54feb06b27e46899280
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
module Adhearsion ## # Monkeypatches to Adhearsion for Asterisk-specific functionality. # class CallController # # Plays a single output, not only files, accepting interruption by one of the digits specified # Currently still stops execution, will be fixed soon in Punchblock # # @param [Object] String or Hash specifying output and options # @param [String] String with the digits that are allowed to interrupt output # @return [String|nil] The pressed digit, or nil if nothing was pressed # def stream_file(argument, digits = '0123456789#*') begin output_component = ::Punchblock::Component::Asterisk::AGI::Command.new :name => "STREAM FILE", :params => [ argument, digits ] execute_component_and_await_completion output_component reason = output_component.complete_event.reason case reason.result when 0 raise CallController::Output::PlaybackError if reason.data == "endpos=0" nil when -1 raise CallController::Output::PlaybackError else [reason.result].pack 'U*' end rescue StandardError => e raise CallController::Output::PlaybackError, "Output failed for argument #{argument.inspect}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-asterisk-0.2.0 | lib/adhearsion/asterisk/core_ext/adhearsion/call_controller.rb |