Class: Bandwidth::MachineDetectionConfiguration
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Bandwidth::MachineDetectionConfiguration
- Defined in:
- lib/bandwidth-sdk/models/machine_detection_configuration.rb
Overview
The machine detection request used to perform <a href=‘/docs/voice/guides/machineDetection’>machine detection</a> on the call. Currently, there is an issue where decimal values are not getting processed correctly. Please use whole number values. We are working to resolve this issue. Please contact Bandwidth Support if you need more information.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#callback_method ⇒ Object
Returns the value of attribute callback_method.
-
#callback_url ⇒ Object
The URL to send the ‘machineDetectionComplete’ webhook when the detection is completed.
-
#delay_result ⇒ Object
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 an end of message tone is detected, or until the ‘detectionTimeout’ is exceeded.
-
#detection_timeout ⇒ Object
The timeout used for the whole operation, in seconds.
-
#fallback_method ⇒ Object
Returns the value of attribute fallback_method.
-
#fallback_password ⇒ Object
Basic auth password.
-
#fallback_url ⇒ Object
A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case ‘callbackUrl` fails to respond.
-
#fallback_username ⇒ Object
Basic auth username.
-
#machine_speech_end_threshold ⇒ Object
When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#password ⇒ Object
Basic auth password.
-
#silence_timeout ⇒ Object
If no speech is detected in this period, a callback with a ‘silence’ result is sent.
-
#speech_end_threshold ⇒ Object
Amount of silence (in seconds) before assuming the callee has finished speaking.
-
#speech_threshold ⇒ Object
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 ⇒ Object
Basic auth username.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ MachineDetectionConfiguration
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ MachineDetectionConfiguration
Initializes the object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 157 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MachineDetectionConfiguration` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'mode') self.mode = attributes[:'mode'] else self.mode = 'async' end if attributes.key?(:'detection_timeout') self.detection_timeout = attributes[:'detection_timeout'] else self.detection_timeout = 15 end if attributes.key?(:'silence_timeout') self.silence_timeout = attributes[:'silence_timeout'] else self.silence_timeout = 10 end if attributes.key?(:'speech_threshold') self.speech_threshold = attributes[:'speech_threshold'] else self.speech_threshold = 10 end if attributes.key?(:'speech_end_threshold') self.speech_end_threshold = attributes[:'speech_end_threshold'] else self.speech_end_threshold = 5 end if attributes.key?(:'machine_speech_end_threshold') self.machine_speech_end_threshold = attributes[:'machine_speech_end_threshold'] end if attributes.key?(:'delay_result') self.delay_result = attributes[:'delay_result'] else self.delay_result = false end if attributes.key?(:'callback_url') self.callback_url = attributes[:'callback_url'] end if attributes.key?(:'callback_method') self.callback_method = attributes[:'callback_method'] else self.callback_method = 'POST' end if attributes.key?(:'username') self.username = attributes[:'username'] end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'fallback_url') self.fallback_url = attributes[:'fallback_url'] end if attributes.key?(:'fallback_method') self.fallback_method = attributes[:'fallback_method'] else self.fallback_method = 'POST' end if attributes.key?(:'fallback_username') self.fallback_username = attributes[:'fallback_username'] end if attributes.key?(:'fallback_password') self.fallback_password = attributes[:'fallback_password'] end end |
Instance Attribute Details
#callback_method ⇒ Object
Returns the value of attribute callback_method.
42 43 44 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 42 def callback_method @callback_method end |
#callback_url ⇒ Object
The URL to send the ‘machineDetectionComplete’ webhook when the detection is completed. Only for ‘async’ mode.
40 41 42 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 40 def callback_url @callback_url end |
#delay_result ⇒ Object
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 an end of message tone is detected, or until the ‘detectionTimeout’ is exceeded. If false, the ‘answering-machine’ result is sent immediately.
37 38 39 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 37 def delay_result @delay_result end |
#detection_timeout ⇒ Object
The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a ‘timeout` result is sent.
22 23 24 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 22 def detection_timeout @detection_timeout end |
#fallback_method ⇒ Object
Returns the value of attribute fallback_method.
53 54 55 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 53 def fallback_method @fallback_method end |
#fallback_password ⇒ Object
Basic auth password.
59 60 61 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 59 def fallback_password @fallback_password end |
#fallback_url ⇒ Object
A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case ‘callbackUrl` fails to respond
51 52 53 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 51 def fallback_url @fallback_url end |
#fallback_username ⇒ Object
Basic auth username.
56 57 58 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 56 def fallback_username @fallback_username end |
#machine_speech_end_threshold ⇒ Object
When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value.
34 35 36 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 34 def machine_speech_end_threshold @machine_speech_end_threshold end |
#mode ⇒ Object
Returns the value of attribute mode.
19 20 21 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 19 def mode @mode end |
#password ⇒ Object
Basic auth password.
48 49 50 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 48 def password @password end |
#silence_timeout ⇒ Object
If no speech is detected in this period, a callback with a ‘silence’ result is sent.
25 26 27 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 25 def silence_timeout @silence_timeout end |
#speech_end_threshold ⇒ Object
Amount of silence (in seconds) before assuming the callee has finished speaking.
31 32 33 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 31 def speech_end_threshold @speech_end_threshold end |
#speech_threshold ⇒ Object
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’.
28 29 30 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 28 def speech_threshold @speech_threshold end |
#username ⇒ Object
Basic auth username.
45 46 47 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 45 def username @username end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
105 106 107 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 105 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
110 111 112 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 110 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 84 def self.attribute_map { :'mode' => :'mode', :'detection_timeout' => :'detectionTimeout', :'silence_timeout' => :'silenceTimeout', :'speech_threshold' => :'speechThreshold', :'speech_end_threshold' => :'speechEndThreshold', :'machine_speech_end_threshold' => :'machineSpeechEndThreshold', :'delay_result' => :'delayResult', :'callback_url' => :'callbackUrl', :'callback_method' => :'callbackMethod', :'username' => :'username', :'password' => :'password', :'fallback_url' => :'fallbackUrl', :'fallback_method' => :'fallbackMethod', :'fallback_username' => :'fallbackUsername', :'fallback_password' => :'fallbackPassword' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 390 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 136 def self.openapi_nullable Set.new([ :'detection_timeout', :'silence_timeout', :'speech_threshold', :'speech_end_threshold', :'machine_speech_end_threshold', :'delay_result', :'callback_url', :'callback_method', :'username', :'password', :'fallback_url', :'fallback_method', :'fallback_username', :'fallback_password' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 115 def self.openapi_types { :'mode' => :'MachineDetectionModeEnum', :'detection_timeout' => :'Float', :'silence_timeout' => :'Float', :'speech_threshold' => :'Float', :'speech_end_threshold' => :'Float', :'machine_speech_end_threshold' => :'Float', :'delay_result' => :'Boolean', :'callback_url' => :'String', :'callback_method' => :'CallbackMethodEnum', :'username' => :'String', :'password' => :'String', :'fallback_url' => :'String', :'fallback_method' => :'CallbackMethodEnum', :'fallback_username' => :'String', :'fallback_password' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 355 def ==(o) return true if self.equal?(o) self.class == o.class && mode == o.mode && detection_timeout == o.detection_timeout && silence_timeout == o.silence_timeout && speech_threshold == o.speech_threshold && speech_end_threshold == o.speech_end_threshold && machine_speech_end_threshold == o.machine_speech_end_threshold && delay_result == o.delay_result && callback_url == o.callback_url && callback_method == o.callback_method && username == o.username && password == o.password && fallback_url == o.fallback_url && fallback_method == o.fallback_method && fallback_username == o.fallback_username && fallback_password == o.fallback_password end |
#eql?(o) ⇒ Boolean
377 378 379 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 377 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
383 384 385 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 383 def hash [mode, detection_timeout, silence_timeout, speech_threshold, speech_end_threshold, machine_speech_end_threshold, delay_result, callback_url, callback_method, username, password, fallback_url, fallback_method, fallback_username, fallback_password].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 250 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@callback_url.nil? && @callback_url.to_s.length > 2048 invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2048.') end if !@username.nil? && @username.to_s.length > 1024 invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.') end if !@password.nil? && @password.to_s.length > 1024 invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.') end if !@fallback_url.nil? && @fallback_url.to_s.length > 2048 invalid_properties.push('invalid value for "fallback_url", the character length must be smaller than or equal to 2048.') end if !@fallback_username.nil? && @fallback_username.to_s.length > 1024 invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.') end if !@fallback_password.nil? && @fallback_password.to_s.length > 1024 invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 412 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
282 283 284 285 286 287 288 289 290 291 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 282 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@callback_url.nil? && @callback_url.to_s.length > 2048 return false if !@username.nil? && @username.to_s.length > 1024 return false if !@password.nil? && @password.to_s.length > 1024 return false if !@fallback_url.nil? && @fallback_url.to_s.length > 2048 return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024 return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024 true end |