ruby_rabbitmq_janus 1.2.2 → 1.2.3.pre.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -28
- data/config/requests/peer/offer.json +2 -2
- data/lib/rrj/errors/init.rb +1 -1
- data/lib/rrj/errors/rabbit/rabbit.rb +14 -0
- data/lib/rrj/info.rb +15 -1
- data/lib/rrj/init.rb +12 -4
- data/lib/rrj/janus/processus/event.rb +4 -1
- data/lib/rrj/janus/processus/keepalive.rb +19 -13
- data/lib/rrj/janus/transactions/admin.rb +10 -4
- data/lib/rrj/janus/transactions/handle.rb +8 -3
- data/lib/rrj/janus/transactions/transaction.rb +14 -13
- data/lib/rrj/rabbit/publish/admin.rb +1 -1
- data/lib/rrj/rabbit/publish/exclusive.rb +8 -1
- data/lib/rrj/rabbit/publish/non_exclusive.rb +1 -1
- data/lib/rrj/rabbit/publish/publisher.rb +3 -1
- data/lib/rrj/tools/config.rb +2 -0
- data/lib/rrj/tools/replaces/standard.rb +1 -1
- data/lib/rrj/tools/replaces/type.rb +10 -0
- data/spec/fixtures/config/requests/admin/handle_info.json +3 -0
- data/spec/fixtures/config/requests/admin/handles.json +3 -0
- data/spec/fixtures/config/requests/admin/log_level.json +3 -0
- data/spec/fixtures/config/requests/admin/sessions.json +3 -0
- data/spec/fixtures/config/requests/base/attach.json +3 -0
- data/spec/fixtures/config/requests/base/create.json +4 -0
- data/spec/fixtures/config/requests/base/destroy.json +3 -0
- data/spec/fixtures/config/requests/base/detach.json +3 -0
- data/spec/fixtures/config/requests/base/info.json +3 -0
- data/spec/fixtures/config/requests/base/keepalive.json +3 -0
- data/spec/fixtures/config/requests/peer/answer.json +3 -0
- data/spec/fixtures/config/requests/peer/offer.json +3 -0
- data/spec/fixtures/config/requests/peer/trickle.json +3 -0
- data/spec/request/peer/request_offer_spec.rb +3 -5
- data/spec/rrj/rrj_config_spec.rb +1 -1
- data/spec/rrj/rrj_spec.rb +36 -10
- data/spec/support/examples_config.rb +6 -0
- data/spec/support/{examples.rb → examples_request.rb} +17 -0
- data/spec/support/schemas/request/peer/answer.json +2 -4
- data/spec/support/schemas/request/peer/offer.json +2 -4
- metadata +22 -14
- data/spec/request/peer/request_answer_spec.rb +0 -66
- data/spec/support/examples_peer.rb +0 -18
- data/spec/support/schemas/request/channel/create.json +0 -39
- data/spec/support/schemas/request/channel/destroy.json +0 -39
- data/spec/support/schemas/request/channel/exist.json +0 -41
- data/spec/support/schemas/request/channel/list.json +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a3d4ef09913351f9fa9de8f78c7966cddbfa58
|
4
|
+
data.tar.gz: e67eb734e40d2c9709ec2e49c696ca9799212bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0168717d3cb9d059ab7af70c079a9bd912cc2d6b0edcdcbd1e9433980127b5874a8ce0cc6ba269134607047e010aabf48932fcc96f0c6dd5f357b3719ba9ad65
|
7
|
+
data.tar.gz: af44f0c6e01d69e5f551d19134f36b1d4d6196c62764533b0f99e4b994041084ba336a5375c72992832b8fbea72da03698be335a8cb1e9fc327a9b59cddc5475
|
data/README.md
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
|
7
7
|
Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
|
8
8
|
|
9
|
-
This gem is used to communicate to a server Janus through RabbitMQ software
|
10
|
-
Message-oriented middleware). It waiting a messages to Rails API who send to
|
11
|
-
server in a queue for janus server. janus processes a message and send
|
12
|
-
in a queue for gem. Once the received message is decoded
|
13
|
-
|
9
|
+
This gem is used to communicate to a server Janus through RabbitMQ software
|
10
|
+
(Message-oriented middleware). It waiting a messages to Rails API who send to
|
11
|
+
RabbitMQ server in a queue for janus server. janus processes a message and send
|
12
|
+
to RabbitMQ server in a queue for gem. Once the received message is decoded
|
13
|
+
and returned through the Rails API.
|
14
14
|
|
15
15
|
This gem is product by [Dazzl.tv](http://dazzl.tv)
|
16
16
|
|
@@ -48,17 +48,11 @@ Use generator for complete installation :
|
|
48
48
|
```ruby
|
49
49
|
rails g -h
|
50
50
|
RubyRabbitmqJanus:
|
51
|
-
ruby_rabbitmq_janus:configuration
|
52
|
-
#
|
53
|
-
|
54
|
-
ruby_rabbitmq_janus:
|
55
|
-
#
|
56
|
-
|
57
|
-
ruby_rabbitmq_janus:initializer
|
58
|
-
# Generate a initializer to this gem for rails application.
|
59
|
-
|
60
|
-
ruby_rabbitmq_janus:create_request
|
61
|
-
# Create an request to json format for RubyRabbitmqJanus transaction.
|
51
|
+
ruby_rabbitmq_janus:configuration # Generate a custom configuration file.
|
52
|
+
ruby_rabbitmq_janus:create_request # Create an request to json format for RubyRabbitmqJanus transaction.
|
53
|
+
ruby_rabbitmq_janus:default_request # Copy base request file sending to janus in application.
|
54
|
+
ruby_rabbitmq_janus:initializer # Generate a initializer to this gem for rails application.
|
55
|
+
ruby_rabbitmq_janus:install # Install RubyRabbitmqJanus in your Rails application
|
62
56
|
```
|
63
57
|
|
64
58
|
#### Requests
|
@@ -90,18 +84,27 @@ rabbitmq and use plugin echotest for janus server.
|
|
90
84
|
|
91
85
|
Use tags for rspec :
|
92
86
|
|
93
|
-
|
|
94
|
-
| --------------- | --------------- |
|
95
|
-
|
|
96
|
-
| |
|
97
|
-
| |
|
98
|
-
| |
|
99
|
-
| |
|
100
|
-
| level |
|
101
|
-
| |
|
102
|
-
|
|
103
|
-
|
|
104
|
-
| |
|
87
|
+
| Describe | Type | Name |
|
88
|
+
| ------------------------------------------------------------- | --------------- | --------------- |
|
89
|
+
| **Internaly function** | config | |
|
90
|
+
| Use bunny gem | | rabbit |
|
91
|
+
| Test log functions | | log |
|
92
|
+
| Test configuration function | | config |
|
93
|
+
| Test Gem contains CONSTANTS | | describe |
|
94
|
+
| **Level request sending to janus (admin monitor API or classic)** | level | |
|
95
|
+
| Request with no admin right. | | base |
|
96
|
+
| Request with admin right in Janus application. | | admin |
|
97
|
+
| **Request JSON sending to Rabbitmq -> Janus** | request | |
|
98
|
+
| Test request attach type | | attach |
|
99
|
+
| Test request type create | | create |
|
100
|
+
| Test request type detach | | detach |
|
101
|
+
| Test request type info | | info |
|
102
|
+
| Test request type test | | test |
|
103
|
+
|
104
|
+
Example usage rspec with tags :
|
105
|
+
```ruby
|
106
|
+
rspec --tag --name:config --tag level:base
|
107
|
+
```
|
105
108
|
|
106
109
|
## Upgrade
|
107
110
|
|
data/lib/rrj/errors/init.rb
CHANGED
@@ -15,7 +15,7 @@ module RubyRabbitmqJanus
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Define an exception if gem dont initialize correctly
|
18
|
-
class
|
18
|
+
class InstanciateGemFailed < RRJ
|
19
19
|
# Initialize a error for instanciate class. It's a fatal error
|
20
20
|
# @param [String] message Text returning in raise
|
21
21
|
def initialize(message)
|
@@ -11,5 +11,19 @@ module RubyRabbitmqJanus
|
|
11
11
|
super message, :fatal
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
# Execpetion primary for Rabbit class
|
16
|
+
class Rabbit < RRJError
|
17
|
+
def initialize(message)
|
18
|
+
super "[Rabbit]#{message}", :fatal
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Send exception when publish a message to rabbitmq failed
|
23
|
+
class RabbitPublishMessage < Rabbit
|
24
|
+
def initialize(message, request)
|
25
|
+
super "[Publish] #{message} -- #{request}"
|
26
|
+
end
|
27
|
+
end
|
14
28
|
end
|
15
29
|
end
|
data/lib/rrj/info.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:TooManyConstants
|
3
|
+
|
2
4
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
3
5
|
# Define constant to gem.
|
4
6
|
module RubyRabbitmqJanus
|
5
7
|
# Define version to gem
|
6
|
-
VERSION = '1.2.
|
8
|
+
VERSION = '1.2.3'
|
9
|
+
|
10
|
+
# Name to gem
|
11
|
+
GEM_NAME = 'ruby_rabbitmq_janus'
|
12
|
+
|
13
|
+
# Authors
|
14
|
+
AUTHORS = ['VAILLANT Jeremy'].freeze
|
15
|
+
|
16
|
+
# Emails
|
17
|
+
EMAILS = ['jeremy@dazzl.tv'].freeze
|
18
|
+
|
19
|
+
# Licence
|
20
|
+
LICENSE = 'MIT'
|
7
21
|
|
8
22
|
# Define a summary description to gem
|
9
23
|
SUMMARY = 'Ruby RabbitMQ Janus'
|
data/lib/rrj/init.rb
CHANGED
@@ -87,7 +87,7 @@ module RubyRabbitmqJanus
|
|
87
87
|
#
|
88
88
|
# @example Sending an message create
|
89
89
|
# RubyRabbitmqJanus::RRJ.new.message_session('base::create')
|
90
|
-
#
|
90
|
+
# #=> {"janus":"server_info","name":"Janus WebRTC Gateway" ... }
|
91
91
|
#
|
92
92
|
# @return [RubyRabbitmqJanus::Janus::Responses::Standard]
|
93
93
|
# Give an object response to janus server
|
@@ -202,7 +202,7 @@ module RubyRabbitmqJanus
|
|
202
202
|
#
|
203
203
|
# @since 1.0.0
|
204
204
|
def handle_message_simple(type, options = { 'replace' => {}, 'add' => {} })
|
205
|
-
@transaction = Janus::Transactions::Handle.new(
|
205
|
+
@transaction = Janus::Transactions::Handle.new(session?(options),
|
206
206
|
false,
|
207
207
|
handle?(options))
|
208
208
|
@transaction.connect { message_handle(type, options) }
|
@@ -218,9 +218,17 @@ module RubyRabbitmqJanus
|
|
218
218
|
{ 'session_id' => @session } unless option.key?('session_id')
|
219
219
|
end
|
220
220
|
|
221
|
+
def session?(options)
|
222
|
+
return_value(options, 'session_id', @session)
|
223
|
+
end
|
224
|
+
|
221
225
|
def handle?(options)
|
222
|
-
|
223
|
-
|
226
|
+
return_value(options, 'handle_id', 0)
|
227
|
+
end
|
228
|
+
|
229
|
+
def return_value(opt, key, value)
|
230
|
+
replace = opt['replace']
|
231
|
+
replace.key?(key) ? replace[key] : value
|
224
232
|
end
|
225
233
|
end
|
226
234
|
end
|
@@ -16,7 +16,10 @@ module RubyRabbitmqJanus
|
|
16
16
|
|
17
17
|
# Create a thred for execute a block code in a thread
|
18
18
|
#
|
19
|
-
# @
|
19
|
+
# @param [Proc] block Block code for execute action when queue
|
20
|
+
# standard 'from-janus' receive a message.
|
21
|
+
#
|
22
|
+
# @return [Thread] It's a thread who listen queue and execute action
|
20
23
|
def run(&block)
|
21
24
|
thread.join
|
22
25
|
Thread.new do
|
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
|
|
14
14
|
|
15
15
|
# Create a thread
|
16
16
|
def initialize
|
17
|
-
@response = @
|
17
|
+
@response = @publisher = nil
|
18
18
|
super
|
19
19
|
end
|
20
20
|
|
@@ -30,24 +30,30 @@ module RubyRabbitmqJanus
|
|
30
30
|
|
31
31
|
def transaction_running
|
32
32
|
@response = Janus::Responses::Standard.new(create_session)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
synchronize
|
34
|
+
create_loop_session
|
35
|
+
rescue => error
|
36
|
+
raise Errors::KeepaliveLoopSession, error
|
37
|
+
end
|
38
|
+
|
39
|
+
def synchronize
|
40
|
+
lock.synchronize { condition.signal }
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_loop_session
|
44
|
+
loop { loop_session(Tools::Config.instance.ttl) }
|
37
45
|
end
|
38
46
|
|
39
47
|
def loop_session(time_to_live)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
rescue => error
|
45
|
-
raise Errors::KeepaliveLoopSession, error
|
48
|
+
sleep time_to_live
|
49
|
+
@publisher.publish(message_keepalive)
|
50
|
+
Tools::Log.instance.info "Keepalive for #{running_session}"
|
46
51
|
end
|
47
52
|
|
48
53
|
def create_session
|
49
|
-
@
|
50
|
-
|
54
|
+
@publisher = Rabbit::Publisher::PublishExclusive.new(rabbit.channel,
|
55
|
+
'')
|
56
|
+
@publisher.publish(Janus::Messages::Standard.new('base::create'))
|
51
57
|
rescue => error
|
52
58
|
raise Errors::KeepaliveCreateSession, error
|
53
59
|
end
|
@@ -8,6 +8,13 @@ module RubyRabbitmqJanus
|
|
8
8
|
# This class work with janus and send a series of message
|
9
9
|
class Admin < Handle
|
10
10
|
# Publish an message in handle
|
11
|
+
#
|
12
|
+
# @param [String] type
|
13
|
+
# Given a type to request. JSON request writing in 'config/requests/'
|
14
|
+
# @param [Hash] options Replace/add element to request
|
15
|
+
#
|
16
|
+
# @return [Janus::Response::Standard] a response to message pusblishing
|
17
|
+
# in queue Admin API
|
11
18
|
def publish_message_handle(type, options)
|
12
19
|
opts = {
|
13
20
|
'session_id' => session,
|
@@ -15,8 +22,7 @@ module RubyRabbitmqJanus
|
|
15
22
|
'admin_secret' => admin_secret
|
16
23
|
}
|
17
24
|
msg = Janus::Messages::Admin.new(type, opts.merge!(options))
|
18
|
-
publisher
|
19
|
-
Janus::Responses::Standard.new(read_response(publisher))
|
25
|
+
Janus::Responses::Standard.new(read_response(publisher.publish(msg)))
|
20
26
|
end
|
21
27
|
|
22
28
|
private
|
@@ -24,13 +30,13 @@ module RubyRabbitmqJanus
|
|
24
30
|
# Define queue used for admin message
|
25
31
|
def choose_queue
|
26
32
|
chan = rabbit.channel
|
27
|
-
@
|
33
|
+
@publisher = Rabbit::Publisher::PublisherAdmin.new(chan)
|
28
34
|
end
|
29
35
|
|
30
36
|
# Override method for publishing an message and reading a response
|
31
37
|
def send_a_message
|
32
38
|
Tools::Log.instance.info 'Publish a message ...'
|
33
|
-
Janus::Responses::Standard.new(publish
|
39
|
+
Janus::Responses::Standard.new(publisher.publish(yield))
|
34
40
|
end
|
35
41
|
|
36
42
|
# Read a admin pass in configuration file to this gem
|
@@ -33,11 +33,16 @@ module RubyRabbitmqJanus
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Publish an message in handle
|
36
|
+
#
|
37
|
+
# @param [String] type Request file used
|
38
|
+
# @param [Hash] options Replace/add element in request
|
39
|
+
#
|
40
|
+
# @return [Janus::Responses::Standard] Response to message sending
|
36
41
|
def publish_message_handle(type, options)
|
37
42
|
opts = { 'session_id' => session, 'handle_id' => handle }
|
38
43
|
msg = Janus::Messages::Standard.new(type, opts.merge!(options))
|
39
|
-
|
40
|
-
Janus::Responses::Standard.new(
|
44
|
+
response = read_response(publisher.publish(msg))
|
45
|
+
Janus::Responses::Standard.new(response)
|
41
46
|
end
|
42
47
|
|
43
48
|
private
|
@@ -61,7 +66,7 @@ module RubyRabbitmqJanus
|
|
61
66
|
def read_response_exclusive
|
62
67
|
chan = rabbit.channel
|
63
68
|
tmp_publish = Rabbit::Publisher::PublishExclusive.new(chan, '')
|
64
|
-
tmp_publish.
|
69
|
+
tmp_publish.publish(yield)
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
@@ -16,32 +16,33 @@ module RubyRabbitmqJanus
|
|
16
16
|
def initialize(session)
|
17
17
|
@rabbit = Rabbit::Connect.new
|
18
18
|
@session = session
|
19
|
-
@
|
19
|
+
@publisher = @exclusive = nil
|
20
20
|
rescue => error
|
21
21
|
raise Errors::JanusTransaction, error
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
attr_reader :rabbit, :session, :response, :handle, :
|
26
|
+
attr_reader :rabbit, :session, :response, :handle, :publisher,
|
27
|
+
:exclusive
|
27
28
|
|
28
29
|
def choose_queue
|
29
30
|
chan = @rabbit.channel
|
30
|
-
@
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
@publisher = if @exclusive
|
32
|
+
Tools::Log.instance.debug \
|
33
|
+
'Choose an queue Exclusive : ampq.gen-xxx'
|
34
|
+
Rabbit::Publisher::PublishExclusive.new(chan, '')
|
35
|
+
else
|
36
|
+
Tools::Log.instance.debug \
|
37
|
+
'Choose an queue non Exclusive : to-janus'
|
38
|
+
Rabbit::Publisher::PublishNonExclusive.new(chan)
|
39
|
+
end
|
39
40
|
end
|
40
41
|
|
41
42
|
def send_a_message
|
42
43
|
Tools::Log.instance.info 'Publish a message ...'
|
43
|
-
|
44
|
-
Janus::Responses::Standard.new(
|
44
|
+
response = read_response(@publisher.publish(yield))
|
45
|
+
Janus::Responses::Standard.new(response)
|
45
46
|
end
|
46
47
|
|
47
48
|
def read_response(publish)
|
@@ -4,8 +4,15 @@ module RubyRabbitmqJanus
|
|
4
4
|
module Rabbit
|
5
5
|
module Publisher
|
6
6
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
7
|
+
# # Publish message
|
8
|
+
#
|
9
|
+
# Publish message in queue exclusive. Bunny create automaticaly a name for
|
10
|
+
# this queue. The queue name like to 'amq.gen-1A456DGVHDVUS'.
|
7
11
|
class PublishExclusive < Publisher
|
8
12
|
# Initialize an queue exclusive and generated automaticaly by bunny
|
13
|
+
#
|
14
|
+
# @param [String] exchange Exchange used for the transaction
|
15
|
+
# @param [String] name_queue Name to queue exclusive
|
9
16
|
def initialize(exchange, name_queue)
|
10
17
|
@reply = exchange.queue(name_queue, exclusive: true)
|
11
18
|
super(exchange)
|
@@ -13,7 +20,7 @@ module RubyRabbitmqJanus
|
|
13
20
|
end
|
14
21
|
|
15
22
|
# Send an message to queue and waiting a response
|
16
|
-
def
|
23
|
+
def publish(request)
|
17
24
|
super(request)
|
18
25
|
return_response
|
19
26
|
end
|
@@ -18,11 +18,13 @@ module RubyRabbitmqJanus
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Publish an message in queue
|
21
|
-
def
|
21
|
+
def publish(request)
|
22
22
|
Tools::Log.instance.info "Send request type : #{request.type}"
|
23
23
|
@message = request
|
24
24
|
@exchange.publish(@message.to_json,
|
25
25
|
request.options.merge!(reply_to: queue_name))
|
26
|
+
rescue => error
|
27
|
+
raise Errors::RabbitPublishMessage, error, request
|
26
28
|
end
|
27
29
|
|
28
30
|
private
|
data/lib/rrj/tools/config.rb
CHANGED
@@ -32,7 +32,7 @@ module RubyRabbitmqJanus
|
|
32
32
|
|
33
33
|
# Replace sdp in request
|
34
34
|
def replace_sdp
|
35
|
-
request['jsep']['sdp'] = opts['replace']['sdp']
|
35
|
+
request['jsep']['sdp'] = opts['replace']['sdp'].gsub("\n", "\r\n")
|
36
36
|
rescue => message
|
37
37
|
Tools::Log.instance.warn "Error sdp replace : #{message}"
|
38
38
|
end
|
@@ -17,6 +17,7 @@ module RubyRabbitmqJanus
|
|
17
17
|
case @request[key]
|
18
18
|
when '<string>' then convert_to_type_string
|
19
19
|
when '<number>' then convert_to_type_number
|
20
|
+
when '<boolean>' then convert_to_type_boolean
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -31,6 +32,15 @@ module RubyRabbitmqJanus
|
|
31
32
|
def convert_to_type_number
|
32
33
|
@data.to_i
|
33
34
|
end
|
35
|
+
|
36
|
+
# Convert a data to Boolean type
|
37
|
+
def convert_to_type_boolean
|
38
|
+
if @data.casecmp('TRUE')
|
39
|
+
true
|
40
|
+
elsif @data.casecmp('FALSE')
|
41
|
+
false
|
42
|
+
end
|
43
|
+
end
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
describe 'RubyRabbitmqJanus::RRJ -- message type offer'
|
5
|
+
describe 'RubyRabbitmqJanus::RRJ -- message type offer' do
|
6
6
|
before(:example) do
|
7
7
|
sdp = <<END
|
8
8
|
v=0
|
9
9
|
o=- 7041456084360858977 2 IN IP4 127.0.0.1
|
10
10
|
s=-
|
11
|
-
|
11
|
+
t=0 0
|
12
12
|
a=group:BUNDLE audio video
|
13
13
|
a=msid-semantic: WMS 2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
|
14
14
|
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
|
@@ -94,12 +94,10 @@ a=ssrc:258141567 mslabel:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
|
|
94
94
|
a=ssrc:258141567 label:25d58816-114a-41d2-aa08-1039e09f942f
|
95
95
|
END
|
96
96
|
@type = 'peer::offer'
|
97
|
-
@options = { 'replace' => { 'sdp' => sdp }, 'add' => {} }
|
97
|
+
@options = { 'replace' => { 'sdp' => sdp.to_s }, 'add' => {} }
|
98
98
|
end
|
99
99
|
|
100
100
|
describe '#message_handle', type: :request, level: :peer, name: :offer do
|
101
|
-
let(:sdp) { 'v=0\r\no=[..more sdp stuff..]' }
|
102
|
-
|
103
101
|
context 'when queue is exclusive' do
|
104
102
|
it_behaves_like 'message_handle should match json schema'
|
105
103
|
end
|
data/spec/rrj/rrj_config_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe RubyRabbitmqJanus::Tools::Config, type: :config, name: :config do
|
|
21
21
|
expect(@cfg.plugin_at).to be_a(String)
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'When janus/plugins/0
|
24
|
+
it 'When janus/plugins/0 default value is loading' do
|
25
25
|
expect(@cfg.plugin_at).to eq 'janus.plugin.echotest'
|
26
26
|
end
|
27
27
|
|
data/spec/rrj/rrj_spec.rb
CHANGED
@@ -3,23 +3,49 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe 'RubyRabbitmqJanus::RRJ', type: :config, name: :describe do
|
6
|
-
|
7
|
-
|
6
|
+
context 'Has a version number' do
|
7
|
+
let(:data) { RubyRabbitmqJanus::VERSION }
|
8
|
+
it_behaves_like 'constant is', String
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
context 'Has a name' do
|
12
|
+
let(:data) { RubyRabbitmqJanus::GEM_NAME }
|
13
|
+
it_behaves_like 'constant is', String
|
12
14
|
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
context 'Has a author' do
|
17
|
+
let(:data) { RubyRabbitmqJanus::AUTHORS }
|
18
|
+
it_behaves_like 'constant is', Array
|
16
19
|
end
|
17
20
|
|
18
|
-
|
19
|
-
|
21
|
+
context 'Has a email' do
|
22
|
+
let(:data) { RubyRabbitmqJanus::EMAILS }
|
23
|
+
it_behaves_like 'constant is', Array
|
20
24
|
end
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
context 'Has a license' do
|
27
|
+
let(:data) { RubyRabbitmqJanus::LICENSE }
|
28
|
+
it_behaves_like 'constant is', String
|
29
|
+
it { expect('../../LICENSE').to be_an_existing_file }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'Has a description' do
|
33
|
+
let(:data) { RubyRabbitmqJanus::DESCRIPTION }
|
34
|
+
it_behaves_like 'constant is', String
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'Has a summary description' do
|
38
|
+
let(:data) { RubyRabbitmqJanus::SUMMARY }
|
39
|
+
it_behaves_like 'constant is', String
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'Has a homepage' do
|
43
|
+
let(:data) { RubyRabbitmqJanus::HOMEPAGE }
|
44
|
+
it_behaves_like 'constant is', String
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'Has a post install message' do
|
48
|
+
let(:data) { RubyRabbitmqJanus::POST_INSTALL }
|
49
|
+
it_behaves_like 'constant is', String
|
24
50
|
end
|
25
51
|
end
|
@@ -78,3 +78,20 @@ shared_examples 'message_admin should match json schema' do
|
|
78
78
|
expect(message.to_json).to match_json_schema(@type)
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
# Simple request
|
83
|
+
shared_examples 'peer message_simple should match json empty' do
|
84
|
+
let(:message) { @gateway.message_simple(@type) }
|
85
|
+
|
86
|
+
it 'should match JSON empty' do
|
87
|
+
expect(message.to_json).to eq('{}')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
shared_examples 'peer message_simple should match json schema' do
|
92
|
+
let(:message) { @gateway.message_simple(@type, true) }
|
93
|
+
|
94
|
+
it do
|
95
|
+
expect(message.to_json).to match_json_schema(@type)
|
96
|
+
end
|
97
|
+
end
|
@@ -3,13 +3,11 @@
|
|
3
3
|
"properties": {
|
4
4
|
"janus": { "type": "string", "pattern": "ack" },
|
5
5
|
"transaction": { "type": "string" },
|
6
|
-
"session_id": { "type": "integer" }
|
7
|
-
"handle_id": { "type": "integer" }
|
6
|
+
"session_id": { "type": "integer" }
|
8
7
|
},
|
9
8
|
"required": [
|
10
9
|
"janus",
|
11
10
|
"transaction",
|
12
|
-
"session_id"
|
13
|
-
"handle_id"
|
11
|
+
"session_id"
|
14
12
|
]
|
15
13
|
}
|
@@ -3,13 +3,11 @@
|
|
3
3
|
"properties": {
|
4
4
|
"janus": { "type": "string", "pattern": "ack" },
|
5
5
|
"transaction": { "type": "string" },
|
6
|
-
"session_id": { "type": "integer" }
|
7
|
-
"handle_id": { "type": "integer" }
|
6
|
+
"session_id": { "type": "integer" }
|
8
7
|
},
|
9
8
|
"required": [
|
10
9
|
"janus",
|
11
10
|
"transaction",
|
12
|
-
"session_id"
|
13
|
-
"handle_id"
|
11
|
+
"session_id"
|
14
12
|
]
|
15
13
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rabbitmq_janus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3.pre.53
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VAILLANT Jeremy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,7 +285,7 @@ description: |
|
|
285
285
|
to RabbitMQ server in a queue for gem. Once the received message is decoded and
|
286
286
|
returned through the Rails API.
|
287
287
|
email:
|
288
|
-
- jeremy
|
288
|
+
- jeremy@dazzl.tv
|
289
289
|
executables: []
|
290
290
|
extensions: []
|
291
291
|
extra_rdoc_files: []
|
@@ -359,6 +359,19 @@ files:
|
|
359
359
|
- lib/rrj/tools/requests.rb
|
360
360
|
- lib/rrj/tools/tools.rb
|
361
361
|
- lib/ruby_rabbitmq_janus.rb
|
362
|
+
- spec/fixtures/config/requests/admin/handle_info.json
|
363
|
+
- spec/fixtures/config/requests/admin/handles.json
|
364
|
+
- spec/fixtures/config/requests/admin/log_level.json
|
365
|
+
- spec/fixtures/config/requests/admin/sessions.json
|
366
|
+
- spec/fixtures/config/requests/base/attach.json
|
367
|
+
- spec/fixtures/config/requests/base/create.json
|
368
|
+
- spec/fixtures/config/requests/base/destroy.json
|
369
|
+
- spec/fixtures/config/requests/base/detach.json
|
370
|
+
- spec/fixtures/config/requests/base/info.json
|
371
|
+
- spec/fixtures/config/requests/base/keepalive.json
|
372
|
+
- spec/fixtures/config/requests/peer/answer.json
|
373
|
+
- spec/fixtures/config/requests/peer/offer.json
|
374
|
+
- spec/fixtures/config/requests/peer/trickle.json
|
362
375
|
- spec/request/admin/request_handle_info_spec.rb
|
363
376
|
- spec/request/admin/request_sessions_spec.rb
|
364
377
|
- spec/request/base/request_attach_spec.rb
|
@@ -367,7 +380,6 @@ files:
|
|
367
380
|
- spec/request/base/request_detach_spec.rb
|
368
381
|
- spec/request/base/request_info_spec.rb
|
369
382
|
- spec/request/base/request_keepalive_spec.rb
|
370
|
-
- spec/request/peer/request_answer_spec.rb
|
371
383
|
- spec/request/peer/request_offer_spec.rb
|
372
384
|
- spec/request/peer/request_trickle_spec.rb
|
373
385
|
- spec/rrj/rrj_config_spec.rb
|
@@ -376,8 +388,8 @@ files:
|
|
376
388
|
- spec/rrj/rrj_spec.rb
|
377
389
|
- spec/spec_helper.rb
|
378
390
|
- spec/support/aruba.rb
|
379
|
-
- spec/support/
|
380
|
-
- spec/support/
|
391
|
+
- spec/support/examples_config.rb
|
392
|
+
- spec/support/examples_request.rb
|
381
393
|
- spec/support/schemas/config/config.json
|
382
394
|
- spec/support/schemas/config/rabbit.json
|
383
395
|
- spec/support/schemas/request/admin/handle_info.json
|
@@ -388,10 +400,6 @@ files:
|
|
388
400
|
- spec/support/schemas/request/base/detach.json
|
389
401
|
- spec/support/schemas/request/base/info.json
|
390
402
|
- spec/support/schemas/request/base/keepalive.json
|
391
|
-
- spec/support/schemas/request/channel/create.json
|
392
|
-
- spec/support/schemas/request/channel/destroy.json
|
393
|
-
- spec/support/schemas/request/channel/exist.json
|
394
|
-
- spec/support/schemas/request/channel/list.json
|
395
403
|
- spec/support/schemas/request/peer/answer.json
|
396
404
|
- spec/support/schemas/request/peer/offer.json
|
397
405
|
- spec/support/schemas/request/peer/trickle.json
|
@@ -427,9 +435,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
427
435
|
version: '0'
|
428
436
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
429
437
|
requirements:
|
430
|
-
- - "
|
438
|
+
- - ">"
|
431
439
|
- !ruby/object:Gem::Version
|
432
|
-
version:
|
440
|
+
version: 1.3.1
|
433
441
|
requirements: []
|
434
442
|
rubyforge_project:
|
435
443
|
rubygems_version: 2.5.1
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'RubyRabbitmqJanus::RRJ -- message type answer', broken: true do
|
6
|
-
before(:example) do
|
7
|
-
sdp = <<END
|
8
|
-
v=0
|
9
|
-
o=- 7041456084360858977 2 IN IP4 127.0.0.1
|
10
|
-
s=-
|
11
|
-
t=0 0
|
12
|
-
a=group:BUNDLE audio video
|
13
|
-
a=msid-semantic: WMS 2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
|
14
|
-
m=audio 9 UDP/TLS/RTP/SAVPF 111
|
15
|
-
c=IN IP4 0.0.0.0
|
16
|
-
a=rtcp:9 IN IP4 0.0.0.0
|
17
|
-
a=ice-ufrag:T9QI
|
18
|
-
a=ice-pwd:s9YvfGuavTZN0Lqc53JNInEP
|
19
|
-
a=fingerprint:sha-256 6D:ED:BC:93:AC:EC:C2:29:03:7D:6A:60:9F:D3:F5:A1:6D:1A:38:CE:F0:C0:EC:C8:5D:87:19:19:BE:0F:89:BB
|
20
|
-
a=setup:actpass
|
21
|
-
a=mid:audio
|
22
|
-
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
|
23
|
-
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
24
|
-
a=sendonly
|
25
|
-
a=rtcp-mux
|
26
|
-
a=rtpmap:111 opus/48000/2
|
27
|
-
a=rtcp-fb:111 transport-cc
|
28
|
-
a=fmtp:111 minptime=10;useinbandfec=1
|
29
|
-
m=video 9 UDP/TLS/RTP/SAVPF 100
|
30
|
-
c=IN IP4 0.0.0.0
|
31
|
-
a=rtcp:9 IN IP4 0.0.0.0
|
32
|
-
a=ice-ufrag:T9QI
|
33
|
-
a=ice-pwd:s9YvfGuavTZN0Lqc53JNInEP
|
34
|
-
a=fingerprint:sha-256 6D:ED:BC:93:AC:EC:C2:29:03:7D:6A:60:9F:D3:F5:A1:6D:1A:38:CE:F0:C0:EC:C8:5D:87:19:19:BE:0F:89:BB
|
35
|
-
a=setup:actpass
|
36
|
-
a=mid:video
|
37
|
-
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
|
38
|
-
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
39
|
-
a=extmap:4 urn:3gpp:video-orientation
|
40
|
-
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
|
41
|
-
a=sendonly
|
42
|
-
a=rtcp-mux
|
43
|
-
a=rtcp-rsize
|
44
|
-
a=rtpmap:100 VP8/90000
|
45
|
-
a=rtcp-fb:100 ccm fir
|
46
|
-
a=rtcp-fb:100 nack
|
47
|
-
a=rtcp-fb:100 nack pli
|
48
|
-
a=rtcp-fb:100 goog-remb
|
49
|
-
a=rtcp-fb:100 transport-cc
|
50
|
-
END
|
51
|
-
@type = 'peer::answer'
|
52
|
-
@options = { 'replace' => { 'sdp' => sdp }, 'add' => {} }
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#message_handle', type: :request, level: :peer, name: :answer do
|
56
|
-
context 'when queue is exclusive' do
|
57
|
-
it_behaves_like 'message_handle should match json schema'
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when queue is not exclusive' do
|
61
|
-
it_behaves_like 'message_handle should match json empty'
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
after(:example) { @gateway.handle_message_simple('base::detach') }
|
66
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Simple request
|
4
|
-
shared_examples 'peer message_simple should match json empty' do
|
5
|
-
let(:message) { @gateway.message_simple(@type) }
|
6
|
-
|
7
|
-
it 'should match JSON empty' do
|
8
|
-
expect(message.to_json).to eq('{}')
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
shared_examples 'peer message_simple should match json schema' do
|
13
|
-
let(:message) { @gateway.message_simple(@type, true) }
|
14
|
-
|
15
|
-
it do
|
16
|
-
expect(message.to_json).to match_json_schema(@type)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"properties": {
|
4
|
-
"janus": { "type": "string", "pattern": "success" },
|
5
|
-
"session_id": { "type": "integer" },
|
6
|
-
"transaction": { "type": "string" },
|
7
|
-
"sender": { "type": "integer" },
|
8
|
-
"plugindata": {
|
9
|
-
"type": "hash",
|
10
|
-
"properties": {
|
11
|
-
"data": {
|
12
|
-
"type": "hash",
|
13
|
-
"properties": {
|
14
|
-
"videocontrol": { "type": "string", "pattern": "created" },
|
15
|
-
"channel": { "type": "integer"}
|
16
|
-
},
|
17
|
-
"required": [
|
18
|
-
"videocontrol",
|
19
|
-
"channel"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
"plugin": {
|
23
|
-
"type": "string"
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"required": [
|
27
|
-
"plugin",
|
28
|
-
"data"
|
29
|
-
]
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"required": [
|
33
|
-
"janus",
|
34
|
-
"session_id",
|
35
|
-
"sender",
|
36
|
-
"transaction",
|
37
|
-
"plugindata"
|
38
|
-
]
|
39
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"properties": {
|
4
|
-
"janus": { "type": "string", "pattern": "success" },
|
5
|
-
"session_id": { "type": "integer" },
|
6
|
-
"transaction": { "type": "string" },
|
7
|
-
"sender": { "type": "integer" },
|
8
|
-
"plugindata": {
|
9
|
-
"type": "hash",
|
10
|
-
"properties": {
|
11
|
-
"data": {
|
12
|
-
"type": "hash",
|
13
|
-
"properties": {
|
14
|
-
"videocontrol": { "type": "string", "pattern": "destroyed" },
|
15
|
-
"channel": { "type": "integer"}
|
16
|
-
},
|
17
|
-
"required": [
|
18
|
-
"videocontrol",
|
19
|
-
"channel"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
"plugin": {
|
23
|
-
"type": "string"
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"required": [
|
27
|
-
"data",
|
28
|
-
"plugin"
|
29
|
-
]
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"required": [
|
33
|
-
"janus",
|
34
|
-
"session_id",
|
35
|
-
"sender",
|
36
|
-
"transaction",
|
37
|
-
"plugindata"
|
38
|
-
]
|
39
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"properties": {
|
4
|
-
"janus": { "type": "string", "pattern": "success" },
|
5
|
-
"session_id": { "type": "integer" },
|
6
|
-
"transaction": { "type": "string" },
|
7
|
-
"sender": { "type": "integer" },
|
8
|
-
"plugindata": {
|
9
|
-
"type": "hash",
|
10
|
-
"properties": {
|
11
|
-
"data": {
|
12
|
-
"type": "hash",
|
13
|
-
"properties": {
|
14
|
-
"videocontrol": { "type": "string", "pattern": "success" },
|
15
|
-
"channel": { "type": "integer"},
|
16
|
-
"exists": { "type": "boolean" }
|
17
|
-
},
|
18
|
-
"required": [
|
19
|
-
"videocontrol",
|
20
|
-
"channel",
|
21
|
-
"exists"
|
22
|
-
]
|
23
|
-
},
|
24
|
-
"plugin": {
|
25
|
-
"type": "string"
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"required": [
|
29
|
-
"plugin",
|
30
|
-
"data"
|
31
|
-
]
|
32
|
-
}
|
33
|
-
},
|
34
|
-
"required": [
|
35
|
-
"janus",
|
36
|
-
"session_id",
|
37
|
-
"sender",
|
38
|
-
"transaction",
|
39
|
-
"plugindata"
|
40
|
-
]
|
41
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"properties": {
|
4
|
-
"janus": { "type": "string", "pattern": "success" },
|
5
|
-
"session_id": { "type": "integer" },
|
6
|
-
"transaction": { "type": "string" },
|
7
|
-
"sender": { "type": "integer" },
|
8
|
-
"plugindata": {
|
9
|
-
"type": "hash",
|
10
|
-
"properties": {
|
11
|
-
"data": {
|
12
|
-
"type": "hash",
|
13
|
-
"properties": {
|
14
|
-
"videocontrol": { "type": "string" },
|
15
|
-
"list": { "type": "array" }
|
16
|
-
},
|
17
|
-
"required": [
|
18
|
-
"videocontrol",
|
19
|
-
"list"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
"plugin": { "type": "string" }
|
23
|
-
},
|
24
|
-
"required": [
|
25
|
-
"data",
|
26
|
-
"plugin"
|
27
|
-
]
|
28
|
-
}
|
29
|
-
},
|
30
|
-
"required": [
|
31
|
-
"janus",
|
32
|
-
"session_id",
|
33
|
-
"sender",
|
34
|
-
"transaction",
|
35
|
-
"plugindata"
|
36
|
-
]
|
37
|
-
}
|