lib/adhearsion-asr/prompt_builder.rb in adhearsion-asr-0.1.0 vs lib/adhearsion-asr/prompt_builder.rb in adhearsion-asr-1.0.0.beta1

- old
+ new

@@ -3,11 +3,12 @@ module AdhearsionASR class PromptBuilder def initialize(output_document, grammars, options) output_options = { render_document: {value: output_document}, - renderer: Plugin.config.renderer + renderer: Adhearsion.config.platform.media.default_renderer, + voice: Adhearsion.config.platform.media.default_voice }.merge(options[:output_options] || {}) input_options = { mode: :dtmf, initial_timeout: (options[:timeout] || Plugin.config.timeout) * 1000, @@ -34,17 +35,22 @@ def result(reason) Result.new.tap do |result| case reason when proc { |r| r.respond_to? :nlsml } result.status = :match + result.mode = reason.mode result.confidence = reason.confidence - result.response = reason.utterance + result.utterance = reason.utterance result.interpretation = reason.interpretation result.nlsml = reason.nlsml when Punchblock::Event::Complete::Error raise Error, reason.details - when Punchblock::Event::Complete::Reason - result.status = reason.name + when Punchblock::Component::Input::Complete::NoMatch + result.status = :nomatch + when Punchblock::Component::Input::Complete::NoInput + result.status = :noinput + when Punchblock::Event::Complete::Hangup + result.status = :hangup else raise "Unknown completion reason received: #{reason}" end logger.debug "Ask completed with result #{result.inspect}" end