plivo 4.45.0 → 4.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -3
- data/README.md +1 -1
- data/lib/plivo/resources/calls.rb +123 -0
- 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,10 @@
|
|
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
|
+
|
3
8
|
## [4.45.0](https://github.com/plivo/plivo-ruby/tree/v4.45.0) (2023-05-02)
|
4
9
|
**Feature - CNAM Lookup**
|
5
10
|
- Added New Param `cnam_lookup` in to the response of the [list all numbers API], [list single number API]
|
@@ -61,7 +66,6 @@
|
|
61
66
|
**Adding new attribute - 'message_expiry' in Send Message API**
|
62
67
|
- Added new attribute - message_expiry in Send Message API
|
63
68
|
|
64
|
-
|
65
69
|
## [4.34.0](https://github.com/plivo/plivo-ruby/tree/v4.34.0) (2022-12-16)
|
66
70
|
**10DLC: Update Campaign API**
|
67
71
|
- Added Update Campaign API
|
@@ -79,7 +83,6 @@
|
|
79
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)
|
80
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)
|
81
85
|
|
82
|
-
|
83
86
|
## [4.30.2](https://github.com/plivo/plivo-ruby/tree/v4.30.2) (2022-09-28)
|
84
87
|
**10DLC: Campaign request**
|
85
88
|
- Added more attributes to create campaign request
|
@@ -88,7 +91,6 @@
|
|
88
91
|
**stability - faraday upgrade**
|
89
92
|
- faraday version upgrade
|
90
93
|
|
91
|
-
|
92
94
|
## [4.30.0](https://github.com/plivo/plivo-ruby/tree/v4.30.0) (2022-08-26)
|
93
95
|
**Feature - 10DLC APIs**
|
94
96
|
- Added new 10DLC APIs
|
data/README.md
CHANGED
@@ -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,
|
@@ -577,6 +644,62 @@ module Plivo
|
|
577
644
|
valid_param?(:call_uuid, call_uuid, [String, Symbol], true)
|
578
645
|
Call.new(@_client, resource_id: call_uuid).cancel_request
|
579
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
|
580
703
|
end
|
581
704
|
end
|
582
705
|
end
|
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-06-
|
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
|