plivo 4.21.0 → 4.22.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/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/plivo/resources/multipartycalls.rb +82 -3
- data/lib/plivo/version.rb +1 -1
- data/lib/plivo/xml/multipartycall.rb +23 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99a81ae9a72d5cd9f5332d84de77f442c565b9a5
|
|
4
|
+
data.tar.gz: 274d0f0c5e278e9fb003eda9c2b022a6840a99b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e5703701787286d5a30a520dedb09bd7c03593f0ac7f8d54a1cfa0ceafaaec31a8b91e135282022f8fcf2fc3fb79191e794bafe844733ac7fc09c337c1d86a3
|
|
7
|
+
data.tar.gz: edf485c5a4d6e3429dc1dec71fe32fe3d31662627bec06d2de407ee6320fc6b5b0bc1d5dce6ef79d6e88305fe76264dfbea5c848bc77e7f829a5168e3577cda9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [4.22.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.22.0) (2021-11-11)
|
|
4
|
+
**Features - Voice: Multiparty calls**
|
|
5
|
+
- The [Add Multiparty Call API](https://www.plivo.com/docs/voice/api/multiparty-call/participants#add-a-participant) allows for greater functionality by accepting options like `start recording audio`, `stop recording audio`, and their HTTP methods.
|
|
6
|
+
- [Multiparty Calls](https://www.plivo.com/docs/voice/api/multiparty-call/) now has new APIs to `stop` and `play` audio.
|
|
7
|
+
|
|
3
8
|
## [4.21.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.21.0) (2021-10-11)
|
|
4
9
|
**Features - Messaging**
|
|
5
10
|
- This version includes advancements to the Messaging Interface that deals with the [Send SMS/MMS](https://www.plivo.com/docs/sms/api/message#send-a-message) interface, Creating a standard structure for `request/input` arguments to make implementation easier and incorporating support for the older interface.
|
data/README.md
CHANGED
|
@@ -60,7 +60,11 @@ module Plivo
|
|
|
60
60
|
enter_sound='beep:1',
|
|
61
61
|
enter_sound_method='GET',
|
|
62
62
|
exit_sound='beep:2',
|
|
63
|
-
exit_sound_method='GET'
|
|
63
|
+
exit_sound_method='GET',
|
|
64
|
+
start_recording_audio=nil,
|
|
65
|
+
start_recording_audio_method='GET',
|
|
66
|
+
stop_recording_audio=nil,
|
|
67
|
+
stop_recording_audio_method='GET')
|
|
64
68
|
if (from and to) and call_uuid
|
|
65
69
|
raise_invalid_request('cannot specify call_uuid when (from, to) is provided')
|
|
66
70
|
end
|
|
@@ -117,6 +121,10 @@ module Plivo
|
|
|
117
121
|
valid_param?(:enter_sound_method, enter_sound_method.upcase, String, false, %w[GET POST])
|
|
118
122
|
is_one_among_string_url?(:exit_sound, exit_sound, false , %w[beep:1 beep:2 none])
|
|
119
123
|
valid_param?(:exit_sound_method, exit_sound_method.upcase, String, false, %w[GET POST])
|
|
124
|
+
valid_param?(:start_recording_audio_method, start_recording_audio_method.upcase, String, false, %w[GET POST])
|
|
125
|
+
valid_url?(:start_recording_audio, start_recording_audio, false ) unless start_recording_audio.nil?
|
|
126
|
+
valid_param?(:stop_recording_audio_method, stop_recording_audio_method.upcase, String, false, %w[GET POST])
|
|
127
|
+
valid_url?(:stop_recording_audio, stop_recording_audio, false ) unless stop_recording_audio.nil?
|
|
120
128
|
if (to!=nil) && (ring_timeout.is_a?(String)) && (to.split('<').size < ring_timeout.split('<').size)
|
|
121
129
|
raise_invalid_request("RingTimeout:number of ring_timout(s) should be same as number of destination(s)")
|
|
122
130
|
end
|
|
@@ -168,6 +176,10 @@ module Plivo
|
|
|
168
176
|
params[:enter_sound_method] = enter_sound_method.upcase unless exit_sound_method.nil?
|
|
169
177
|
params[:exit_sound] = exit_sound unless exit_sound.nil?
|
|
170
178
|
params[:exit_sound_method] = exit_sound_method.upcase unless exit_sound_method.nil?
|
|
179
|
+
params[:start_recording_audio] = start_recording_audio unless start_recording_audio.nil?
|
|
180
|
+
params[:start_recording_audio_method] = start_recording_audio_method.upcase unless start_recording_audio_method.nil?
|
|
181
|
+
params[:stop_recording_audio] = stop_recording_audio unless stop_recording_audio.nil?
|
|
182
|
+
params[:stop_recording_audio_method] = stop_recording_audio_method.upcase unless stop_recording_audio_method.nil?
|
|
171
183
|
perform_action_apiresponse('Participant', 'POST', params, true )
|
|
172
184
|
end
|
|
173
185
|
|
|
@@ -204,7 +216,6 @@ module Plivo
|
|
|
204
216
|
perform_action_apiresponse('Record/Resume', 'POST')
|
|
205
217
|
end
|
|
206
218
|
|
|
207
|
-
|
|
208
219
|
def start_participant_recording(member_id, file_format='mp3', status_callback_url=nil, status_callback_method='POST')
|
|
209
220
|
valid_param?(:member_id, member_id, [String, Integer], true)
|
|
210
221
|
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], member_id: member_id).start_participant_recording(file_format, status_callback_url, status_callback_method)
|
|
@@ -246,6 +257,17 @@ module Plivo
|
|
|
246
257
|
valid_param?(:member_id, member_id, [String, Integer], true)
|
|
247
258
|
MultiPartyCallParticipant.new(@_client,resource_id: @id, member_id: member_id).get_participant
|
|
248
259
|
end
|
|
260
|
+
|
|
261
|
+
def start_play_audio(member_id, url)
|
|
262
|
+
valid_param?(:member_id, member_id, [String, Integer], true)
|
|
263
|
+
valid_url?(:url, url, true)
|
|
264
|
+
MultiPartyCallMember.new(@_client, resource_id: @id, member_id: member_id).start_play_audio(url)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def stop_play_audio(member_id)
|
|
268
|
+
valid_param?(:member_id, member_id, [String, Integer], true)
|
|
269
|
+
MultiPartyCallMember.new(@_client, resource_id: @id, member_id: member_id).stop_play_audio
|
|
270
|
+
end
|
|
249
271
|
end
|
|
250
272
|
|
|
251
273
|
class MultiPartyCallParticipant < Base::SecondaryResource
|
|
@@ -311,6 +333,36 @@ module Plivo
|
|
|
311
333
|
end
|
|
312
334
|
end
|
|
313
335
|
|
|
336
|
+
class MultiPartyCallMember < Base::SecondaryResource
|
|
337
|
+
def initialize(client, options = nil)
|
|
338
|
+
@_name = 'MultiPartyCall'
|
|
339
|
+
@_identifier_string = 'mpc_uuid'
|
|
340
|
+
@_secondary_name = 'Member'
|
|
341
|
+
@_secondary_identifier_string = 'member_id'
|
|
342
|
+
super
|
|
343
|
+
@_is_voice_request = true
|
|
344
|
+
if options.key? :multi_party_prefix
|
|
345
|
+
@id = options[:multi_party_prefix] + '_' + @id
|
|
346
|
+
elsif @id.split('_').size > 1
|
|
347
|
+
nil
|
|
348
|
+
else
|
|
349
|
+
@id = 'uuid_' + @id
|
|
350
|
+
end
|
|
351
|
+
configure_secondary_resource_uri
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
def start_play_audio(url)
|
|
355
|
+
valid_url?(:url, url, true)
|
|
356
|
+
params = {}
|
|
357
|
+
params[:url] = url unless url.nil?
|
|
358
|
+
perform_action_apiresponse('Play', 'POST', params, true)
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def stop_play_audio
|
|
362
|
+
perform_action_apiresponse('Play', 'DELETE')
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
314
366
|
class MultiPartyCallInterface < Base::ResourceInterface
|
|
315
367
|
def initialize(client, resource_list_json = nil)
|
|
316
368
|
@_name = 'MultiPartyCall'
|
|
@@ -394,6 +446,8 @@ module Plivo
|
|
|
394
446
|
options[:enter_sound_method] = 'GET' unless options.key?(:enter_sound_method)
|
|
395
447
|
options[:exit_sound] = 'beep:2' unless options.key?(:exit_sound)
|
|
396
448
|
options[:exit_sound_method] = 'GET' unless options.key?(:exit_sound_method)
|
|
449
|
+
options[:start_recording_audio_method] = 'GET' unless options.key?(:start_recording_audio_method)
|
|
450
|
+
options[:stop_recording_audio_method] = 'GET' unless options.key?(:stop_recording_audio_method)
|
|
397
451
|
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
|
398
452
|
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
|
399
453
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
|
@@ -403,7 +457,8 @@ module Plivo
|
|
|
403
457
|
options[:wait_music_method],options[:agent_hold_music_url],options[:agent_hold_music_method],options[:customer_hold_music_url],options[:customer_hold_music_method],
|
|
404
458
|
options[:recording_callback_url],options[:recording_callback_method],options[:status_callback_url],options[:status_callback_method],options[:on_exit_action_url], options[:on_exit_action_method],
|
|
405
459
|
options[:record],options[:record_file_format],options[:status_callback_events],options[:stay_alone], options[:coach_mode],options[:mute],options[:hold],options[:start_mpc_on_enter],options[:end_mpc_on_exit],
|
|
406
|
-
options[:relay_dtmf_inputs],options[:enter_sound],options[:enter_sound_method],options[:exit_sound],options[:exit_sound_method]
|
|
460
|
+
options[:relay_dtmf_inputs],options[:enter_sound],options[:enter_sound_method],options[:exit_sound],options[:exit_sound_method], options[:start_recording_audio], options[:start_recording_audio_method],
|
|
461
|
+
options[:stop_recording_audio], options[:stop_recording_audio_method])
|
|
407
462
|
end
|
|
408
463
|
|
|
409
464
|
def start(options = {})
|
|
@@ -549,6 +604,30 @@ module Plivo
|
|
|
549
604
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
|
550
605
|
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).get_participant
|
|
551
606
|
end
|
|
607
|
+
|
|
608
|
+
def start_play_audio(options = {})
|
|
609
|
+
valid_param?(:options, options, Hash, false)
|
|
610
|
+
if not options[:member_id]
|
|
611
|
+
raise_invalid_request("Member Id is mandatory")
|
|
612
|
+
end
|
|
613
|
+
valid_param?(:member_id, options[:member_id], [String, Integer], true)
|
|
614
|
+
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
|
615
|
+
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
|
616
|
+
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
|
617
|
+
MultiPartyCallMember.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_play_audio(options[:url])
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
def stop_play_audio(options = {})
|
|
621
|
+
valid_param?(:options, options, Hash, false)
|
|
622
|
+
if not options[:member_id]
|
|
623
|
+
raise_invalid_request("Member Id is mandatory")
|
|
624
|
+
end
|
|
625
|
+
valid_param?(:member_id, options[:member_id], [String, Integer], true)
|
|
626
|
+
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
|
627
|
+
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
|
628
|
+
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
|
629
|
+
MultiPartyCallMember.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).stop_play_audio
|
|
630
|
+
end
|
|
552
631
|
end
|
|
553
632
|
end
|
|
554
633
|
end
|
data/lib/plivo/version.rb
CHANGED
|
@@ -9,7 +9,9 @@ module Plivo
|
|
|
9
9
|
statusCallbackEvents statusCallbackUrl statusCallbackMethod
|
|
10
10
|
stayAlone coachMode mute hold startMpcOnEnter endMpcOnExit
|
|
11
11
|
enterSound enterSoundMethod exitSound exitSoundMethod
|
|
12
|
-
onExitActionUrl onExitActionMethod relayDTMFInputs
|
|
12
|
+
onExitActionUrl onExitActionMethod relayDTMFInputs
|
|
13
|
+
startRecordingAudio startRecordingAudioMethod
|
|
14
|
+
stopRecordingAudio stopRecordingAudioMethod]
|
|
13
15
|
|
|
14
16
|
VALID_ROLE_VALUES = %w[agent supervisor customer]
|
|
15
17
|
VALID_METHOD_VALUES = %w[GET POST]
|
|
@@ -179,6 +181,26 @@ module Plivo
|
|
|
179
181
|
raise PlivoXMLError, "invalid attribute value #{attributes[:customerHoldMusicUrl]} for customerHoldMusicUrl"
|
|
180
182
|
end
|
|
181
183
|
|
|
184
|
+
if attributes[:startRecordingAudio] && !valid_url?(:startRecordingAudio, attributes[:startRecordingAudio], false)
|
|
185
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudio]} for startRecordingAudio"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
if attributes[:stopRecordingAudio] && !valid_url?(:stopRecordingAudio, attributes[:stopRecordingAudio], false)
|
|
189
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudio]} for stopRecordingAudio"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
if attributes[:startRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:startRecordingAudioMethod].upcase)
|
|
193
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudioMethod]} for startRecordingAudioMethod"
|
|
194
|
+
elsif !attributes[:startRecordingAudioMethod]
|
|
195
|
+
attributes[:startRecordingAudioMethod] = 'GET'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if attributes[:stopRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:stopRecordingAudioMethod].upcase)
|
|
199
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudioMethod]} for stopRecordingAudioMethod"
|
|
200
|
+
elsif !attributes[:stopRecordingAudioMethod]
|
|
201
|
+
attributes[:stopRecordingAudioMethod] = 'GET'
|
|
202
|
+
end
|
|
203
|
+
|
|
182
204
|
raise PlivoXMLError, 'No MPC name set for the MPC' unless body
|
|
183
205
|
super(body, attributes)
|
|
184
206
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plivo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Plivo SDKs Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10
|
|
11
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|