voiceml 0.9.2 → 0.9.3
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/README.md +17 -13
- data/lib/voiceml/client.rb +53 -13
- data/lib/voiceml/errors.rb +15 -2
- data/lib/voiceml/models/accounts.rb +47 -3
- data/lib/voiceml/models/applications.rb +6 -0
- data/lib/voiceml/models/assistants_v1.rb +40 -0
- data/lib/voiceml/models/calls.rb +4 -0
- data/lib/voiceml/models/common.rb +35 -4
- data/lib/voiceml/models/conferences.rb +8 -0
- data/lib/voiceml/models/conversations_v1.rb +131 -29
- data/lib/voiceml/models/diagnostics.rb +33 -12
- data/lib/voiceml/models/exports.rb +58 -0
- data/lib/voiceml/models/incoming_phone_numbers.rb +4 -0
- data/lib/voiceml/models/media.rb +4 -0
- data/lib/voiceml/models/messages.rb +29 -0
- data/lib/voiceml/models/messaging_v1.rb +35 -2
- data/lib/voiceml/models/monitor_v1.rb +54 -0
- data/lib/voiceml/models/notifications.rb +2 -0
- data/lib/voiceml/models/outgoing_caller_ids.rb +6 -0
- data/lib/voiceml/models/payments.rb +2 -0
- data/lib/voiceml/models/pricing.rb +38 -4
- data/lib/voiceml/models/queues.rb +8 -0
- data/lib/voiceml/models/recordings.rb +5 -1
- data/lib/voiceml/models/routes_v2.rb +6 -2
- data/lib/voiceml/models/sip.rb +34 -6
- data/lib/voiceml/models/sip_registrations.rb +49 -0
- data/lib/voiceml/models/siprec.rb +5 -17
- data/lib/voiceml/models/streams.rb +4 -16
- data/lib/voiceml/models/transcriptions.rb +35 -4
- data/lib/voiceml/models/usage_records.rb +48 -0
- data/lib/voiceml/models/user_defined_messages.rb +2 -0
- data/lib/voiceml/models/voice_v1.rb +29 -19
- data/lib/voiceml/request_validator.rb +125 -0
- data/lib/voiceml/resources/accounts.rb +75 -0
- data/lib/voiceml/resources/applications.rb +3 -1
- data/lib/voiceml/resources/assistants_v1.rb +53 -77
- data/lib/voiceml/resources/base.rb +138 -16
- data/lib/voiceml/resources/calls.rb +34 -49
- data/lib/voiceml/resources/conferences.rb +26 -5
- data/lib/voiceml/resources/conversations_v1.rb +147 -172
- data/lib/voiceml/resources/diagnostics.rb +20 -35
- data/lib/voiceml/resources/exports.rb +36 -0
- data/lib/voiceml/resources/incoming_phone_numbers.rb +53 -32
- data/lib/voiceml/resources/messages.rb +79 -15
- data/lib/voiceml/resources/messaging_v1.rb +47 -13
- data/lib/voiceml/resources/monitor_v1.rb +68 -0
- data/lib/voiceml/resources/notifications.rb +1 -1
- data/lib/voiceml/resources/outgoing_caller_ids.rb +77 -0
- data/lib/voiceml/resources/pricing.rb +13 -5
- data/lib/voiceml/resources/queues.rb +6 -5
- data/lib/voiceml/resources/recordings.rb +39 -5
- data/lib/voiceml/resources/routes_v2.rb +10 -4
- data/lib/voiceml/resources/sip.rb +30 -11
- data/lib/voiceml/resources/transcriptions.rb +40 -0
- data/lib/voiceml/resources/usage_records.rb +51 -0
- data/lib/voiceml/resources/voice_v1.rb +31 -38
- data/lib/voiceml/transport.rb +277 -230
- data/lib/voiceml/version.rb +1 -1
- data/lib/voiceml.rb +14 -15
- metadata +18 -6
|
@@ -74,9 +74,6 @@ module VoiceML
|
|
|
74
74
|
'StartTime' => :start_time,
|
|
75
75
|
'StartTime<' => :start_time_lt,
|
|
76
76
|
'StartTime>' => :start_time_gt,
|
|
77
|
-
# Note: spec defines `StartTime>=` and `StartTime<=` as the literal query names.
|
|
78
|
-
'StartTime>=' => :start_time_gte,
|
|
79
|
-
'StartTime<=' => :start_time_lte,
|
|
80
77
|
'EndTime' => :end_time,
|
|
81
78
|
'EndTime<' => :end_time_lt,
|
|
82
79
|
'EndTime>' => :end_time_gt,
|
|
@@ -113,12 +110,18 @@ module VoiceML
|
|
|
113
110
|
START_RECORDING_FIELDS = {
|
|
114
111
|
'RecordingMaxDuration' => :recording_max_duration,
|
|
115
112
|
'RecordingChannels' => :recording_channels,
|
|
113
|
+
'RecordingTrack' => :recording_track,
|
|
116
114
|
'PlayBeep' => :play_beep,
|
|
117
115
|
'RecordingStatusCallback' => :recording_status_callback,
|
|
118
116
|
'RecordingStatusCallbackMethod' => :recording_status_callback_method,
|
|
119
117
|
'RecordingStatusCallbackEvent' => :recording_status_callback_event
|
|
120
118
|
}.freeze
|
|
121
119
|
|
|
120
|
+
UPDATE_RECORDING_FIELDS = {
|
|
121
|
+
'Status' => :status,
|
|
122
|
+
'PauseBehavior' => :pause_behavior
|
|
123
|
+
}.freeze
|
|
124
|
+
|
|
122
125
|
START_STREAM_FIELDS = {
|
|
123
126
|
'Url' => :url,
|
|
124
127
|
'Track' => :track,
|
|
@@ -182,20 +185,23 @@ module VoiceML
|
|
|
182
185
|
CallList.from_hash(data)
|
|
183
186
|
end
|
|
184
187
|
|
|
185
|
-
# Walk every page of /Calls and yield each Call
|
|
186
|
-
#
|
|
188
|
+
# Walk every page of /Calls and yield each Call, following the envelope's
|
|
189
|
+
# `next_page_uri` verbatim (path + query, including its `PageToken`).
|
|
190
|
+
# Returns an Enumerator when called without a block; stopping early makes
|
|
191
|
+
# no further requests.
|
|
187
192
|
#
|
|
188
193
|
# @yield [VoiceML::Call]
|
|
189
194
|
# @return [Enumerator<VoiceML::Call>] when no block given
|
|
190
195
|
def each(**kwargs, &block)
|
|
191
196
|
return enum_for(:each, **kwargs) unless block
|
|
192
197
|
|
|
193
|
-
|
|
198
|
+
page = list(**kwargs)
|
|
194
199
|
loop do
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
break if
|
|
198
|
-
|
|
200
|
+
page.calls.each(&block)
|
|
201
|
+
nxt = next_page(page)
|
|
202
|
+
break if nxt.nil?
|
|
203
|
+
|
|
204
|
+
page = nxt
|
|
199
205
|
end
|
|
200
206
|
end
|
|
201
207
|
|
|
@@ -254,10 +260,13 @@ module VoiceML
|
|
|
254
260
|
end
|
|
255
261
|
|
|
256
262
|
# @param status [String] one of "in-progress", "paused", "stopped".
|
|
263
|
+
# @param pause_behavior [String, nil] how a paused recording treats silence
|
|
264
|
+
# (e.g. "skip" — see the API docs for `PauseBehavior`).
|
|
257
265
|
# @return [VoiceML::Recording]
|
|
258
|
-
def update_recording(call_sid, recording_sid, status:)
|
|
266
|
+
def update_recording(call_sid, recording_sid, status:, pause_behavior: nil)
|
|
259
267
|
data = @transport.request(:post, path('Calls', call_sid, 'Recordings', recording_sid),
|
|
260
|
-
form:
|
|
268
|
+
form: form_params(UPDATE_RECORDING_FIELDS,
|
|
269
|
+
{ status: status, pause_behavior: pause_behavior }))
|
|
261
270
|
Recording.from_hash(data)
|
|
262
271
|
end
|
|
263
272
|
|
|
@@ -268,11 +277,10 @@ module VoiceML
|
|
|
268
277
|
end
|
|
269
278
|
|
|
270
279
|
# --- Streams ---
|
|
271
|
-
|
|
272
|
-
#
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
end
|
|
280
|
+
#
|
|
281
|
+
# Only start (`POST …/Streams`) and stop (`POST …/Streams/{Sid}`) exist;
|
|
282
|
+
# the list/fetch GETs were removed from the API (the server answers
|
|
283
|
+
# 405 / error code 20004 for them).
|
|
276
284
|
|
|
277
285
|
# @return [VoiceML::Stream]
|
|
278
286
|
def start_stream(call_sid, **kwargs)
|
|
@@ -281,11 +289,6 @@ module VoiceML
|
|
|
281
289
|
Stream.from_hash(data)
|
|
282
290
|
end
|
|
283
291
|
|
|
284
|
-
# @return [VoiceML::Stream]
|
|
285
|
-
def get_stream(call_sid, stream_sid)
|
|
286
|
-
Stream.from_hash(@transport.request(:get, path('Calls', call_sid, 'Streams', stream_sid)))
|
|
287
|
-
end
|
|
288
|
-
|
|
289
292
|
# @return [VoiceML::Stream]
|
|
290
293
|
def stop_stream(call_sid, stream_sid)
|
|
291
294
|
data = @transport.request(:post, path('Calls', call_sid, 'Streams', stream_sid),
|
|
@@ -294,11 +297,9 @@ module VoiceML
|
|
|
294
297
|
end
|
|
295
298
|
|
|
296
299
|
# --- SIPREC ---
|
|
297
|
-
|
|
298
|
-
#
|
|
299
|
-
|
|
300
|
-
SiprecList.from_hash(@transport.request(:get, path('Calls', call_sid, 'Siprec')))
|
|
301
|
-
end
|
|
300
|
+
#
|
|
301
|
+
# Only start (`POST …/Siprec`) and stop (`POST …/Siprec/{Sid}`) exist; the
|
|
302
|
+
# list/fetch GETs were removed from the API (405 / 20004).
|
|
302
303
|
|
|
303
304
|
# @return [VoiceML::SiprecSession]
|
|
304
305
|
def start_siprec(call_sid, **kwargs)
|
|
@@ -307,13 +308,6 @@ module VoiceML
|
|
|
307
308
|
SiprecSession.from_hash(data)
|
|
308
309
|
end
|
|
309
310
|
|
|
310
|
-
# @return [VoiceML::SiprecSession]
|
|
311
|
-
def get_siprec(call_sid, siprec_sid)
|
|
312
|
-
SiprecSession.from_hash(
|
|
313
|
-
@transport.request(:get, path('Calls', call_sid, 'Siprec', siprec_sid))
|
|
314
|
-
)
|
|
315
|
-
end
|
|
316
|
-
|
|
317
311
|
# @return [VoiceML::SiprecSession]
|
|
318
312
|
def stop_siprec(call_sid, siprec_sid)
|
|
319
313
|
data = @transport.request(:post, path('Calls', call_sid, 'Siprec', siprec_sid),
|
|
@@ -322,13 +316,11 @@ module VoiceML
|
|
|
322
316
|
end
|
|
323
317
|
|
|
324
318
|
# --- Transcriptions ---
|
|
325
|
-
|
|
326
|
-
#
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
)
|
|
331
|
-
end
|
|
319
|
+
#
|
|
320
|
+
# Only start (`POST …/Transcriptions`) and stop (`POST …/Transcriptions/{Sid}`)
|
|
321
|
+
# exist on the live call; the list/fetch GETs were removed from the API
|
|
322
|
+
# (405 / 20004). Stored-recording transcriptions live on
|
|
323
|
+
# {VoiceML::RecordingsResource} and {VoiceML::TranscriptionsResource}.
|
|
332
324
|
|
|
333
325
|
# @return [VoiceML::CallTranscription]
|
|
334
326
|
def start_transcription(call_sid, **kwargs)
|
|
@@ -337,13 +329,6 @@ module VoiceML
|
|
|
337
329
|
CallTranscription.from_hash(data)
|
|
338
330
|
end
|
|
339
331
|
|
|
340
|
-
# @return [VoiceML::CallTranscription]
|
|
341
|
-
def get_transcription(call_sid, transcription_sid)
|
|
342
|
-
CallTranscription.from_hash(
|
|
343
|
-
@transport.request(:get, path('Calls', call_sid, 'Transcriptions', transcription_sid))
|
|
344
|
-
)
|
|
345
|
-
end
|
|
346
|
-
|
|
347
332
|
# @return [VoiceML::CallTranscription]
|
|
348
333
|
def stop_transcription(call_sid, transcription_sid)
|
|
349
334
|
data = @transport.request(:post,
|
|
@@ -364,7 +349,7 @@ module VoiceML
|
|
|
364
349
|
|
|
365
350
|
# @return [Hash]
|
|
366
351
|
def get_notification(call_sid, notification_sid)
|
|
367
|
-
@transport.request(:get, path('Calls', call_sid, 'Notifications', notification_sid))
|
|
352
|
+
Notification.from_hash(@transport.request(:get, path('Calls', call_sid, 'Notifications', notification_sid)))
|
|
368
353
|
end
|
|
369
354
|
|
|
370
355
|
# @return [VoiceML::EventsList]
|
|
@@ -43,6 +43,12 @@ module VoiceML
|
|
|
43
43
|
'Status' => :status
|
|
44
44
|
}.freeze
|
|
45
45
|
|
|
46
|
+
START_RECORDING_FIELDS = {
|
|
47
|
+
'RecordingStatusCallback' => :recording_status_callback,
|
|
48
|
+
'RecordingStatusCallbackMethod' => :recording_status_callback_method,
|
|
49
|
+
'RecordingStatusCallbackEvent' => :recording_status_callback_event
|
|
50
|
+
}.freeze
|
|
51
|
+
|
|
46
52
|
LIST_PARTICIPANTS_FIELDS = {
|
|
47
53
|
'Muted' => :muted,
|
|
48
54
|
'Hold' => :hold,
|
|
@@ -73,12 +79,13 @@ module VoiceML
|
|
|
73
79
|
def each(**kwargs, &block)
|
|
74
80
|
return enum_for(:each, **kwargs) unless block
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
page = list(**kwargs)
|
|
77
83
|
loop do
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
break if
|
|
81
|
-
|
|
84
|
+
page.conferences.each(&block)
|
|
85
|
+
nxt = next_page(page)
|
|
86
|
+
break if nxt.nil?
|
|
87
|
+
|
|
88
|
+
page = nxt
|
|
82
89
|
end
|
|
83
90
|
end
|
|
84
91
|
|
|
@@ -152,6 +159,20 @@ module VoiceML
|
|
|
152
159
|
)
|
|
153
160
|
end
|
|
154
161
|
|
|
162
|
+
# Start recording a conference. The conference-scoped create accepts only
|
|
163
|
+
# the recording status callback fields (per-call recording start, with the
|
|
164
|
+
# full field set, lives on {VoiceML::CallsResource#start_recording}).
|
|
165
|
+
#
|
|
166
|
+
# @return [VoiceML::Recording]
|
|
167
|
+
def start_recording(conference_sid, **kwargs)
|
|
168
|
+
data = @transport.request(
|
|
169
|
+
:post,
|
|
170
|
+
path('Conferences', conference_sid, 'Recordings'),
|
|
171
|
+
form: form_params(START_RECORDING_FIELDS, kwargs)
|
|
172
|
+
)
|
|
173
|
+
Recording.from_hash(data)
|
|
174
|
+
end
|
|
175
|
+
|
|
155
176
|
# @return [VoiceML::Recording]
|
|
156
177
|
def get_recording(conference_sid, recording_sid)
|
|
157
178
|
Recording.from_hash(
|