Skip to content

Commit 2e72b87

Browse files
authored
DX-2551 Add machineSpeechEndThreshold parameter (#50)
* DX-2551 Add `machineSpeechEndThreshold` parameter * variable name * another one * final one * update value
1 parent d6a33d1 commit 2e72b87

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ class MachineDetectionConfiguration < BaseModel
8686
# @return [String]
8787
attr_accessor :fallback_password
8888

89+
# When an answering machine is detected, the amount of silence (in seconds)
90+
# before assuming the message has finished playing.
91+
# return [Float]
92+
attr_accessor :machine_speech_end_threshold
93+
8994
# A mapping from model property names to API property names.
9095
def self.names
9196
@_hash = {} if @_hash.nil?
@@ -103,6 +108,7 @@ def self.names
103108
@_hash['password'] = 'password'
104109
@_hash['fallback_username'] = 'fallbackUsername'
105110
@_hash['fallback_password'] = 'fallbackPassword'
111+
@_hash['machine_speech_end_threshold'] = 'machineSpeechEndThreshold'
106112
@_hash
107113
end
108114

@@ -123,6 +129,7 @@ def optionals
123129
password
124130
fallback_username
125131
fallback_password
132+
machine_speech_end_threshold
126133
]
127134
end
128135

@@ -137,6 +144,7 @@ def nullables
137144
password
138145
fallback_username
139146
fallback_password
147+
machine_speech_end_threshold
140148
]
141149
end
142150

@@ -153,7 +161,8 @@ def initialize(mode = nil,
153161
username = nil,
154162
password = nil,
155163
fallback_username = nil,
156-
fallback_password = nil)
164+
fallback_password = nil,
165+
machine_speech_end_threshold = nil)
157166
@mode = mode unless mode == SKIP
158167
@detection_timeout = detection_timeout unless detection_timeout == SKIP
159168
@silence_timeout = silence_timeout unless silence_timeout == SKIP
@@ -168,6 +177,7 @@ def initialize(mode = nil,
168177
@password = password unless password == SKIP
169178
@fallback_username = fallback_username unless fallback_username == SKIP
170179
@fallback_password = fallback_password unless fallback_password == SKIP
180+
@machine_speech_end_threshold = machine_speech_end_threshold unless machine_speech_end_threshold == SKIP
171181
end
172182

173183
# Creates an instance of the object from a hash.
@@ -197,6 +207,8 @@ def self.from_hash(hash)
197207
hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP
198208
fallback_password =
199209
hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
210+
machine_speech_end_threshold =
211+
hash.key?('machineSpeechEndThreshold') ? hash['machineSpeechEndThreshold'] : SKIP
200212

201213
# Create object from extracted values.
202214
MachineDetectionConfiguration.new(mode,
@@ -212,7 +224,8 @@ def self.from_hash(hash)
212224
username,
213225
password,
214226
fallback_username,
215-
fallback_password)
227+
fallback_password,
228+
machine_speech_end_threshold)
216229
end
217230
end
218231
end

test/integration/test_integration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def test_create_call_with_amd_and_get_call_state
128128
machine_detection.delay_result = true
129129
machine_detection.callback_url = BASE_CALLBACK_URL + '/machineDetection'
130130
machine_detection.callback_method = 'POST'
131+
machine_detection.machine_speech_end_threshold = 3.2
131132

132133
body = CreateCallRequest.new
133134
body.from = BW_NUMBER

0 commit comments

Comments
 (0)