Sha256: ce684fc3d9ce6b4f1fd7a6e752fdd6a2041f08cde8c43660ba95590413ae0572
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
module AdhearsionCpa module ControllerMethods # Detects a tone # # @example Wait 5 seconds to detect a fax tone # detect_tone "fax-cng", timeout: 5 # @example Check for multiple tone types # detect_tone "fax-ced", :modem, timeout: 5 # @example Check for a type, with options # detect_tone :speech, maxTime: 4000, minSpeechDuration: 4000, timeout: 5 # @example Check for a type, with options, and another type without # detect_tone({:dtmf => {}, speech: {maxTime: 4000, minSpeechDuration: 4000}}, timeout: 5) # # @return [PunchBlock::Signal] if one of the requested tones was detected # @return [nil] if none of the requested tones were detected in time # def detect_tone(*arguments) options = arguments.last.is_a?(Hash) && arguments.count > 1 ? arguments.pop : {} ToneDetector.new(self).detect_tones arguments, options end # Begin asynchronous tone detection, and run the block when the tone is detected # # @example Asynchronous wait for a dtmf # detect_tone :dtmf { |detected| logger.info "Beep! Customer pushed #{detected.inspect}"} # @example Asynchronous wait for dtmf presses, running the block multiple times if multiple signals are detected def detect_tone!(*arguments) options = arguments.last.is_a?(Hash) && arguments.count > 1 ? arguments.pop : {} ToneDetector.new(self).detect_tones arguments, options.merge(async: true), &Proc.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion_cpa-0.1.1 | lib/adhearsion_cpa/controller_methods.rb |