lib/adhearsion/call_controller/output.rb in adhearsion-2.4.0.beta3 vs lib/adhearsion/call_controller/output.rb in adhearsion-2.4.0
- old
+ new
@@ -36,11 +36,41 @@
def say!(text, options = {})
async_player.play_ssml(text, options) || async_player.output(output_formatter.ssml_for_text(text.to_s), options)
end
alias :speak! :say!
+
+ # Speak characters using text-to-speech (TTS)
#
+ # @example Speak 'abc123' as 'ay bee cee one two three'
+ # say_characters('abc123')
+ #
+ # @param [String, #to_s] characters The string of characters to be spoken
+ # @param [Hash] options A set of options for output
+ #
+ # @raises [PlaybackError] if the given argument could not be played
+ #
+ def say_characters(characters, options = {})
+ player.play_ssml output_formatter.ssml_for_characters(characters), options
+ true
+ end
+
+ # Speak characters using text-to-speech (TTS) and return as soon as it begins
+ #
+ # @example Speak 'abc123' as 'ay bee cee one two three'
+ # say_characters!('abc123')
+ #
+ # @param [String, #to_s] characters The string of characters to be spoken
+ # @param [Hash] options A set of options for output
+ #
+ # @raises [PlaybackError] if the given argument could not be played
+ #
+ def say_characters!(characters, options = {})
+ async_player.play_ssml output_formatter.ssml_for_characters(characters), options
+ end
+
+ #
# Plays the specified sound file names. This method will handle Time/DateTime objects (e.g. Time.now),
# Fixnums (e.g. 1000), Strings which are valid Fixnums (e.g "123"), and direct sound files. To specify how the Date/Time objects are said
# pass in as an array with the first parameter as the Date/Time/DateTime object along with a hash with the
# additional options. See play_time for more information.
#
@@ -217,10 +247,10 @@
#
# @return [String, nil] The single DTMF character entered by the user, or nil if nothing was entered
# @raises [PlaybackError] if (one of) the given argument(s) could not be played
#
def interruptible_play(*outputs)
- options = process_output_options outputs
+ options = process_output_options outputs
outputs.find do |output|
digit = stream_file output, '0123456789#*', options
return digit if digit
end
end