ruby_rabbitmq_janus 1.2.3.pre.53 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -31
  3. data/config/requests/peer/offer.json +2 -2
  4. data/lib/rrj/errors/init.rb +1 -1
  5. data/lib/rrj/errors/rabbit/rabbit.rb +0 -14
  6. data/lib/rrj/info.rb +0 -14
  7. data/lib/rrj/janus/processus/event.rb +1 -4
  8. data/lib/rrj/janus/processus/keepalive.rb +13 -19
  9. data/lib/rrj/janus/transactions/admin.rb +4 -10
  10. data/lib/rrj/janus/transactions/handle.rb +3 -8
  11. data/lib/rrj/janus/transactions/transaction.rb +13 -14
  12. data/lib/rrj/rabbit/publish/admin.rb +1 -1
  13. data/lib/rrj/rabbit/publish/exclusive.rb +1 -8
  14. data/lib/rrj/rabbit/publish/non_exclusive.rb +1 -1
  15. data/lib/rrj/rabbit/publish/publisher.rb +1 -3
  16. data/lib/rrj/tools/config.rb +0 -2
  17. data/lib/rrj/tools/replaces/standard.rb +1 -1
  18. data/lib/rrj/tools/replaces/type.rb +0 -10
  19. data/spec/request/peer/request_answer_spec.rb +66 -0
  20. data/spec/request/peer/request_offer_spec.rb +5 -3
  21. data/spec/rrj/rrj_config_spec.rb +1 -1
  22. data/spec/rrj/rrj_spec.rb +10 -36
  23. data/spec/support/{examples_request.rb → examples.rb} +0 -17
  24. data/spec/support/examples_peer.rb +18 -0
  25. data/spec/support/schemas/request/channel/create.json +39 -0
  26. data/spec/support/schemas/request/channel/destroy.json +39 -0
  27. data/spec/support/schemas/request/channel/exist.json +41 -0
  28. data/spec/support/schemas/request/channel/list.json +37 -0
  29. data/spec/support/schemas/request/peer/answer.json +4 -2
  30. data/spec/support/schemas/request/peer/offer.json +4 -2
  31. metadata +14 -22
  32. data/spec/fixtures/config/requests/admin/handle_info.json +0 -3
  33. data/spec/fixtures/config/requests/admin/handles.json +0 -3
  34. data/spec/fixtures/config/requests/admin/log_level.json +0 -3
  35. data/spec/fixtures/config/requests/admin/sessions.json +0 -3
  36. data/spec/fixtures/config/requests/base/attach.json +0 -3
  37. data/spec/fixtures/config/requests/base/create.json +0 -4
  38. data/spec/fixtures/config/requests/base/destroy.json +0 -3
  39. data/spec/fixtures/config/requests/base/detach.json +0 -3
  40. data/spec/fixtures/config/requests/base/info.json +0 -3
  41. data/spec/fixtures/config/requests/base/keepalive.json +0 -3
  42. data/spec/fixtures/config/requests/peer/answer.json +0 -3
  43. data/spec/fixtures/config/requests/peer/offer.json +0 -3
  44. data/spec/fixtures/config/requests/peer/trickle.json +0 -3
  45. data/spec/support/examples_config.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86a3d4ef09913351f9fa9de8f78c7966cddbfa58
4
- data.tar.gz: e67eb734e40d2c9709ec2e49c696ca9799212bb6
3
+ metadata.gz: 3d1ffd3bf9b6fe114af2808fa4bff38fcb9793d7
4
+ data.tar.gz: c8b7e0025337cb7458ceaf785116abc3db07df5a
5
5
  SHA512:
