Class: Bandwidth::MachineDetectionConfiguration
- Defined in:
- lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb
Overview
MachineDetectionConfiguration Model.
Instance Attribute Summary collapse
-
#callback_method ⇒ CallbackMethodEnum
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#callback_url ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#delay_result ⇒ Boolean
If set to ‘true’ and if an answering machine is detected, the ‘answering-machine’ callback will be delayed until the machine is done speaking or until the ‘detectionTimeout’ is exceeded.
-
#detection_timeout ⇒ Float
Total amount of time (in seconds) before giving up.
-
#fallback_method ⇒ FallbackMethodEnum
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#fallback_password ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#fallback_url ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#fallback_username ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#mode ⇒ ModeEnum
The machine detection mode.
-
#password ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
-
#silence_timeout ⇒ Float
If no speech is detected in this period, a callback with a ‘silence’ result is sent.
-
#speech_end_threshold ⇒ Float
Amount of silence (in seconds) before assuming the callee has finished speaking.
-
#speech_threshold ⇒ Float
When speech has ended and a result couldn’t be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration.
-
#username ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(mode = nil, detection_timeout = nil, silence_timeout = nil, speech_threshold = nil, speech_end_threshold = nil, delay_result = nil, callback_url = nil, callback_method = nil, fallback_url = nil, fallback_method = nil, username = nil, password = nil, fallback_username = nil, fallback_password = nil) ⇒ MachineDetectionConfiguration
constructor
A new instance of MachineDetectionConfiguration.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(mode = nil, detection_timeout = nil, silence_timeout = nil, speech_threshold = nil, speech_end_threshold = nil, delay_result = nil, callback_url = nil, callback_method = nil, fallback_url = nil, fallback_method = nil, username = nil, password = nil, fallback_username = nil, fallback_password = nil) ⇒ MachineDetectionConfiguration
Returns a new instance of MachineDetectionConfiguration.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 143 def initialize(mode = nil, detection_timeout = nil, silence_timeout = nil, speech_threshold = nil, speech_end_threshold = nil, delay_result = nil, callback_url = nil, callback_method = nil, fallback_url = nil, fallback_method = nil, username = nil, password = nil, fallback_username = nil, fallback_password = nil) @mode = mode unless mode == SKIP @detection_timeout = detection_timeout unless detection_timeout == SKIP @silence_timeout = silence_timeout unless silence_timeout == SKIP @speech_threshold = speech_threshold unless speech_threshold == SKIP @speech_end_threshold = speech_end_threshold unless speech_end_threshold == SKIP @delay_result = delay_result unless delay_result == SKIP @callback_url = callback_url unless callback_url == SKIP @callback_method = callback_method unless callback_method == SKIP @fallback_url = fallback_url unless fallback_url == SKIP @fallback_method = fallback_method unless fallback_method == SKIP @username = username unless username == SKIP @password = password unless password == SKIP @fallback_username = fallback_username unless fallback_username == SKIP @fallback_password = fallback_password unless fallback_password == SKIP end |
Instance Attribute Details
#callback_method ⇒ CallbackMethodEnum
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
57 58 59 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 57 def callback_method @callback_method end |
#callback_url ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
52 53 54 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 52 def callback_url @callback_url end |
#delay_result ⇒ Boolean
If set to ‘true’ and if an answering machine is detected, the ‘answering-machine’ callback will be delayed until the machine is done speaking or until the ‘detectionTimeout’ is exceeded. If false, the ‘answering-machine’ result is sent immediately. Default is ‘false’.
47 48 49 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 47 def delay_result @delay_result end |
#detection_timeout ⇒ Float
Total amount of time (in seconds) before giving up.
21 22 23 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 21 def detection_timeout @detection_timeout end |
#fallback_method ⇒ FallbackMethodEnum
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
67 68 69 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 67 def fallback_method @fallback_method end |
#fallback_password ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
87 88 89 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 87 def fallback_password @fallback_password end |
#fallback_url ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
62 63 64 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 62 def fallback_url @fallback_url end |
#fallback_username ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
82 83 84 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 82 def fallback_username @fallback_username end |
#mode ⇒ ModeEnum
The machine detection mode. If set to ‘async’, the detection result will be sent in a ‘machineDetectionComplete’ callback. If set to ‘sync’, the ‘answer’ callback will wait for the machine detection to complete and will include its result. Default is ‘async’.
17 18 19 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 17 def mode @mode end |
#password ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
77 78 79 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 77 def password @password end |
#silence_timeout ⇒ Float
If no speech is detected in this period, a callback with a ‘silence’ result is sent. Default is 10 seconds.
26 27 28 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 26 def silence_timeout @silence_timeout end |
#speech_end_threshold ⇒ Float
Amount of silence (in seconds) before assuming the callee has finished speaking.
40 41 42 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 40 def speech_end_threshold @speech_end_threshold end |
#speech_threshold ⇒ Float
When speech has ended and a result couldn’t be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be ‘answering-machine’. If the length of speech detected is below this threshold, the result will be ‘human’. Default is 10 seconds.
35 36 37 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 35 def speech_threshold @speech_threshold end |
#username ⇒ String
The URL to send the ‘machineDetectionComplete’ callback when the detection is completed. Only for ‘async’ mode.
72 73 74 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 72 def username @username end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 174 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mode = hash.key?('mode') ? hash['mode'] : SKIP detection_timeout = hash.key?('detectionTimeout') ? hash['detectionTimeout'] : SKIP silence_timeout = hash.key?('silenceTimeout') ? hash['silenceTimeout'] : SKIP speech_threshold = hash.key?('speechThreshold') ? hash['speechThreshold'] : SKIP speech_end_threshold = hash.key?('speechEndThreshold') ? hash['speechEndThreshold'] : SKIP delay_result = hash.key?('delayResult') ? hash['delayResult'] : SKIP callback_url = hash.key?('callbackUrl') ? hash['callbackUrl'] : SKIP callback_method = hash.key?('callbackMethod') ? hash['callbackMethod'] : SKIP fallback_url = hash.key?('fallbackUrl') ? hash['fallbackUrl'] : SKIP fallback_method = hash.key?('fallbackMethod') ? hash['fallbackMethod'] : SKIP username = hash.key?('username') ? hash['username'] : SKIP password = hash.key?('password') ? hash['password'] : SKIP fallback_username = hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP fallback_password = hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP # Create object from extracted values. MachineDetectionConfiguration.new(mode, detection_timeout, silence_timeout, speech_threshold, speech_end_threshold, delay_result, callback_url, callback_method, fallback_url, fallback_method, username, password, fallback_username, fallback_password) end |
.names ⇒ Object
A mapping from model property names to API property names.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 90 def self.names @_hash = {} if @_hash.nil? @_hash['mode'] = 'mode' @_hash['detection_timeout'] = 'detectionTimeout' @_hash['silence_timeout'] = 'silenceTimeout' @_hash['speech_threshold'] = 'speechThreshold' @_hash['speech_end_threshold'] = 'speechEndThreshold' @_hash['delay_result'] = 'delayResult' @_hash['callback_url'] = 'callbackUrl' @_hash['callback_method'] = 'callbackMethod' @_hash['fallback_url'] = 'fallbackUrl' @_hash['fallback_method'] = 'fallbackMethod' @_hash['username'] = 'username' @_hash['password'] = 'password' @_hash['fallback_username'] = 'fallbackUsername' @_hash['fallback_password'] = 'fallbackPassword' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 130 def nullables %w[ callback_url callback_method fallback_url fallback_method username password fallback_username fallback_password ] end |
#optionals ⇒ Object
An array for optional fields
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb', line 110 def optionals %w[ mode detection_timeout silence_timeout speech_threshold speech_end_threshold delay_result callback_url callback_method fallback_url fallback_method username password fallback_username fallback_password ] end |