bandwidth-sdk 9.1.2 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bandwidth/voice_lib/bxml/bxml.rb +3 -6
- data/lib/bandwidth/voice_lib/bxml/response.rb +39 -0
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +81 -0
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +12 -77
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +12 -2
- data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +15 -2
- data/lib/bandwidth.rb +1 -0
- data/test/integration/test_integration.rb +42 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18a1aa70f505740cb401da02868903300dd1dea4bad46e34334387a24b5ed391
|
4
|
+
data.tar.gz: c6d3de5ab878190e7a7b9fe29fd503b240aa3434c3fd54b72bce236d1ddfafd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97b472c59acf4f4fe5552a5a7c561d0b36fdbdbeb7c240fc0d3c4dfcf3eee3a46d0ca5316325f1245086ab6efc91101a80a9826d49078ccee6d2f7563db6171c
|
7
|
+
data.tar.gz: 526b08eeab6f9335208edd49b2c3ea7b01193b4077254374d5cf496d20048231ff990029a92c2e4c33013657ef5a5cad7705296073910a5b6406862d7d06ee9b
|
@@ -3,14 +3,11 @@ Dir[File.dirname(__FILE__) + '/verbs/*'].each {|file|
|
|
3
3
|
require_relative file
|
4
4
|
}
|
5
5
|
|
6
|
-
SSML_REGEX = /<([a-zA-Z\/\/].*?)>/
|
7
|
-
SPEAK_SENTENCE_REGEX = /<SpeakSentence.*?>.*?<\/SpeakSentence>/
|
8
|
-
|
9
6
|
module Bandwidth
|
10
7
|
module Voice
|
11
|
-
class
|
8
|
+
class Bxml
|
12
9
|
# Initializer
|
13
|
-
# @param verbs [Array] optional list of verbs to include
|
10
|
+
# @param verbs [Array] optional list of verbs to include in the bxml tag
|
14
11
|
def initialize(verbs = nil)
|
15
12
|
@verbs = verbs || []
|
16
13
|
end
|
@@ -19,7 +16,7 @@ module Bandwidth
|
|
19
16
|
def to_bxml()
|
20
17
|
xml = Builder::XmlMarkup.new()
|
21
18
|
xml.instruct!(:xml, :version=>'1.0', :encoding=>'UTF-8')
|
22
|
-
xml.
|
19
|
+
xml.Bxml do
|
23
20
|
@verbs.each {|verb| verb.to_bxml(xml)}
|
24
21
|
end
|
25
22
|
xml.target!().gsub(SPEAK_SENTENCE_REGEX){|s|s.gsub(SSML_REGEX, '<\1>')}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'builder'
|
2
|
+
Dir[File.dirname(__FILE__) + '/verbs/*'].each {|file|
|
3
|
+
require_relative file
|
4
|
+
}
|
5
|
+
|
6
|
+
SSML_REGEX = /<([a-zA-Z\/\/].*?)>/
|
7
|
+
SPEAK_SENTENCE_REGEX = /<SpeakSentence.*?>.*?<\/SpeakSentence>/
|
8
|
+
|
9
|
+
module Bandwidth
|
10
|
+
module Voice
|
11
|
+
class Response
|
12
|
+
# Initializer
|
13
|
+
# @param verbs [Array] optional list of verbs to include into response
|
14
|
+
def initialize(verbs = nil)
|
15
|
+
@verbs = verbs || []
|
16
|
+
end
|
17
|
+
|
18
|
+
# Return BXML representaion of this response
|
19
|
+
def to_bxml()
|
20
|
+
xml = Builder::XmlMarkup.new()
|
21
|
+
xml.instruct!(:xml, :version=>'1.0', :encoding=>'UTF-8')
|
22
|
+
xml.Response do
|
23
|
+
@verbs.each {|verb| verb.to_bxml(xml)}
|
24
|
+
end
|
25
|
+
xml.target!().gsub(SPEAK_SENTENCE_REGEX){|s|s.gsub(SSML_REGEX, '<\1>')}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Add one or more verbs to this response
|
29
|
+
def push(*verbs)
|
30
|
+
@verbs.push(*verbs)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Add a verb to this response
|
34
|
+
def <<(verb)
|
35
|
+
@verbs << verb
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -252,6 +252,87 @@ module Voice
|
|
252
252
|
ApiResponse.new(_response)
|
253
253
|
end
|
254
254
|
|
255
|
+
# Makes a PUT request to /api/v2/accounts/{accountId}/calls/{callId}/bxml
|
256
|
+
# @param [String] account_id Required parameter: Example:
|
257
|
+
# @param [String] call_id Required parameter: Example:
|
258
|
+
# @param [String] body Required parameter: Example:
|
259
|
+
# @return [void] response from the API call
|
260
|
+
def modify_call_bxml(account_id,
|
261
|
+
call_id,
|
262
|
+
body
|
263
|
+
)
|
264
|
+
# Prepare query url.
|
265
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
266
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/bxml'
|
267
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
268
|
+
_query_builder,
|
269
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
270
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
271
|
+
)
|
272
|
+
_query_url = APIHelper.clean_url _query_builder
|
273
|
+
|
274
|
+
# Prepare headers.
|
275
|
+
_headers = {
|
276
|
+
'content-type' => 'application/xml; charset=utf-8'
|
277
|
+
}
|
278
|
+
|
279
|
+
# Prepare and execute HttpRequest.
|
280
|
+
_request = config.http_client.put(
|
281
|
+
_query_url,
|
282
|
+
headers: _headers,
|
283
|
+
parameters: body.to_json
|
284
|
+
)
|
285
|
+
VoiceBasicAuth.apply(config, _request)
|
286
|
+
_response = execute_request(_request)
|
287
|
+
|
288
|
+
# Validate response against endpoint and global error codes.
|
289
|
+
case _response.status_code
|
290
|
+
when 400
|
291
|
+
raise ApiErrorException.new(
|
292
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
293
|
+
' fix it before trying again.',
|
294
|
+
_response
|
295
|
+
)
|
296
|
+
when 401
|
297
|
+
raise APIException.new(
|
298
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
299
|
+
' credentials to authenticate to the API.',
|
300
|
+
_response
|
301
|
+
)
|
302
|
+
when 403
|
303
|
+
raise ApiErrorException.new(
|
304
|
+
'User unauthorized to perform this action.',
|
305
|
+
_response
|
306
|
+
)
|
307
|
+
when 404
|
308
|
+
raise ApiErrorException.new(
|
309
|
+
'The resource specified cannot be found or does not belong to you.',
|
310
|
+
_response
|
311
|
+
)
|
312
|
+
when 415
|
313
|
+
raise ApiErrorException.new(
|
314
|
+
'We don\'t support that media type. If a request body is required,' \
|
315
|
+
' please send it to us as `application/xml`.',
|
316
|
+
_response
|
317
|
+
)
|
318
|
+
when 429
|
319
|
+
raise ApiErrorException.new(
|
320
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
321
|
+
' slow your request rate down and try again.',
|
322
|
+
_response
|
323
|
+
)
|
324
|
+
when 500
|
325
|
+
raise ApiErrorException.new(
|
326
|
+
'Something unexpected happened. Please try again.',
|
327
|
+
_response
|
328
|
+
)
|
329
|
+
end
|
330
|
+
validate_response(_response)
|
331
|
+
|
332
|
+
# Return appropriate response type.
|
333
|
+
ApiResponse.new(_response)
|
334
|
+
end
|
335
|
+
|
255
336
|
# Pauses or resumes a recording.
|
256
337
|
# @param [String] account_id Required parameter: Example:
|
257
338
|
# @param [String] call_id Required parameter: Example:
|
@@ -25,126 +25,54 @@ module Bandwidth
|
|
25
25
|
# @return [String]
|
26
26
|
attr_accessor :uui
|
27
27
|
|
28
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
29
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
30
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
31
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
32
|
-
# characters, including parameters and separators.
|
33
28
|
# @return [Float]
|
34
29
|
attr_accessor :call_timeout
|
35
30
|
|
36
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
37
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
38
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
39
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
40
|
-
# characters, including parameters and separators.
|
41
31
|
# @return [Float]
|
42
32
|
attr_accessor :callback_timeout
|
43
33
|
|
44
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
45
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
46
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
47
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
48
|
-
# characters, including parameters and separators.
|
49
34
|
# @return [String]
|
50
35
|
attr_accessor :answer_url
|
51
36
|
|
52
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
53
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
54
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
55
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
56
|
-
# characters, including parameters and separators.
|
57
37
|
# @return [String]
|
58
38
|
attr_accessor :answer_fallback_url
|
59
39
|
|
60
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
61
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
62
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
63
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
64
|
-
# characters, including parameters and separators.
|
65
40
|
# @return [String]
|
66
41
|
attr_accessor :username
|
67
42
|
|
68
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
69
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
70
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
71
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
72
|
-
# characters, including parameters and separators.
|
73
43
|
# @return [String]
|
74
44
|
attr_accessor :password
|
75
45
|
|
76
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
77
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
78
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
79
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
80
|
-
# characters, including parameters and separators.
|
81
46
|
# @return [String]
|
82
47
|
attr_accessor :fallback_username
|
83
48
|
|
84
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
85
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
86
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
87
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
88
|
-
# characters, including parameters and separators.
|
89
49
|
# @return [String]
|
90
50
|
attr_accessor :fallback_password
|
91
51
|
|
92
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
93
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
94
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
95
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
96
|
-
# characters, including parameters and separators.
|
97
52
|
# @return [AnswerMethodEnum]
|
98
53
|
attr_accessor :answer_method
|
99
54
|
|
100
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
101
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
102
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
103
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
104
|
-
# characters, including parameters and separators.
|
105
55
|
# @return [AnswerFallbackMethodEnum]
|
106
56
|
attr_accessor :answer_fallback_method
|
107
57
|
|
108
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
109
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
110
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
111
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
112
|
-
# characters, including parameters and separators.
|
113
58
|
# @return [String]
|
114
59
|
attr_accessor :disconnect_url
|
115
60
|
|
116
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
117
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
118
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
119
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
120
|
-
# characters, including parameters and separators.
|
121
61
|
# @return [DisconnectMethodEnum]
|
122
62
|
attr_accessor :disconnect_method
|
123
63
|
|
124
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
125
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
126
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
127
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
128
|
-
# characters, including parameters and separators.
|
129
64
|
# @return [String]
|
130
65
|
attr_accessor :tag
|
131
66
|
|
132
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
133
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
134
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
135
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
136
|
-
# characters, including parameters and separators.
|
137
67
|
# @return [String]
|
138
68
|
attr_accessor :application_id
|
139
69
|
|
140
|
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
|
141
|
-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
|
142
|
-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
|
143
|
-
# 'base64' encodings are allowed. The entire value cannot exceed 350
|
144
|
-
# characters, including parameters and separators.
|
145
70
|
# @return [MachineDetectionRequest]
|
146
71
|
attr_accessor :machine_detection
|
147
72
|
|
73
|
+
# @return [Integer]
|
74
|
+
attr_accessor :priority
|
75
|
+
|
148
76
|
# A mapping from model property names to API property names.
|
149
77
|
def self.names
|
150
78
|
@_hash = {} if @_hash.nil?
|
@@ -166,6 +94,7 @@ module Bandwidth
|
|
166
94
|
@_hash['tag'] = 'tag'
|
167
95
|
@_hash['application_id'] = 'applicationId'
|
168
96
|
@_hash['machine_detection'] = 'machineDetection'
|
97
|
+
@_hash['priority'] = 'priority'
|
169
98
|
@_hash
|
170
99
|
end
|
171
100
|
|
@@ -186,6 +115,7 @@ module Bandwidth
|
|
186
115
|
disconnect_method
|
187
116
|
tag
|
188
117
|
machine_detection
|
118
|
+
priority
|
189
119
|
]
|
190
120
|
end
|
191
121
|
|
@@ -205,6 +135,7 @@ module Bandwidth
|
|
205
135
|
disconnect_url
|
206
136
|
disconnect_method
|
207
137
|
tag
|
138
|
+
priority
|
208
139
|
]
|
209
140
|
end
|
210
141
|
|
@@ -225,7 +156,8 @@ module Bandwidth
|
|
225
156
|
disconnect_url = nil,
|
226
157
|
disconnect_method = nil,
|
227
158
|
tag = nil,
|
228
|
-
machine_detection = nil
|
159
|
+
machine_detection = nil,
|
160
|
+
priority = nil)
|
229
161
|
@from = from unless from == SKIP
|
230
162
|
@to = to unless to == SKIP
|
231
163
|
@uui = uui unless uui == SKIP
|
@@ -244,6 +176,7 @@ module Bandwidth
|
|
244
176
|
@tag = tag unless tag == SKIP
|
245
177
|
@application_id = application_id unless application_id == SKIP
|
246
178
|
@machine_detection = machine_detection unless machine_detection == SKIP
|
179
|
+
@priority = priority unless priority == SKIP
|
247
180
|
end
|
248
181
|
|
249
182
|
# Creates an instance of the object from a hash.
|
@@ -276,6 +209,7 @@ module Bandwidth
|
|
276
209
|
tag = hash.key?('tag') ? hash['tag'] : SKIP
|
277
210
|
machine_detection = MachineDetectionConfiguration.from_hash(hash['machineDetection']) if
|
278
211
|
hash['machineDetection']
|
212
|
+
priority = hash.key?('priority') ? hash['priority'] : SKIP
|
279
213
|
|
280
214
|
# Create object from extracted values.
|
281
215
|
CreateCallRequest.new(from,
|
@@ -295,7 +229,8 @@ module Bandwidth
|
|
295
229
|
disconnect_url,
|
296
230
|
disconnect_method,
|
297
231
|
tag,
|
298
|
-
machine_detection
|
232
|
+
machine_detection,
|
233
|
+
priority)
|
299
234
|
end
|
300
235
|
end
|
301
236
|
end
|
@@ -90,6 +90,9 @@ module Bandwidth
|
|
90
90
|
# @return [String]
|
91
91
|
attr_accessor :tag
|
92
92
|
|
93
|
+
# @return [Integer]
|
94
|
+
attr_accessor :priority
|
95
|
+
|
93
96
|
# A mapping from model property names to API property names.
|
94
97
|
def self.names
|
95
98
|
@_hash = {} if @_hash.nil?
|
@@ -113,6 +116,7 @@ module Bandwidth
|
|
113
116
|
@_hash['fallback_username'] = 'fallbackUsername'
|
114
117
|
@_hash['fallback_password'] = 'fallbackPassword'
|
115
118
|
@_hash['tag'] = 'tag'
|
119
|
+
@_hash['priority'] = 'priority'
|
116
120
|
@_hash
|
117
121
|
end
|
118
122
|
|
@@ -130,6 +134,7 @@ module Bandwidth
|
|
130
134
|
fallback_username
|
131
135
|
fallback_password
|
132
136
|
tag
|
137
|
+
priority
|
133
138
|
]
|
134
139
|
end
|
135
140
|
|
@@ -145,6 +150,7 @@ module Bandwidth
|
|
145
150
|
fallback_username
|
146
151
|
fallback_password
|
147
152
|
tag
|
153
|
+
priority
|
148
154
|
]
|
149
155
|
end
|
150
156
|
|
@@ -167,7 +173,8 @@ module Bandwidth
|
|
167
173
|
password = nil,
|
168
174
|
fallback_username = nil,
|
169
175
|
fallback_password = nil,
|
170
|
-
tag = nil
|
176
|
+
tag = nil,
|
177
|
+
priority = nil)
|
171
178
|
@account_id = account_id unless account_id == SKIP
|
172
179
|
@call_id = call_id unless call_id == SKIP
|
173
180
|
@application_id = application_id unless application_id == SKIP
|
@@ -188,6 +195,7 @@ module Bandwidth
|
|
188
195
|
@fallback_username = fallback_username unless fallback_username == SKIP
|
189
196
|
@fallback_password = fallback_password unless fallback_password == SKIP
|
190
197
|
@tag = tag unless tag == SKIP
|
198
|
+
@priority = priority unless priority == SKIP
|
191
199
|
end
|
192
200
|
|
193
201
|
# Creates an instance of the object from a hash.
|
@@ -225,6 +233,7 @@ module Bandwidth
|
|
225
233
|
fallback_password =
|
226
234
|
hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
|
227
235
|
tag = hash.key?('tag') ? hash['tag'] : SKIP
|
236
|
+
priority = hash.key?('priority') ? hash['priority'] : SKIP
|
228
237
|
|
229
238
|
# Create object from extracted values.
|
230
239
|
CreateCallResponse.new(account_id,
|
@@ -246,7 +255,8 @@ module Bandwidth
|
|
246
255
|
password,
|
247
256
|
fallback_username,
|
248
257
|
fallback_password,
|
249
|
-
tag
|
258
|
+
tag,
|
259
|
+
priority)
|
250
260
|
end
|
251
261
|
|
252
262
|
def to_start_time
|
@@ -86,6 +86,11 @@ module Bandwidth
|
|
86
86
|
# @return [String]
|
87
87
|
attr_accessor :fallback_password
|
88
88
|
|
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
|
+
|
89
94
|
# A mapping from model property names to API property names.
|
90
95
|
def self.names
|
91
96
|
@_hash = {} if @_hash.nil?
|
@@ -103,6 +108,7 @@ module Bandwidth
|
|
103
108
|
@_hash['password'] = 'password'
|
104
109
|
@_hash['fallback_username'] = 'fallbackUsername'
|
105
110
|
@_hash['fallback_password'] = 'fallbackPassword'
|
111
|
+
@_hash['machine_speech_end_threshold'] = 'machineSpeechEndThreshold'
|
106
112
|
@_hash
|
107
113
|
end
|
108
114
|
|
@@ -123,6 +129,7 @@ module Bandwidth
|
|
123
129
|
password
|
124
130
|
fallback_username
|
125
131
|
fallback_password
|
132
|
+
machine_speech_end_threshold
|
126
133
|
]
|
127
134
|
end
|
128
135
|
|
@@ -137,6 +144,7 @@ module Bandwidth
|
|
137
144
|
password
|
138
145
|
fallback_username
|
139
146
|
fallback_password
|
147
|
+
machine_speech_end_threshold
|
140
148
|
]
|
141
149
|
end
|
142
150
|
|
@@ -153,7 +161,8 @@ module Bandwidth
|
|
153
161
|
username = nil,
|
154
162
|
password = nil,
|
155
163
|
fallback_username = nil,
|
156
|
-
fallback_password = nil
|
164
|
+
fallback_password = nil,
|
165
|
+
machine_speech_end_threshold = nil)
|
157
166
|
@mode = mode unless mode == SKIP
|
158
167
|
@detection_timeout = detection_timeout unless detection_timeout == SKIP
|
159
168
|
@silence_timeout = silence_timeout unless silence_timeout == SKIP
|
@@ -168,6 +177,7 @@ module Bandwidth
|
|
168
177
|
@password = password unless password == SKIP
|
169
178
|
@fallback_username = fallback_username unless fallback_username == SKIP
|
170
179
|
@fallback_password = fallback_password unless fallback_password == SKIP
|
180
|
+
@machine_speech_end_threshold = machine_speech_end_threshold unless machine_speech_end_threshold == SKIP
|
171
181
|
end
|
172
182
|
|
173
183
|
# Creates an instance of the object from a hash.
|
@@ -197,6 +207,8 @@ module Bandwidth
|
|
197
207
|
hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP
|
198
208
|
fallback_password =
|
199
209
|
hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
|
210
|
+
machine_speech_end_threshold =
|
211
|
+
hash.key?('machineSpeechEndThreshold') ? hash['machineSpeechEndThreshold'] : SKIP
|
200
212
|
|
201
213
|
# Create object from extracted values.
|
202
214
|
MachineDetectionConfiguration.new(mode,
|
@@ -212,7 +224,8 @@ module Bandwidth
|
|
212
224
|
username,
|
213
225
|
password,
|
214
226
|
fallback_username,
|
215
|
-
fallback_password
|
227
|
+
fallback_password,
|
228
|
+
machine_speech_end_threshold)
|
216
229
|
end
|
217
230
|
end
|
218
231
|
end
|
data/lib/bandwidth.rb
CHANGED
@@ -47,6 +47,7 @@ require_relative 'bandwidth/http/auth/web_rtc_basic_auth'
|
|
47
47
|
require_relative 'bandwidth/http/auth/web_rtc_basic_auth.rb'
|
48
48
|
|
49
49
|
# External Files
|
50
|
+
require_relative 'bandwidth/voice_lib/bxml/response.rb'
|
50
51
|
require_relative 'bandwidth/voice_lib/bxml/bxml.rb'
|
51
52
|
require_relative 'bandwidth/voice_lib/bxml/verbs/bridge.rb'
|
52
53
|
require_relative 'bandwidth/voice_lib/bxml/verbs/conference.rb'
|
@@ -128,6 +128,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
128
128
|
machine_detection.delay_result = true
|
129
129
|
machine_detection.callback_url = BASE_CALLBACK_URL + '/machineDetection'
|
130
130
|
machine_detection.callback_method = 'POST'
|
131
|
+
machine_detection.machine_speech_end_threshold = 3.2
|
131
132
|
|
132
133
|
body = CreateCallRequest.new
|
133
134
|
body.from = BW_NUMBER
|
@@ -143,6 +144,19 @@ class IntegrationTest < Test::Unit::TestCase
|
|
143
144
|
assert(response.data.state.length > 0, "state value not set")
|
144
145
|
end
|
145
146
|
|
147
|
+
def test_create_call_with_priority
|
148
|
+
body = CreateCallRequest.new
|
149
|
+
body.from = BW_NUMBER
|
150
|
+
body.to = USER_NUMBER
|
151
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
152
|
+
body.answer_url = BASE_CALLBACK_URL
|
153
|
+
body.priority = 1
|
154
|
+
|
155
|
+
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
156
|
+
assert(response.data.call_id.length > 0, "call_id value not set")
|
157
|
+
assert(response.data.priority == 1, "priority not set")
|
158
|
+
end
|
159
|
+
|
146
160
|
def test_create_call_invalid_phone_number
|
147
161
|
body = CreateCallRequest.new
|
148
162
|
body.from = BW_NUMBER
|
@@ -248,6 +262,34 @@ class IntegrationTest < Test::Unit::TestCase
|
|
248
262
|
assert_equal(expected, actual)
|
249
263
|
end
|
250
264
|
|
265
|
+
def test_empty_bxml_verb
|
266
|
+
bxml = Bandwidth::Voice::Bxml.new()
|
267
|
+
|
268
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Bxml></Bxml>'
|
269
|
+
actual = bxml.to_bxml()
|
270
|
+
assert_equal(expected, actual)
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_bxml_speak_sentence_pause
|
274
|
+
bxml = Bandwidth::Voice::Bxml.new()
|
275
|
+
|
276
|
+
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
277
|
+
:sentence => "new modify call bxml is pog",
|
278
|
+
:voice => "Julie"
|
279
|
+
})
|
280
|
+
|
281
|
+
pause = Bandwidth::Voice::Pause.new({
|
282
|
+
:duration => 6
|
283
|
+
})
|
284
|
+
|
285
|
+
bxml.push(speak_sentence)
|
286
|
+
bxml.push(pause)
|
287
|
+
|
288
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence voice="Julie">new modify call bxml is pog</SpeakSentence><Pause duration="6"/></Bxml>'
|
289
|
+
actual = bxml.to_bxml()
|
290
|
+
assert_equal(expected, actual)
|
291
|
+
end
|
292
|
+
|
251
293
|
def test_hangup
|
252
294
|
hangup = Bandwidth::Voice::Hangup.new()
|
253
295
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandwidth-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bandwidth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- lib/bandwidth/utilities/date_time_helper.rb
|
207
207
|
- lib/bandwidth/utilities/file_wrapper.rb
|
208
208
|
- lib/bandwidth/voice_lib/bxml/bxml.rb
|
209
|
+
- lib/bandwidth/voice_lib/bxml/response.rb
|
209
210
|
- lib/bandwidth/voice_lib/bxml/verbs/bridge.rb
|
210
211
|
- lib/bandwidth/voice_lib/bxml/verbs/conference.rb
|
211
212
|
- lib/bandwidth/voice_lib/bxml/verbs/forward.rb
|