6
- metadata.gz: 0168717d3cb9d059ab7af70c079a9bd912cc2d6b0edcdcbd1e9433980127b5874a8ce0cc6ba269134607047e010aabf48932fcc96f0c6dd5f357b3719ba9ad65
7
- data.tar.gz: af44f0c6e01d69e5f551d19134f36b1d4d6196c62764533b0f99e4b994041084ba336a5375c72992832b8fbea72da03698be335a8cb1e9fc327a9b59cddc5475
6
+ metadata.gz: 436f8a3cd02de4b1905898ee4bf744a86ca5c3ae2dab7964d35038a5923a919042ffae5b8e623ce1406cbc037198cb5d804822f65388f24f815e8dbbcd860bea
7
+ data.tar.gz: cad78ce33154b8c3fe54dc6883e8fffe6bf9c3ad16bd9970a3880b13782ca37b42803af97096e31d408cdeaf68ed0f4708038c5b85fc0c63d56df4a15ed72951
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
- 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.
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 RabbitMQ
11
+ server in a queue for janus server. janus processes a message and send to RabbitMQ server
12
+ in a queue for gem. Once the received message is decoded and returned through the Rails API.
13
+
14
14
 
15
15
  This gem is product by [Dazzl.tv](http://dazzl.tv)
16
16
 
@@ -48,11 +48,17 @@ Use generator for complete installation :
48
48
  ```ruby
49
49
  rails g -h
50
50
  RubyRabbitmqJanus:
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
51
+ ruby_rabbitmq_janus:configuration
52
+ # Generate a custom configuration file.
53
+
54
+ ruby_rabbitmq_janus:default_request
55
+ # Copy base request file sending to janus in application. It's necessary if you want add your request.
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.
56
62
  ```
57
63
 
58
64
  #### Requests
@@ -84,27 +90,18 @@ rabbitmq and use plugin echotest for janus server.
84
90
 
85
91
  Use tags for rspec :
86
92
 
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
- ```
93
+ | type | name |
94
+ | --------------- | --------------- |
95
+ | request | attach |
96
+ | | create |
97
+ | | detach |
98
+ | | info |
99
+ | | test |
100
+ | level | base |
101
+ | | admin |
102
+ | config | rabbit |
103
+ | | log |
104
+ | | config |
108
105
 
109
106
  ## Upgrade
110
107
 
@@ -4,8 +4,8 @@
4
4
  "handle_id": "<number>",
5
5
  "transaction": "<string>",
6
6
  "body": {
7
- "audio": true,
8
- "video": true
7
+ "audio": "true",
8
+ "video": "true"
9
9
  },
10
10
  "jsep": {
11
11
  "type": "offer",
@@ -15,7 +15,7 @@ module RubyRabbitmqJanus
15
15
  end
16
16
 
17
17
  # Define an exception if gem dont initialize correctly
18
- class InstanciateGemFailed < RRJ
18
+ class InstaciateGemFailed < 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,19 +11,5 @@ 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
28
14
  end
29
15
  end
data/lib/rrj/info.rb CHANGED
@@ -1,24 +1,10 @@
1
1
  # frozen_string_literal: true
2
- # :reek:TooManyConstants
3
-
4
2
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
5
3
  # Define constant to gem.
6
4
  module RubyRabbitmqJanus
7
5
  # Define version to gem
8
6
  VERSION = '1.2.3'
9
7
 
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'
21
-
22
8
  # Define a summary description to gem
23
9
  SUMMARY = 'Ruby RabbitMQ Janus'
24
10
 
@@ -16,10 +16,7 @@ module RubyRabbitmqJanus
16
16
 
17
17
  # Create a thred for execute a block code in a thread
18
18
  #
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
19
+ # @yield Send to publisher the actions when a Janus event is received
23
20
  def run(&block)
24
21
  thread.join
25
22
  Thread.new do
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
 
15
15
  # Create a thread
16
16
  def initialize
17
- @response = @publisher = nil
17
+ @response = @publish = nil
18
18
  super
19
19
  end
20
20
 
@@ -30,30 +30,24 @@ module RubyRabbitmqJanus
30
30
 
31
31
  def transaction_running
32
32
  @response = Janus::Responses::Standard.new(create_session)
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) }
33
+ lock.synchronize do
34
+ condition.signal
35
+ end
36
+ loop_session(Tools::Config.instance.ttl)
45
37
  end
46
38
 
47
39
  def loop_session(time_to_live)
48
- sleep time_to_live
49
- @publisher.publish(message_keepalive)
50
- Tools::Log.instance.info "Keepalive for #{running_session}"
40
+ loop do
41
+ sleep time_to_live
42
+ @publish.send_a_message(message_keepalive)
43
+ end
44
+ rescue => error
45
+ raise Errors::KeepaliveLoopSession, error
51
46
  end
52
47
 
53
48
  def create_session
54
- @publisher = Rabbit::Publisher::PublishExclusive.new(rabbit.channel,
55
- '')
56
- @publisher.publish(Janus::Messages::Standard.new('base::create'))
49
+ @publish = Rabbit::Publisher::PublishExclusive.new(rabbit.channel, '')
50
+ @publish.send_a_message(Janus::Messages::Standard.new('base::create'))
57
51
  rescue => error
58
52
  raise Errors::KeepaliveCreateSession, error
59
53
  end
@@ -8,13 +8,6 @@ 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
18
11
  def publish_message_handle(type, options)
19
12
  opts = {
20
13
  'session_id' => session,
@@ -22,7 +15,8 @@ module RubyRabbitmqJanus
22
15
  'admin_secret' => admin_secret
23
16
  }
24
17
  msg = Janus::Messages::Admin.new(type, opts.merge!(options))
25
- Janus::Responses::Standard.new(read_response(publisher.publish(msg)))
18
+ publisher = publish.send_a_message(msg)
19
+ Janus::Responses::Standard.new(read_response(publisher))
26
20
  end
27
21
 
28
22
  private
@@ -30,13 +24,13 @@ module RubyRabbitmqJanus
30
24
  # Define queue used for admin message
31
25
  def choose_queue
32
26
  chan = rabbit.channel
33
- @publisher = Rabbit::Publisher::PublisherAdmin.new(chan)
27
+ @publish = Rabbit::Publisher::PublisherAdmin.new(chan)
34
28
  end
35
29
 
36
30
  # Override method for publishing an message and reading a response
37
31
  def send_a_message
38
32
  Tools::Log.instance.info 'Publish a message ...'
39
- Janus::Responses::Standard.new(publisher.publish(yield))
33
+ Janus::Responses::Standard.new(publish.send_a_message(yield))
40
34
  end
41
35
 
42
36
  # Read a admin pass in configuration file to this gem
@@ -33,16 +33,11 @@ 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
41
36
  def publish_message_handle(type, options)
42
37
  opts = { 'session_id' => session, 'handle_id' => handle }
43
38
  msg = Janus::Messages::Standard.new(type, opts.merge!(options))
44
- response = read_response(publisher.publish(msg))
45
- Janus::Responses::Standard.new(response)
39
+ publisher = publish.send_a_message(msg)
40
+ Janus::Responses::Standard.new(read_response(publisher))
46
41
  end
47
42
 
48
43
  private
@@ -66,7 +61,7 @@ module RubyRabbitmqJanus
66
61
  def read_response_exclusive
67
62
  chan = rabbit.channel
68
63
  tmp_publish = Rabbit::Publisher::PublishExclusive.new(chan, '')
69
- tmp_publish.publish(yield)
64
+ tmp_publish.send_a_message(yield)
70
65
  end
71
66
  end
72
67
  end
@@ -16,33 +16,32 @@ module RubyRabbitmqJanus
16
16
  def initialize(session)
17
17
  @rabbit = Rabbit::Connect.new
18
18
  @session = session
19
- @publisher = @exclusive = nil
19
+ @publish = @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, :publisher,
27
- :exclusive
26
+ attr_reader :rabbit, :session, :response, :handle, :publish, :exclusive
28
27
 
29
28
  def choose_queue
30
29
  chan = @rabbit.channel
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
30
+ @publish = if @exclusive
31
+ Tools::Log.instance.debug \
32
+ 'Choose an queue Exclusive : ampq.gen-xxx'
33
+ Rabbit::Publisher::PublishExclusive.new(chan, '')
34
+ else
35
+ Tools::Log.instance.debug \
36
+ 'Choose an queue non Exclusive : to-janus'
37
+ Rabbit::Publisher::PublishNonExclusive.new(chan)
38
+ end
40
39
  end
41
40
 
42
41
  def send_a_message
43
42
  Tools::Log.instance.info 'Publish a message ...'
44
- response = read_response(@publisher.publish(yield))
45
- Janus::Responses::Standard.new(response)
43
+ publish = @publish.send_a_message(yield)
44
+ Janus::Responses::Standard.new(read_response(publish))
46
45
  end
47
46
 
48
47
  def read_response(publish)
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
  end
15
15
 
16
16
  # Send an message to queue and waiting a response
17
- def publish(request)
17
+ def send_a_message(request)
18
18
  super(request)
19
19
  return_response
20
20
  end
@@ -4,15 +4,8 @@ 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'.
11
7
  class PublishExclusive < Publisher
12
8
  # 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
16
9
  def initialize(exchange, name_queue)
17
10
  @reply = exchange.queue(name_queue, exclusive: true)
18
11
  super(exchange)
@@ -20,7 +13,7 @@ module RubyRabbitmqJanus
20
13
  end
21
14
 
22
15
  # Send an message to queue and waiting a response
23
- def publish(request)
16
+ def send_a_message(request)
24
17
  super(request)
25
18
  return_response
26
19
  end
@@ -14,7 +14,7 @@ module RubyRabbitmqJanus
14
14
  end
15
15
 
16
16
  # Send an message to queue
17
- def publish(request)
17
+ def send_a_message(request)
18
18
  super(request)
19
19
  end
20
20
 
@@ -18,13 +18,11 @@ module RubyRabbitmqJanus
18
18
  end
19
19
 
20
20
  # Publish an message in queue
21
- def publish(request)
21
+ def send_a_message(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
28
26
  end
29
27
 
30
28
  private
@@ -9,8 +9,6 @@ module RubyRabbitmqJanus
9
9
  #
10
10
  # @!attribute [r] options
11
11
  # @return [Hash] Return all options to configured in config file.
12
- # @!attribute [r] configuration
13
- # @return [String] Path to configuration file used
14
12
  class Config
15
13
  include Singleton
16
14
 
@@ -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'].gsub("\n", "\r\n")
35
+ request['jsep']['sdp'] = opts['replace']['sdp']
36
36
  rescue => message
37
37
  Tools::Log.instance.warn "Error sdp replace : #{message}"
38
38
  end
@@ -17,7 +17,6 @@ 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
21
20
  end
22
21
  end
23
22
 
@@ -32,15 +31,6 @@ module RubyRabbitmqJanus
32
31
  def convert_to_type_number
33
32
  @data.to_i
34
33
  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
44
34
  end
45
35
  end
46
36
  end
@@ -0,0 +1,66 @@
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
@@ -2,13 +2,13 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type offer' do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type offer', broken: true 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
- t=0 0
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,10 +94,12 @@ 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.to_s }, 'add' => {} }
97
+ @options = { 'replace' => { 'sdp' => sdp }, '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
+
101
103
  context 'when queue is exclusive' do
102
104
  it_behaves_like 'message_handle should match json schema'
103
105
  end
@@ -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 default value is loading' do
24
+ it 'When janus/plugins/0 defualt value is lading' 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,49 +3,23 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ', type: :config, name: :describe do
6
- context 'Has a version number' do
7
- let(:data) { RubyRabbitmqJanus::VERSION }
8
- it_behaves_like 'constant is', String
6
+ it 'Has a version number' do
7
+ expect(RubyRabbitmqJanus::VERSION).not_to be nil
9
8
  end
10
9
 
11
- context 'Has a name' do
12
- let(:data) { RubyRabbitmqJanus::GEM_NAME }
13
- it_behaves_like 'constant is', String
10
+ it 'Has a description' do
11
+ expect(RubyRabbitmqJanus::DESCRIPTION).not_to be nil
14
12
  end
15
13
 
16
- context 'Has a author' do
17
- let(:data) { RubyRabbitmqJanus::AUTHORS }
18
- it_behaves_like 'constant is', Array
14
+ it 'Has a summary description' do
15
+ expect(RubyRabbitmqJanus::SUMMARY).not_to be nil
19
16
  end
20
17
 
21
- context 'Has a email' do
22
- let(:data) { RubyRabbitmqJanus::EMAILS }
23
- it_behaves_like 'constant is', Array
18
+ it 'Has a homepage' do
19
+ expect(RubyRabbitmqJanus::HOMEPAGE).not_to be nil
24
20
  end
25
21
 
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
22
+ it 'Has a post install message' do
23
+ expect(RubyRabbitmqJanus::POST_INSTALL).not_to be nil
50
24
  end
51
25
  end
@@ -78,20 +78,3 @@ 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
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,37 @@
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
+ }
@@ -3,11 +3,13 @@
3
3
  "properties": {
4
4
  "janus": { "type": "string", "pattern": "ack" },
5
5
  "transaction": { "type": "string" },
6
- "session_id": { "type": "integer" }
6
+ "session_id": { "type": "integer" },
7
+ "handle_id": { "type": "integer" }
7
8
  },
8
9
  "required": [
9
10
  "janus",
10
11
  "transaction",
11
- "session_id"
12
+ "session_id",
13
+ "handle_id"
12
14
  ]
13
15
  }
@@ -3,11 +3,13 @@
3
3
  "properties": {
4
4
  "janus": { "type": "string", "pattern": "ack" },
5
5
  "transaction": { "type": "string" },
6
- "session_id": { "type": "integer" }
6
+ "session_id": { "type": "integer" },
7
+ "handle_id": { "type": "integer" }
7
8
  },
8
9
  "required": [
9
10
  "janus",
10
11
  "transaction",
11
- "session_id"
12
+ "session_id",
13
+ "handle_id"
12
14
  ]
13
15
  }
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.3.pre.53
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-17 00:00:00.000000000 Z
11
+ date: 2016-12-20 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: '12.0'
33
+ version: '10.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: '12.0'
40
+ version: '10.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@dazzl.tv
288
+ - jeremy.vaillant@dazzl.tv
289
289
  executables: []
290
290
  extensions: []
291
291
  extra_rdoc_files: []
@@ -359,19 +359,6 @@ 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
375
362
  - spec/request/admin/request_handle_info_spec.rb
376
363
  - spec/request/admin/request_sessions_spec.rb
377
364
  - spec/request/base/request_attach_spec.rb
@@ -380,6 +367,7 @@ files:
380
367
  - spec/request/base/request_detach_spec.rb
381
368
  - spec/request/base/request_info_spec.rb
382
369
  - spec/request/base/request_keepalive_spec.rb
370
+ - spec/request/peer/request_answer_spec.rb
383
371
  - spec/request/peer/request_offer_spec.rb
384
372
  - spec/request/peer/request_trickle_spec.rb
385
373
  - spec/rrj/rrj_config_spec.rb
@@ -388,8 +376,8 @@ files:
388
376
  - spec/rrj/rrj_spec.rb
389
377
  - spec/spec_helper.rb
390
378
  - spec/support/aruba.rb
391
- - spec/support/examples_config.rb
392
- - spec/support/examples_request.rb
379
+ - spec/support/examples.rb
380
+ - spec/support/examples_peer.rb
393
381
  - spec/support/schemas/config/config.json
394
382
  - spec/support/schemas/config/rabbit.json
395
383
  - spec/support/schemas/request/admin/handle_info.json
@@ -400,6 +388,10 @@ files:
400
388
  - spec/support/schemas/request/base/detach.json
401
389
  - spec/support/schemas/request/base/info.json
402
390
  - 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
403
395
  - spec/support/schemas/request/peer/answer.json
404
396
  - spec/support/schemas/request/peer/offer.json
405
397
  - spec/support/schemas/request/peer/trickle.json
@@ -435,9 +427,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
435
427
  version: '0'
436
428
  required_rubygems_version: !ruby/object:Gem::Requirement
437
429
  requirements:
438
- - - ">"
430
+ - - ">="
439
431
  - !ruby/object:Gem::Version
440
- version: 1.3.1
432
+ version: '0'
441
433
  requirements: []
442
434
  rubyforge_project:
443
435
  rubygems_version: 2.5.1
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,4 +0,0 @@
1
- {
2
- "janus": "create",
3
- "transaction": "<string>"
4
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "error": "Request is False !!"
3
- }
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- shared_examples 'constant is' do |type|
4
- it { expect(data).not_to be nil }
5
- it { expect(data).to be_kind_of(type) }
6
- end