lib/adhearsion-asr/prompt_builder.rb in adhearsion-asr-1.2.0 vs lib/adhearsion-asr/prompt_builder.rb in adhearsion-asr-1.3.0
- old
+ new
@@ -3,13 +3,13 @@
module AdhearsionASR
class PromptBuilder
def initialize(output_document, grammars, options)
input_options = {
mode: options[:mode] || :dtmf,
- initial_timeout: (options[:timeout] || Plugin.config.timeout) * 1000,
- inter_digit_timeout: (options[:timeout] || Plugin.config.timeout) * 1000,
- max_silence: (options[:timeout] || Plugin.config.timeout) * 1000,
+ initial_timeout: timeout(options[:timeout] || Plugin.config.timeout),
+ inter_digit_timeout: timeout(options[:timeout] || Plugin.config.timeout),
+ max_silence: timeout(options[:timeout] || Plugin.config.timeout),
min_confidence: Plugin.config.min_confidence,
grammars: grammars,
recognizer: Plugin.config.recognizer,
language: Plugin.config.input_language,
terminator: options[:terminator]
@@ -61,8 +61,12 @@
else
raise "Unknown completion reason received: #{reason}"
end
logger.debug "Ask completed with result #{result.inspect}"
end
+ end
+
+ def timeout(value)
+ value > 0 ? value * 1000 : value
end
end
end