lib/adhearsion/call_controller/output/player.rb in adhearsion-2.3.4 vs lib/adhearsion/call_controller/output/player.rb in adhearsion-2.3.5

- old
+ new

@@ -7,14 +7,17 @@ # # @yields The output component before executing it # @raises [PlaybackError] if (one of) the given argument(s) could not be played # - def output(content, options = {}) + def output(content, options = {}, &block) options.merge! :ssml => content.to_s component = new_output options - yield component if block_given? - controller.execute_component_and_await_completion component + if block + controller.execute_component_and_await_completion component, &block + else + controller.execute_component_and_await_completion component + end rescue Call::Hangup raise rescue Adhearsion::Error, Punchblock::ProtocolError => e raise PlaybackError, "Output failed due to #{e.inspect}" end