plivo 4.21.0 → 4.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/unitTests.yml +32 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +1 -0
- data/README.md +3 -2
- data/lib/plivo/base.rb +3 -3
- data/lib/plivo/resources/brand.rb +62 -0
- data/lib/plivo/resources/campaign.rb +62 -0
- data/lib/plivo/resources/multipartycalls.rb +98 -19
- data/lib/plivo/resources.rb +2 -0
- data/lib/plivo/rest_client.rb +3 -0
- data/lib/plivo/utils.rb +1 -1
- data/lib/plivo/version.rb +1 -1
- data/lib/plivo/xml/multipartycall.rb +23 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbaf4fabdd81296b5818890fc82e5d651ba24e8b
|
4
|
+
data.tar.gz: 9943aaacb63c0022e3052533cc951d72f30e2e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affc19347cdbec6fa100c74c058588a9f69c1225c9c496ebf506d05cb10cf2ff917a0b4d53a2c850756d9a3ed93e3df1bdb0954bc0593e8a8e7de5f5b9cba9c0
|
7
|
+
data.tar.gz: 3d357b1f45ff1949d6bb2e6d0cc9cdadd775366c62a534d602c5c448ea25d9859c193ffcd17593e6becbbabde923f96912adf63e0a47c1ae615e5a51b6d7211d
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: UnitTest
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ unitTests ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: UnitTest
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: [ '2.4', '2.5', '2.6' ,'2.7', '3.0' ]
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- name: Checkout
|
19
|
+
uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
- name: Dependencies Installation
|
25
|
+
run: |
|
26
|
+
bundle install --without development
|
27
|
+
- name: Run Tests
|
28
|
+
run: |
|
29
|
+
ruby --version
|
30
|
+
bundle exec rake
|
31
|
+
rm Gemfile.lock
|
32
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [4.25.0](https://github.com/plivo/plivo-ruby/tree/v4.25.0) (2022-01-27)
|
4
|
+
**Features - MPCStartCallRecording**
|
5
|
+
- parameter name change from statusCallback to recordingCallback
|
6
|
+
|
7
|
+
## [4.24.0](https://github.com/plivo/plivo-ruby/tree/v4.24.0) (2021-12-14)
|
8
|
+
**Features - Voice**
|
9
|
+
- Routing SDK traffic through Akamai endpoints for all the [Voice APIs](https://www.plivo.com/docs/voice/api/overview/)
|
10
|
+
|
11
|
+
## [4.23.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.23.0) (2021-12-02)
|
12
|
+
**Features - Messaging: 10 DLC**
|
13
|
+
- 10DLC API's for brand and campaign support.
|
14
|
+
|
15
|
+
## [4.22.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.22.0) (2021-11-11)
|
16
|
+
**Features - Voice: Multiparty call**
|
17
|
+
- 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.
|
18
|
+
- [Multiparty Calls](https://www.plivo.com/docs/voice/api/multiparty-call/) now has new APIs to `stop` and `play` audio.
|
19
|
+
|
3
20
|
## [4.21.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.21.0) (2021-10-11)
|
4
21
|
**Features - Messaging**
|
5
22
|
- 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/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# plivo-ruby
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![UnitTest](https://github.com/plivo/plivo-ruby/actions/workflows/unitTests.yml/badge.svg?branch=ns-ut-fix)](https://github.com/plivo/plivo-ruby/actions/workflows/unitTests.yml)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/plivo.svg)](https://badge.fury.io/rb/plivo)
|
4
5
|
|
5
6
|
The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby applications using the Plivo REST API. Using the SDK, you will be able to make voice calls, send SMS and generate Plivo XML to control your call flows.
|
6
7
|
|
@@ -8,7 +9,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a
|
|
8
9
|
Add this line to your application's Gemfile:
|
9
10
|
|
10
11
|
```ruby
|
11
|
-
gem 'plivo', '>= 4.
|
12
|
+
gem 'plivo', '>= 4.25.0'
|
12
13
|
```
|
13
14
|
|
14
15
|
And then execute:
|
data/lib/plivo/base.rb
CHANGED
@@ -6,9 +6,9 @@ module Plivo
|
|
6
6
|
module Base
|
7
7
|
PLIVO_API_URL = 'https://api.plivo.com'.freeze
|
8
8
|
|
9
|
-
API_VOICE = 'https://
|
10
|
-
API_VOICE_FALLBACK_1 = 'https://
|
11
|
-
API_VOICE_FALLBACK_2 = 'https://
|
9
|
+
API_VOICE = 'https://api.plivo.com'.freeze
|
10
|
+
API_VOICE_FALLBACK_1 = 'https://api.plivo.com'.freeze
|
11
|
+
API_VOICE_FALLBACK_2 = 'https://api.plivo.com'.freeze
|
12
12
|
|
13
13
|
CALLINSIGHTS_API_URL = 'https://stats.plivo.com'.freeze
|
14
14
|
PHLO_API_URL = 'https://phlorunner.plivo.com'.freeze
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo::Utils
|
4
|
+
class Brand < Base::Resource
|
5
|
+
def initialize(client, options = nil)
|
6
|
+
@_name = '10dlc/Brand'
|
7
|
+
@_identifier_string = 'brand_id'
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
brand: @brand
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class BrandInterface < Base::ResourceInterface
|
20
|
+
def initialize(client, resource_list_json = nil)
|
21
|
+
@_name = '10dlc/Brand'
|
22
|
+
@_resource_type = Brand
|
23
|
+
@_identifier_string = 'brand_id'
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Get an Brand
|
29
|
+
# @param [String] brand_id
|
30
|
+
# @return [Brand] Brand
|
31
|
+
def get(brand_id)
|
32
|
+
valid_param?(:brand_id, brand_id, [String, Symbol], true)
|
33
|
+
perform_get(brand_id)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# List all Brand
|
38
|
+
# @param [Hash] options
|
39
|
+
# @option options [String] :type
|
40
|
+
# @option options [Status] :status
|
41
|
+
# @return [Hash]
|
42
|
+
def list(options=nil)
|
43
|
+
return perform_list_without_object if options.nil?
|
44
|
+
|
45
|
+
params = {}
|
46
|
+
%i[status type].each do |param|
|
47
|
+
if options.key?(param) && valid_param?(param, options[param],
|
48
|
+
[String], true)
|
49
|
+
params[param] = options[param]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
perform_list_without_object(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Create a new brand
|
57
|
+
def create(params)
|
58
|
+
perform_create(params)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo::Utils
|
4
|
+
class Campaign < Base::Resource
|
5
|
+
def initialize(client, options = nil)
|
6
|
+
@_name = '10dlc/Campaign'
|
7
|
+
@_identifier_string = 'campaign_id'
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
campaign: @campaign
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class CampaignInterface < Base::ResourceInterface
|
20
|
+
def initialize(client, resource_list_json = nil)
|
21
|
+
@_name = '10dlc/Campaign'
|
22
|
+
@_resource_type = Campaign
|
23
|
+
@_identifier_string = 'campaign_id'
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Get an Campaign
|
29
|
+
# @param [String] campaign_id
|
30
|
+
# @return [Campaign] Campaign
|
31
|
+
def get(campaign_id)
|
32
|
+
valid_param?(:campaign_id, campaign_id, [String, Symbol], true)
|
33
|
+
perform_get(campaign_id)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# List all Campaign
|
38
|
+
# @param [Hash] options
|
39
|
+
# @option options [String] :brand
|
40
|
+
# @option options [Status] :usecase
|
41
|
+
# @return [Hash]
|
42
|
+
def list(options=nil)
|
43
|
+
return perform_list_without_object if options.nil?
|
44
|
+
|
45
|
+
params = {}
|
46
|
+
%i[usecase brand].each do |param|
|
47
|
+
if options.key?(param) && valid_param?(param, options[param],
|
48
|
+
[String], true)
|
49
|
+
params[param] = options[param]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
perform_list_without_object(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Create a new Camapign
|
57
|
+
def create(params)
|
58
|
+
perform_create(params)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -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
|
|
@@ -179,15 +191,15 @@ module Plivo
|
|
179
191
|
perform_action_apiresponse(nil, 'DELETE', nil, true)
|
180
192
|
end
|
181
193
|
|
182
|
-
def start_recording(file_format = 'mp3',
|
194
|
+
def start_recording(file_format = 'mp3', recording_callback_url = nil, recording_callback_method='POST')
|
183
195
|
valid_param?(:file_format, file_format, String, false , %w[mp3 wav])
|
184
|
-
valid_url?(:
|
185
|
-
valid_param?(:
|
196
|
+
valid_url?(:recording_callback_url, recording_callback_url, false) unless recording_callback_url.nil?
|
197
|
+
valid_param?(:recording_callback_method, recording_callback_method.upcase,String, false, %w[GET POST])
|
186
198
|
|
187
199
|
params = {}
|
188
200
|
params[:file_format] = file_format.downcase unless file_format.nil?
|
189
|
-
params[:
|
190
|
-
params[:
|
201
|
+
params[:recording_callback_url] = recording_callback_url unless recording_callback_url.nil?
|
202
|
+
params[:recording_callback_method] = recording_callback_method.upcase unless recording_callback_method.nil?
|
191
203
|
|
192
204
|
perform_action_apiresponse('Record', 'POST', params, true)
|
193
205
|
end
|
@@ -204,10 +216,9 @@ module Plivo
|
|
204
216
|
perform_action_apiresponse('Record/Resume', 'POST')
|
205
217
|
end
|
206
218
|
|
207
|
-
|
208
|
-
def start_participant_recording(member_id, file_format='mp3', status_callback_url=nil, status_callback_method='POST')
|
219
|
+
def start_participant_recording(member_id, file_format='mp3', recording_callback_url=nil, recording_callback_method='POST')
|
209
220
|
valid_param?(:member_id, member_id, [String, Integer], true)
|
210
|
-
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], member_id: member_id).start_participant_recording(file_format,
|
221
|
+
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], member_id: member_id).start_participant_recording(file_format, recording_callback_url, recording_callback_method)
|
211
222
|
end
|
212
223
|
|
213
224
|
def stop_participant_recording(member_id)
|
@@ -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
|
@@ -266,15 +288,15 @@ module Plivo
|
|
266
288
|
configure_secondary_resource_uri
|
267
289
|
end
|
268
290
|
|
269
|
-
def start_participant_recording(file_format = 'mp3',
|
291
|
+
def start_participant_recording(file_format = 'mp3', recording_callback_url = nil, recording_callback_method='POST')
|
270
292
|
valid_param?(:file_format, file_format, String, false , %w[mp3 wav])
|
271
|
-
valid_url?(:
|
272
|
-
valid_param?(:
|
293
|
+
valid_url?(:recording_callback_url, recording_callback_url, false) unless recording_callback_url.nil?
|
294
|
+
valid_param?(:recording_callback_method, recording_callback_method.upcase,String, false, %w[GET POST])
|
273
295
|
|
274
296
|
params = {}
|
275
297
|
params[:file_format] = file_format.downcase unless file_format.nil?
|
276
|
-
params[:
|
277
|
-
params[:
|
298
|
+
params[:recording_callback_url] = recording_callback_url unless recording_callback_url.nil?
|
299
|
+
params[:recording_callback_method] = recording_callback_method.upcase unless recording_callback_method.nil?
|
278
300
|
|
279
301
|
perform_action_apiresponse('Record', 'POST', params, true)
|
280
302
|
end
|
@@ -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 = {})
|
@@ -425,11 +480,11 @@ module Plivo
|
|
425
480
|
def start_recording(options = {})
|
426
481
|
valid_param?(:options, options, Hash, false)
|
427
482
|
options[:file_format] = 'mp3' unless options.key?(:file_format)
|
428
|
-
options[:
|
483
|
+
options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
|
429
484
|
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
430
485
|
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
431
486
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
432
|
-
MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start_recording(options[:file_format], options[:
|
487
|
+
MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
|
433
488
|
end
|
434
489
|
|
435
490
|
def stop_recording(options = {})
|
@@ -462,12 +517,12 @@ module Plivo
|
|
462
517
|
raise_invalid_request("Member Id is mandatory")
|
463
518
|
end
|
464
519
|
options[:file_format] = 'mp3' unless options.key?(:file_format)
|
465
|
-
options[:
|
520
|
+
options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
|
466
521
|
valid_param?(:member_id, options[:member_id], [String, Integer], true)
|
467
522
|
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
468
523
|
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
469
524
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
470
|
-
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_participant_recording(options[:file_format], options[:
|
525
|
+
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_participant_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
|
471
526
|
end
|
472
527
|
|
473
528
|
def stop_participant_recording(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/resources.rb
CHANGED
@@ -15,6 +15,8 @@ require_relative 'resources/nodes'
|
|
15
15
|
require_relative 'resources/phlo_member'
|
16
16
|
require_relative 'resources/call_feedback'
|
17
17
|
require_relative 'resources/media'
|
18
|
+
require_relative 'resources/brand'
|
19
|
+
require_relative 'resources/campaign'
|
18
20
|
require_relative 'resources/lookup'
|
19
21
|
require_relative 'resources/regulatory_compliance'
|
20
22
|
require_relative 'resources/multipartycalls'
|
data/lib/plivo/rest_client.rb
CHANGED
@@ -14,6 +14,7 @@ module Plivo
|
|
14
14
|
attr_reader :powerpacks
|
15
15
|
attr_reader :powerpacks, :media
|
16
16
|
attr_reader :lookup
|
17
|
+
attr_reader :brand, :campaign
|
17
18
|
attr_reader :end_users
|
18
19
|
attr_reader :compliance_document_types, :compliance_documents, :compliance_requirements, :compliance_applications
|
19
20
|
|
@@ -39,6 +40,8 @@ module Plivo
|
|
39
40
|
@messages = Resources::MessagesInterface.new(self)
|
40
41
|
@powerpacks = Resources::PowerpackInterface.new(self)
|
41
42
|
@media = Resources::MediaInterface.new(self)
|
43
|
+
@brand = Resources::BrandInterface.new(self)
|
44
|
+
@campaign = Resources::CampaignInterface.new(self)
|
42
45
|
@subaccounts = Resources::SubaccountInterface.new(self)
|
43
46
|
@recordings = Resources::RecordingInterface.new(self)
|
44
47
|
@pricings = Resources::PricingInterface.new(self)
|
data/lib/plivo/utils.rb
CHANGED
@@ -227,7 +227,7 @@ module Plivo
|
|
227
227
|
uri += "?"
|
228
228
|
end
|
229
229
|
if parsed_uri.query.to_s.length > 0
|
230
|
-
parsed_uri_query = URI.
|
230
|
+
parsed_uri_query = URI.decode_www_form_component(parsed_uri.query)
|
231
231
|
if method == "GET"
|
232
232
|
queryParamMap = getMapFromQueryString?(parsed_uri_query)
|
233
233
|
params.keys.sort.each { |key|
|
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.25.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:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -152,6 +152,7 @@ executables: []
|
|
152
152
|
extensions: []
|
153
153
|
extra_rdoc_files: []
|
154
154
|
files:
|
155
|
+
- ".github/workflows/unitTests.yml"
|
155
156
|
- ".gitignore"
|
156
157
|
- ".rspec"
|
157
158
|
- ".travis.yml"
|
@@ -182,8 +183,10 @@ files:
|
|
182
183
|
- lib/plivo/resources/accounts.rb
|
183
184
|
- lib/plivo/resources/addresses.rb
|
184
185
|
- lib/plivo/resources/applications.rb
|
186
|
+
- lib/plivo/resources/brand.rb
|
185
187
|
- lib/plivo/resources/call_feedback.rb
|
186
188
|
- lib/plivo/resources/calls.rb
|
189
|
+
- lib/plivo/resources/campaign.rb
|
187
190
|
- lib/plivo/resources/conferences.rb
|
188
191
|
- lib/plivo/resources/endpoints.rb
|
189
192
|
- lib/plivo/resources/identities.rb
|