plivo 4.43.0 → 4.46.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 +17 -3
- data/README.md +1 -1
- data/lib/plivo/base_client.rb +1 -1
- data/lib/plivo/resources/calls.rb +125 -1
- data/lib/plivo/resources/numbers.rb +12 -6
- data/lib/plivo/version.rb +1 -1
- data/lib/plivo/xml/plivo_xml.rb +2 -2
- data/lib/plivo/xml/response.rb +1 -1
- data/lib/plivo/xml/stream.rb +27 -0
- data/lib/plivo/xml.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a1adf70a4fde50a292d378f057a7f65bfa9ed7b
|
4
|
+
data.tar.gz: 5d89de13e75759f0cfbb7ca9661b43fa743ef8de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ff933158008f134dbc6159cfd9f9bf512f1be42c73aa891afd805a354500065459b0e8d5a6fcac33957f9e3c49445ac903b4b28ca9aeeaf4a4b5213128263f
|
7
|
+
data.tar.gz: fad484cd5da48a0843ec94b182d3d3adb199505b7552cff1dcc017636eb34d917b1d2649ff0fac2519e21933b363807798c6fa89fcc5c05b1d662a5b7084df32
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [4.46.0](https://github.com/plivo/plivo-go/tree/v4.46.0) (2023-06-28)
|
4
|
+
**Feature - Audio Streaming**
|
5
|
+
- Added functionality to start, stop and fetch audio streams
|
6
|
+
- Added functionality to create stream XML
|
7
|
+
|
8
|
+
## [4.45.0](https://github.com/plivo/plivo-ruby/tree/v4.45.0) (2023-05-02)
|
9
|
+
**Feature - CNAM Lookup**
|
10
|
+
- Added New Param `cnam_lookup` in to the response of the [list all numbers API], [list single number API]
|
11
|
+
- Added `cnam_lookup` filter to AccountPhoneNumber - list all my numbers API.
|
12
|
+
- Added `cnam_lookup` parameter to buy number[Buy a Phone Number] to configure CNAM Lookup while buying a US number
|
13
|
+
- Added `cnam_lookup` parameter to update number[Update an account phone number] to configure CNAM Lookup while buying a US number
|
14
|
+
|
15
|
+
|
16
|
+
## [4.44.0](https://github.com/plivo/plivo-ruby/tree/v4.38.2) (2023-03-16)
|
17
|
+
**Feature : Added new param in getCallDetail api**
|
18
|
+
- From now on we can see CNAM(Caller_id name) details at CDR level.
|
19
|
+
|
3
20
|
## [4.43.0](https://github.com/plivo/plivo-ruby/tree/v4.43.0) (2023-05-29)
|
4
21
|
**Feature - Recording API changes**
|
5
22
|
- Added `monthly_recording_storage_amount`, `recording_storage_rate`, `rounded_recording_duration`, and `recording_storage_duration` parameters to the response for [get single recording API](https://www.plivo.com/docs/voice/api/recording#retrieve-a-recording) and [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)
|
@@ -49,7 +66,6 @@
|
|
49
66
|
**Adding new attribute - 'message_expiry' in Send Message API**
|
50
67
|
- Added new attribute - message_expiry in Send Message API
|
51
68
|
|
52
|
-
|
53
69
|
## [4.34.0](https://github.com/plivo/plivo-ruby/tree/v4.34.0) (2022-12-16)
|
54
70
|
**10DLC: Update Campaign API**
|
55
71
|
- Added Update Campaign API
|
@@ -67,7 +83,6 @@
|
|
67
83
|
-Added 3 new keys to AccountPhoneNumber object:`tendlc_registration_status`, `tendlc_campaign_id` and `toll_free_sms_verification` (https://www.plivo.com/docs/numbers/api/account-phone-number#the-accountphonenumber-object)
|
68
84
|
-Added 3 new filters to AccountPhoneNumber - list all my numbers API:`tendlc_registration_status`, `tendlc_campaign_id` and `toll_free_sms_verification` (https://www.plivo.com/docs/numbers/api/account-phone-number#list-all-my-numbers)
|
69
85
|
|
70
|
-
|
71
86
|
## [4.30.2](https://github.com/plivo/plivo-ruby/tree/v4.30.2) (2022-09-28)
|
72
87
|
**10DLC: Campaign request**
|
73
88
|
- Added more attributes to create campaign request
|
@@ -76,7 +91,6 @@
|
|
76
91
|
**stability - faraday upgrade**
|
77
92
|
- faraday version upgrade
|
78
93
|
|
79
|
-
|
80
94
|
## [4.30.0](https://github.com/plivo/plivo-ruby/tree/v4.30.0) (2022-08-26)
|
81
95
|
**Feature - 10DLC APIs**
|
82
96
|
- Added new 10DLC APIs
|
data/README.md
CHANGED
data/lib/plivo/base_client.rb
CHANGED
@@ -33,7 +33,7 @@ module Plivo
|
|
33
33
|
raise Exceptions::PlivoRESTError, "Resource at #{response[:url]} "\
|
34
34
|
'couldn\'t be deleted'
|
35
35
|
end
|
36
|
-
elsif !([200, 201, 202, 204, 207].include? response[:status])
|
36
|
+
elsif !([200, 201, 202, 204, 207, 206].include? response[:status])
|
37
37
|
raise Exceptions::PlivoRESTError, "Received #{response[:status]} for #{method}"
|
38
38
|
end
|
39
39
|
@@voice_retry_count = 0
|
@@ -203,6 +203,73 @@ module Plivo
|
|
203
203
|
@_client.send_request(resource_path, 'DELETE', nil, nil, false , is_voice_request: @_is_voice_request)
|
204
204
|
end
|
205
205
|
|
206
|
+
def start_stream(service_url, options = nil)
|
207
|
+
valid_param?(:service_url, service_url, [String, Symbol], true)
|
208
|
+
if options.nil?
|
209
|
+
return perform_action('Stream', 'POST', { service_url: service_url }, true)
|
210
|
+
end
|
211
|
+
|
212
|
+
valid_param?(:options, options, Hash, true)
|
213
|
+
|
214
|
+
params = { service_url: service_url }
|
215
|
+
|
216
|
+
if options.key?(:bidirectional) &&
|
217
|
+
valid_param?(:bidirectional, options[:bidirectional], [TrueClass, FalseClass], false )
|
218
|
+
params[:bidirectional] = options[:bidirectional]
|
219
|
+
end
|
220
|
+
|
221
|
+
if options.key?(:audio_track) &&
|
222
|
+
valid_param?(:audio_track, options[:audio_track],
|
223
|
+
[String, Symbol], false, %w[inbound outbound both])
|
224
|
+
params[:audio_track] = options[:audio_track]
|
225
|
+
end
|
226
|
+
|
227
|
+
if options.key?(:stream_timeout) &&
|
228
|
+
valid_param?(:stream_timeout, options[:stream_timeout], Integer, false)
|
229
|
+
params[:stream_timeout] = options[:stream_timeout]
|
230
|
+
end
|
231
|
+
|
232
|
+
if options.key?(:status_callback_url) &&
|
233
|
+
valid_param?(:status_callback_url, options[:status_callback_url], [String, Symbol], false)
|
234
|
+
params[:status_callback_url] = options[:status_callback_url]
|
235
|
+
end
|
236
|
+
|
237
|
+
if options.key?(:status_callback_method) &&
|
238
|
+
valid_param?(:status_callback_method, options[:status_callback_method],
|
239
|
+
[String, Symbol], false, %w[GET POST get post])
|
240
|
+
params[:status_callback_method] = options[:status_callback_method]
|
241
|
+
end
|
242
|
+
|
243
|
+
if options.key?(:content_type) &&
|
244
|
+
valid_param?(:content_type, options[:content_type], [String, Symbol, Integer], false)
|
245
|
+
params[:content_type] = options[:content_type]
|
246
|
+
end
|
247
|
+
|
248
|
+
if options.key?(:extra_headers) &&
|
249
|
+
valid_param?(:extra_headers, options[:extra_headers], [String], false)
|
250
|
+
params[:extra_headers] = options[:extra_headers]
|
251
|
+
end
|
252
|
+
perform_action('Stream', 'POST', params, true)
|
253
|
+
end
|
254
|
+
|
255
|
+
def stop_all_streams
|
256
|
+
perform_action('Stream', 'DELETE', nil, false)
|
257
|
+
end
|
258
|
+
|
259
|
+
def stop_stream(stream_id)
|
260
|
+
valid_param?(:stream_id, stream_id, [String, Symbol, Integer], true)
|
261
|
+
perform_action('Stream/' + stream_id, 'DELETE', nil, false)
|
262
|
+
end
|
263
|
+
|
264
|
+
def get_all_streams
|
265
|
+
perform_action('Stream', 'GET', nil, true )
|
266
|
+
end
|
267
|
+
|
268
|
+
def get_stream(stream_id)
|
269
|
+
valid_param?(:stream_id, stream_id, [String, Symbol, Integer], true)
|
270
|
+
perform_action('Stream/' + stream_id, 'GET', nil, true)
|
271
|
+
end
|
272
|
+
|
206
273
|
def to_s
|
207
274
|
call_details = {
|
208
275
|
answer_time: @answer_time,
|
@@ -233,7 +300,8 @@ module Plivo
|
|
233
300
|
caller_name: @caller_name,
|
234
301
|
stir_verification: @stir_verification,
|
235
302
|
stir_attestation: @stir_attestation,
|
236
|
-
source_ip: @source_ip
|
303
|
+
source_ip: @source_ip,
|
304
|
+
cnam_lookup: @cnam_lookup
|
237
305
|
}
|
238
306
|
call_details = call_details.select {|k, v| !v.nil? }
|
239
307
|
call_details.to_s
|
@@ -576,6 +644,62 @@ module Plivo
|
|
576
644
|
valid_param?(:call_uuid, call_uuid, [String, Symbol], true)
|
577
645
|
Call.new(@_client, resource_id: call_uuid).cancel_request
|
578
646
|
end
|
647
|
+
|
648
|
+
# @param [String] service_url
|
649
|
+
# @param [Hash] options
|
650
|
+
# @option options [Boolean] :bidirectional
|
651
|
+
# @option options [String] :audio_track
|
652
|
+
# @option options [Int] :stream_timeout
|
653
|
+
# @option options [String] :status_callback_url
|
654
|
+
# @option options [String] :status_callback_method
|
655
|
+
# @option options [String] :content_type
|
656
|
+
# @option options [String] :extra_headers
|
657
|
+
def start_stream(call_uuid, service_url, options = {})
|
658
|
+
valid_param?(:call_uuid, call_uuid, [String, Symbol], true)
|
659
|
+
response = Call.new(@_client, resource_id: call_uuid).start_stream(service_url, options)
|
660
|
+
return Base::Response.new(Hash["api_id" => response.api_id,
|
661
|
+
"stream_id" => response.stream_id,
|
662
|
+
"message" => response.message])
|
663
|
+
end
|
664
|
+
|
665
|
+
def stop_all_streams(call_uuid)
|
666
|
+
valid_param?(:call_uuid, call_uuid, [String, Symbol], true )
|
667
|
+
Call.new(@_client, resource_id: call_uuid).stop_all_streams
|
668
|
+
end
|
669
|
+
|
670
|
+
def stop_stream(call_uuid, stream_id)
|
671
|
+
valid_param?(:call_uuid, call_uuid, [String, Symbol], true )
|
672
|
+
Call.new(@_client, resource_id: call_uuid).stop_stream(stream_id)
|
673
|
+
end
|
674
|
+
|
675
|
+
def get_all_streams(call_uuid)
|
676
|
+
valid_param?(:call_uuid, call_uuid, [String, Symbol], true )
|
677
|
+
response = Call.new(@_client, resource_id: call_uuid).get_all_streams
|
678
|
+
return Base::Response.new(Hash["api_id" => response.api_id,
|
679
|
+
"meta" => response.meta,
|
680
|
+
"objects" => response.objects])
|
681
|
+
end
|
682
|
+
|
683
|
+
def get_stream(call_uuid, stream_id)
|
684
|
+
valid_param?(:call_uuid, call_uuid, [String, Symbol], true )
|
685
|
+
response = Call.new(@_client, resource_id: call_uuid).get_stream(stream_id)
|
686
|
+
return Base::Response.new(Hash["api_id" => response.instance_variable_get(:@api_id),
|
687
|
+
"audio_track" => response.instance_variable_get(:@audio_track),
|
688
|
+
"bidirectional" => response.instance_variable_get(:@bidirectional),
|
689
|
+
"bill_duration" => response.instance_variable_get(:@bill_duration),
|
690
|
+
"billed_amount" => response.instance_variable_get(:@billed_amount),
|
691
|
+
"call_uuid" => response.instance_variable_get(:@call_uuid),
|
692
|
+
"created_at" => response.instance_variable_get(:@created_at),
|
693
|
+
"end_time" => response.instance_variable_get(:@end_time),
|
694
|
+
"plivo_auth_id" => response.instance_variable_get(:@plivo_auth_id),
|
695
|
+
"resource_uri" => response.instance_variable_get(:@resource_uri),
|
696
|
+
"rounded_bill_duration" => response.instance_variable_get(:@rounded_bill_duration),
|
697
|
+
"service_url" => response.instance_variable_get(:@service_url),
|
698
|
+
"start_time" => response.instance_variable_get(:@start_time),
|
699
|
+
"status" => response.instance_variable_get(:@status),
|
700
|
+
"status_callback_url" => response.instance_variable_get(:@status_callback_url),
|
701
|
+
"stream_id" => response.instance_variable_get(:@stream_id)])
|
702
|
+
end
|
579
703
|
end
|
580
704
|
end
|
581
705
|
end
|
@@ -9,10 +9,11 @@ module Plivo
|
|
9
9
|
super
|
10
10
|
end
|
11
11
|
|
12
|
-
def buy(app_id = nil, verification_info = nil)
|
12
|
+
def buy(app_id = nil, verification_info = nil, cnam_lookup = nil)
|
13
13
|
params = {}
|
14
14
|
params[:app_id] = app_id unless app_id.nil?
|
15
15
|
params[:verification_info] = verification_info unless verification_info.nil?
|
16
|
+
params[:cnam_lookup] = cnam_lookup unless cnam_lookup.nil?
|
16
17
|
perform_action(nil, 'POST', params, true)
|
17
18
|
end
|
18
19
|
|
@@ -118,10 +119,10 @@ module Plivo
|
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
121
|
-
def buy(number, app_id = nil, verification_info = nil)
|
122
|
+
def buy(number, app_id = nil, verification_info = nil, cnam_lookup = nil)
|
122
123
|
valid_param?(:number, number, [Integer, String, Symbol], true)
|
123
124
|
PhoneNumber.new(@_client,
|
124
|
-
resource_id: number).buy(app_id, verification_info)
|
125
|
+
resource_id: number).buy(app_id, verification_info, cnam_lookup)
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
@@ -142,7 +143,7 @@ module Plivo
|
|
142
143
|
params[:subaccount] = options[:subaccount]
|
143
144
|
end
|
144
145
|
|
145
|
-
%i[alias app_id].each do |param|
|
146
|
+
%i[alias app_id cnam_lookup].each do |param|
|
146
147
|
if options.key?(param) &&
|
147
148
|
valid_param?(param, options[param], [String, Symbol], true)
|
148
149
|
params[param] = options[param]
|
@@ -183,7 +184,8 @@ module Plivo
|
|
183
184
|
tendlc_campaign_id: @tendlc_campaign_id,
|
184
185
|
tendlc_registration_status: @tendlc_registration_status,
|
185
186
|
toll_free_sms_verification: @toll_free_sms_verification,
|
186
|
-
renewal_date: @renewal_date
|
187
|
+
renewal_date: @renewal_date,
|
188
|
+
cnam_lookup: @cnam_lookup
|
187
189
|
}.to_s
|
188
190
|
end
|
189
191
|
end
|
@@ -226,6 +228,9 @@ module Plivo
|
|
226
228
|
# @option options [String] :renewal_date__lte Returns phone numbers that will be renewed on or before the specified date. Format: YYYY-MM-DD
|
227
229
|
# @option options [String] :renewal_date__gt Returns phone numbers that will be renewed after the specified date. Format: YYYY-MM-DD
|
228
230
|
# @option options [String] :renewal_date__gte Returns phone numbers that will be renewed on or after the specified date. Format: YYYY-MM-DD
|
231
|
+
# @option options [String] :cnam_lookup The Cnam Lookup Configuration associated with that number. The following values are valid:
|
232
|
+
# - enabled - Returns the list of numbers for which Cnam Lookup configuration is enabled
|
233
|
+
# - disabled - Returns the list of numbers for which Cnam Lookup configuration is disabled
|
229
234
|
def list(options = nil)
|
230
235
|
return perform_list if options.nil?
|
231
236
|
|
@@ -233,7 +238,7 @@ module Plivo
|
|
233
238
|
|
234
239
|
params = {}
|
235
240
|
|
236
|
-
%i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification renewal_date renewal_date__lt renewal_date__lte renewal_date__gt renewal_date__gte].each do |param|
|
241
|
+
%i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification renewal_date renewal_date__lt renewal_date__lte renewal_date__gt renewal_date__gte cnam_lookup].each do |param|
|
237
242
|
if options.key?(param) &&
|
238
243
|
valid_param?(param, options[param], [String, Symbol], true)
|
239
244
|
params[param] = options[param]
|
@@ -324,6 +329,7 @@ module Plivo
|
|
324
329
|
# @option options [String] :alias The textual name given to the number.
|
325
330
|
# @option options [String] :app_id The application id of the application that is to be linked.
|
326
331
|
# @option options [String] :subaccount The auth_id of the subaccount to which this number should be added. This can only be performed by a main account holder.
|
332
|
+
# @option options [String] :cnam_lookup The Cnam Lookup configuration to enable/disable Cnam Lookup
|
327
333
|
def update(number, options = nil)
|
328
334
|
valid_param?(:number, number, [String, Symbol], true)
|
329
335
|
Number.new(@_client,
|
data/lib/plivo/version.rb
CHANGED
data/lib/plivo/xml/plivo_xml.rb
CHANGED
@@ -8,11 +8,11 @@ module Plivo
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_xml
|
11
|
-
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_xml
|
11
|
+
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_xml.gsub(""", "\"")
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_s
|
15
|
-
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_s
|
15
|
+
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_s.gsub(""", "\"")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/plivo/xml/response.rb
CHANGED
@@ -2,7 +2,7 @@ module Plivo
|
|
2
2
|
module XML
|
3
3
|
class Response < Element
|
4
4
|
@nestables = %w[Speak Play GetDigits GetInput Record Dial Message
|
5
|
-
Redirect Wait Hangup PreAnswer Conference DTMF MultiPartyCall]
|
5
|
+
Redirect Wait Hangup PreAnswer Conference DTMF MultiPartyCall Stream]
|
6
6
|
@valid_attributes = []
|
7
7
|
|
8
8
|
def initialize
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Plivo
|
2
|
+
module XML
|
3
|
+
class Stream < Element
|
4
|
+
@nestables = []
|
5
|
+
@valid_attributes = %w[bidirectional audioTrack streamTimeout statusCallbackUrl
|
6
|
+
statusCallbackMethod contentType extraHeaders]
|
7
|
+
|
8
|
+
SUPPORTED_BIDIRECTIONAL=%w(true false)
|
9
|
+
SUPPORTED_AUDIOTRACK=%w(inbound outbound both)
|
10
|
+
SUPPORTED_CALLBACKMETHOD=%w(GET POST)
|
11
|
+
|
12
|
+
def initialize(body, attributes = {})
|
13
|
+
if attributes[:bidirectional] && !SUPPORTED_BIDIRECTIONAL.include?(attributes[:bidirectional])
|
14
|
+
raise PlivoXMLError, "<Stream> bidirectional #{attributes[:bidirectional]} is not valid."
|
15
|
+
end
|
16
|
+
if attributes[:audioTrack] && !SUPPORTED_AUDIOTRACK.include?(attributes[:audioTrack])
|
17
|
+
raise PlivoXMLError, "<Stream> audioTrack #{attributes[:audioTrack]} is not valid."
|
18
|
+
end
|
19
|
+
if attributes[:statusCallbackMethod] && !SUPPORTED_CALLBACKMETHOD.include?(attributes[:statusCallbackMethod].upcase)
|
20
|
+
raise PlivoXMLError, "<Stream> statusCallbackMethod #{attributes[:statusCallbackMethod]} is not valid."
|
21
|
+
end
|
22
|
+
raise PlivoXMLError, 'No text set for Stream' unless body
|
23
|
+
super(body, attributes)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/plivo/xml.rb
CHANGED
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.46.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: 2023-
|
11
|
+
date: 2023-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -236,6 +236,7 @@ files:
|
|
236
236
|
- lib/plivo/xml/s.rb
|
237
237
|
- lib/plivo/xml/say_as.rb
|
238
238
|
- lib/plivo/xml/speak.rb
|
239
|
+
- lib/plivo/xml/stream.rb
|
239
240
|
- lib/plivo/xml/sub.rb
|
240
241
|
- lib/plivo/xml/user.rb
|
241
242
|
- lib/plivo/xml/w.rb
|