Class: Bandwidth::MachineDetectionConfiguration
- Inherits:
-
Object
- Object
- 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
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ MachineDetectionConfiguration
Initializes the object
152 153 154 155 156 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 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 152 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 attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.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: " + self.class.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
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 408 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Bandwidth.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
105 106 107 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 105 def self.acceptable_attributes 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
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 384 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
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 131 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.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 110 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.
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 349 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 |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 479 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
371 372 373 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 371 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
377 378 379 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 377 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?
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 244 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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
455 456 457 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 455 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 461 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 |
#to_s ⇒ String
Returns the string representation of the object
449 450 451 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 449 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
276 277 278 279 280 281 282 283 284 285 |
# File 'lib/bandwidth-sdk/models/machine_detection_configuration.rb', line 276 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 |