Class: Adhearsion::CallController
- Inherits:
-
Object
- Object
- Adhearsion::CallController
- Defined in:
- lib/adhearsion/asterisk/core_ext/adhearsion/call_controller.rb
Overview
Monkeypatches to Adhearsion for Asterisk-specific functionality.
Instance Method Summary collapse
-
#stream_file(argument, digits = '0123456789#*') ⇒ String|nil
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.
Instance Method Details
#stream_file(argument, digits = '0123456789#*') ⇒ String|nil
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
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/adhearsion/asterisk/core_ext/adhearsion/call_controller.rb', line 15 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 |