bandwidth-sdk 10.4.0 → 10.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandwidth/voice_lib/bxml/verbs/custom_param.rb +17 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/start_transcription.rb +42 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_transcription.rb +16 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb +1 -1
- data/test/integration/test_integration.rb +90 -8
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffaae51706420e65f3e5d390fb9215c6dbcfab4fafd63afdcb23db02b9f35c2f
|
4
|
+
data.tar.gz: bbf5a6df61b719af55f8207cae476e6e9dfa558e39b144ce6f612616081e8b5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40337ac287221ab0177321f3118373023052bc5f322c44e30768b1b678d51917ada3a261e5620fa0d9ad9cb9fb626d03163e4fcf8bf63b7c4ec7c04480e84a4a
|
7
|
+
data.tar.gz: dfade60302bddd061ff00afe378cc64f006c93c7b95c36a290aeb80f38ded9eb10d8c156b994b6cebe4fa414bde4f103c48925f844e9802cae47505fb9bc5b80
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# These elements define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started
|
6
|
+
class CustomParam
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.CustomParam(compact_hash({
|
11
|
+
'name' => name,
|
12
|
+
'value' => value
|
13
|
+
}))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The StartTranscription verb allows a segment of a call to be transcribed and optionally for the live transcription to be sent off to another destination for additional processing
|
6
|
+
class StartTranscription
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.StartTranscription(compact_hash({
|
11
|
+
'name' => name,
|
12
|
+
'tracks' => tracks,
|
13
|
+
'transcriptionEventUrl' => transcriptionEventUrl,
|
14
|
+
'transcriptionEventMethod' => transcriptionEventMethod,
|
15
|
+
'username' => username,
|
16
|
+
'password' => password,
|
17
|
+
'destination' => destination,
|
18
|
+
'stabilized' => stabilized
|
19
|
+
})) do
|
20
|
+
def embedded_xml(xml, property, type)
|
21
|
+
if property
|
22
|
+
s = if property.is_a?(type)
|
23
|
+
then property
|
24
|
+
else type.new(property)
|
25
|
+
end
|
26
|
+
s.to_bxml(xml)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def nest_verbs_list(xml, property)
|
30
|
+
if property
|
31
|
+
property.each do |verb|
|
32
|
+
verb.to_bxml(xml)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
embedded_xml(xml, custom_params, CustomParam)
|
37
|
+
nest_verbs_list(xml, nested_verbs)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The StopTranscription verb is used to stop a real-time transcription that was started with a previous `<StartTranscription>` verb
|
6
|
+
class StopTranscription
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.StopTranscription(compact_hash({
|
11
|
+
'name' => name
|
12
|
+
}))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -2,7 +2,7 @@ require_relative 'xml_verb'
|
|
2
2
|
|
3
3
|
module Bandwidth
|
4
4
|
module Voice
|
5
|
-
#
|
5
|
+
# These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started
|
6
6
|
class StreamParam
|
7
7
|
include XmlVerb
|
8
8
|
|
@@ -122,11 +122,18 @@ class IntegrationTest < Test::Unit::TestCase
|
|
122
122
|
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
123
123
|
|
124
124
|
#Get phone call information
|
125
|
-
sleep(
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
sleep(2)
|
126
|
+
begin
|
127
|
+
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
128
|
+
assert(response.data.state.length > 0, "state value not set")
|
129
|
+
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
130
|
+
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
131
|
+
rescue ApiErrorException => e
|
132
|
+
if e.response_code != 404
|
133
|
+
raise StandardError, "Unexpected HTTP Response: " + e.message
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
130
137
|
end
|
131
138
|
|
132
139
|
def test_create_call_with_amd_and_get_call_state
|
@@ -151,9 +158,15 @@ class IntegrationTest < Test::Unit::TestCase
|
|
151
158
|
assert(response.data.call_id.length > 0, "call_id value not set")
|
152
159
|
|
153
160
|
#Get phone call information
|
154
|
-
sleep(
|
155
|
-
|
156
|
-
|
161
|
+
sleep(2)
|
162
|
+
begin
|
163
|
+
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
164
|
+
assert(response.data.state.length > 0, "state value not set")
|
165
|
+
rescue ApiErrorException => e
|
166
|
+
if e.response_code != 404
|
167
|
+
raise StandardError, "Unexpected HTTP Response: " + e.message
|
168
|
+
end
|
169
|
+
end
|
157
170
|
end
|
158
171
|
|
159
172
|
def test_create_call_with_priority
|
@@ -766,4 +779,73 @@ class IntegrationTest < Test::Unit::TestCase
|
|
766
779
|
|
767
780
|
assert_equal(expected, actual)
|
768
781
|
end
|
782
|
+
|
783
|
+
def test_start_transcription_bxml_verb
|
784
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartTranscription name="test_transcription" tracks="inbound" transcriptionEventUrl="https://www.test.com/event" transcriptionEventMethod="POST" username="username" password="password" destination="https://www.test.com/transcription"><CustomParam name="name1" value="value1"/></StartTranscription></Response>'
|
785
|
+
response = Bandwidth::Voice::Response.new()
|
786
|
+
|
787
|
+
custom_param1 = Bandwidth::Voice::CustomParam.new({
|
788
|
+
:name => "name1",
|
789
|
+
:value => "value1"
|
790
|
+
})
|
791
|
+
|
792
|
+
start_transcription = Bandwidth::Voice::StartTranscription.new({
|
793
|
+
:name => "test_transcription",
|
794
|
+
:tracks => "inbound",
|
795
|
+
:transcriptionEventUrl => "https://www.test.com/event",
|
796
|
+
:transcriptionEventMethod => "POST",
|
797
|
+
:username => "username",
|
798
|
+
:password => "password",
|
799
|
+
:destination => "https://www.test.com/transcription",
|
800
|
+
:custom_params => custom_param1
|
801
|
+
})
|
802
|
+
|
803
|
+
response.push(start_transcription)
|
804
|
+
actual = response.to_bxml()
|
805
|
+
|
806
|
+
assert_equal(expected, actual)
|
807
|
+
end
|
808
|
+
|
809
|
+
def test_start_transcription_multiple_nested_custom_params
|
810
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartTranscription name="test_transcription" tracks="inbound" transcriptionEventUrl="https://www.test.com/event" transcriptionEventMethod="POST" username="username" password="password" destination="https://www.test.com/transcription"><CustomParam name="name1" value="value1"/><CustomParam name="name2" value="value2"/></StartTranscription></Response>'
|
811
|
+
response = Bandwidth::Voice::Response.new()
|
812
|
+
|
813
|
+
custom_param1 = Bandwidth::Voice::CustomParam.new({
|
814
|
+
:name => "name1",
|
815
|
+
:value => "value1"
|
816
|
+
})
|
817
|
+
|
818
|
+
custom_param2 = Bandwidth::Voice::CustomParam.new({
|
819
|
+
:name => "name2",
|
820
|
+
:value => "value2"
|
821
|
+
})
|
822
|
+
|
823
|
+
start_transcription = Bandwidth::Voice::StartTranscription.new({
|
824
|
+
:destination => "https://www.test.com/transcription",
|
825
|
+
:name => "test_transcription",
|
826
|
+
:tracks => "inbound",
|
827
|
+
:transcriptionEventUrl => "https://www.test.com/event",
|
828
|
+
:transcriptionEventMethod => "POST",
|
829
|
+
:username => "username",
|
830
|
+
:password => "password",
|
831
|
+
:nested_verbs => [custom_param1, custom_param2]
|
832
|
+
})
|
833
|
+
|
834
|
+
response.push(start_transcription)
|
835
|
+
actual = response.to_bxml()
|
836
|
+
|
837
|
+
assert_equal(expected, actual)
|
838
|
+
end
|
839
|
+
|
840
|
+
def test_stop_transcription_bxml_verb
|
841
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopTranscription name="test_transcription"/></Response>'
|
842
|
+
response = Bandwidth::Voice::Response.new()
|
843
|
+
stop_transcription = Bandwidth::Voice::StopTranscription.new({
|
844
|
+
:name => "test_transcription"
|
845
|
+
})
|
846
|
+
response.push(stop_transcription)
|
847
|
+
actual = response.to_bxml()
|
848
|
+
|
849
|
+
assert_equal(expected, actual)
|
850
|
+
end
|
769
851
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandwidth-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.
|
4
|
+
version: 10.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bandwidth
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- lib/bandwidth/voice_lib/bxml/response.rb
|
232
232
|
- lib/bandwidth/voice_lib/bxml/verbs/bridge.rb
|
233
233
|
- lib/bandwidth/voice_lib/bxml/verbs/conference.rb
|
234
|
+
- lib/bandwidth/voice_lib/bxml/verbs/custom_param.rb
|
234
235
|
- lib/bandwidth/voice_lib/bxml/verbs/forward.rb
|
235
236
|
- lib/bandwidth/voice_lib/bxml/verbs/gather.rb
|
236
237
|
- lib/bandwidth/voice_lib/bxml/verbs/hangup.rb
|
@@ -248,9 +249,11 @@ files:
|
|
248
249
|
- lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb
|
249
250
|
- lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb
|
250
251
|
- lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb
|
252
|
+
- lib/bandwidth/voice_lib/bxml/verbs/start_transcription.rb
|
251
253
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb
|
252
254
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb
|
253
255
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb
|
256
|
+
- lib/bandwidth/voice_lib/bxml/verbs/stop_transcription.rb
|
254
257
|
- lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb
|
255
258
|
- lib/bandwidth/voice_lib/bxml/verbs/tag.rb
|
256
259
|
- lib/bandwidth/voice_lib/bxml/verbs/transfer.rb
|
@@ -314,7 +317,7 @@ homepage: https://github.com/Bandwidth/ruby-sdk
|
|
314
317
|
licenses:
|
315
318
|
- MIT
|
316
319
|
metadata: {}
|
317
|
-
post_install_message:
|
320
|
+
post_install_message:
|
318
321
|
rdoc_options: []
|
319
322
|
require_paths:
|
320
323
|
- lib
|
@@ -330,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
333
|
version: '0'
|
331
334
|
requirements: []
|
332
335
|
rubygems_version: 3.4.10
|
333
|
-
signing_key:
|
336
|
+
signing_key:
|
334
337
|
specification_version: 4
|
335
338
|
summary: Bandwidth
|
336
339
|
test_files: []
|