ruby_rabbitmq_janus 1.2.9 → 2.0.0.pre.42

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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +145 -32
  4. data/config/default.yml +2 -0
  5. data/config/requests.md +2 -1
  6. data/config/requests/admin/add_token.json +6 -0
  7. data/config/requests/admin/allow_token.json +6 -0
  8. data/config/requests/admin/disallow_token.json +6 -0
  9. data/config/requests/admin/handle_info.json +1 -1
  10. data/config/requests/admin/handles.json +1 -1
  11. data/config/requests/admin/remove_token.json +6 -0
  12. data/config/requests/admin/sessions.json +1 -1
  13. data/config/requests/admin/set_locking_debug.json +6 -0
  14. data/config/requests/admin/{log_level.json → set_log_level.json} +1 -1
  15. data/config/requests/admin/tokens.json +5 -0
  16. data/config/requests/base/attach.json +1 -1
  17. data/config/requests/base/create.json +1 -1
  18. data/config/requests/base/destroy.json +1 -1
  19. data/config/requests/base/detach.json +1 -1
  20. data/config/requests/base/info.json +1 -1
  21. data/config/requests/base/keepalive.json +1 -1
  22. data/config/requests/peer/answer.json +1 -1
  23. data/config/requests/peer/offer.json +1 -1
  24. data/config/requests/peer/trickle.json +1 -1
  25. data/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +3 -0
  26. data/lib/rrj/admin.rb +34 -0
  27. data/lib/rrj/errors/error.rb +2 -1
  28. data/lib/rrj/errors/init.rb +6 -0
  29. data/lib/rrj/errors/janus/janus.rb +1 -0
  30. data/lib/rrj/errors/janus/janus_message.rb +8 -4
  31. data/lib/rrj/errors/janus/janus_processus_keepalive.rb +1 -0
  32. data/lib/rrj/errors/janus/janus_response.rb +27 -6
  33. data/lib/rrj/errors/janus/janus_transaction.rb +4 -0
  34. data/lib/rrj/errors/rabbit/rabbit.rb +3 -1
  35. data/lib/rrj/errors/tools/config.rb +1 -0
  36. data/lib/rrj/info.rb +1 -1
  37. data/lib/rrj/init.rb +37 -169
  38. data/lib/rrj/janus/messages/admin.rb +1 -2
  39. data/lib/rrj/janus/messages/message.rb +4 -4
  40. data/lib/rrj/janus/messages/standard.rb +3 -5
  41. data/lib/rrj/janus/processus/concurrency.rb +1 -1
  42. data/lib/rrj/janus/processus/keepalive.rb +10 -4
  43. data/lib/rrj/janus/responses/admin.rb +31 -0
  44. data/lib/rrj/janus/responses/event.rb +23 -5
  45. data/lib/rrj/janus/responses/response.rb +2 -0
  46. data/lib/rrj/janus/responses/standard.rb +26 -5
  47. data/lib/rrj/janus/transactions/admin.rb +22 -26
  48. data/lib/rrj/janus/transactions/handle.rb +13 -8
  49. data/lib/rrj/janus/transactions/session.rb +25 -7
  50. data/lib/rrj/janus/transactions/transaction.rb +2 -1
  51. data/lib/rrj/rabbit/connect.rb +2 -3
  52. data/lib/rrj/rabbit/publish/admin.rb +1 -6
  53. data/lib/rrj/rabbit/publish/base_publisher.rb +6 -11
  54. data/lib/rrj/rabbit/publish/exclusive.rb +1 -0
  55. data/lib/rrj/rabbit/publish/listener.rb +10 -27
  56. data/lib/rrj/rabbit/publish/non_exclusive.rb +2 -6
  57. data/lib/rrj/rabbit/publish/publisher.rb +4 -17
  58. data/lib/rrj/tools/{config.rb → gem/config.rb} +5 -5
  59. data/lib/rrj/tools/{log.rb → gem/log.rb} +21 -6
  60. data/lib/rrj/tools/gem/option.rb +57 -0
  61. data/lib/rrj/tools/{requests.rb → gem/requests.rb} +0 -0
  62. data/lib/rrj/tools/replaces/admin.rb +7 -13
  63. data/lib/rrj/tools/replaces/handle.rb +61 -0
  64. data/lib/rrj/tools/replaces/replace.rb +57 -27
  65. data/lib/rrj/tools/replaces/session.rb +34 -0
  66. data/lib/rrj/tools/replaces/type.rb +63 -11
  67. data/lib/rrj/tools/tools.rb +4 -3
  68. data/lib/ruby_rabbitmq_janus.rb +1 -0
  69. data/spec/request/admin/request_handle_info_spec.rb +13 -7
  70. data/spec/request/admin/request_handles_spec.rb +20 -0
  71. data/spec/request/admin/request_sessions_spec.rb +5 -4
  72. data/spec/request/admin/request_set_locking_debug_spec.rb +16 -0
  73. data/spec/request/admin/request_set_log_level_spec.rb +16 -0
  74. data/spec/request/admin/request_tokens_spec.rb +13 -0
  75. data/spec/request/base/request_attach_spec.rb +6 -9
  76. data/spec/request/base/request_create_spec.rb +5 -3
  77. data/spec/request/base/request_destroy_spec.rb +5 -3
  78. data/spec/request/base/request_detach_spec.rb +6 -7
  79. data/spec/request/base/request_info_spec.rb +5 -3
  80. data/spec/request/base/request_keepalive_spec.rb +5 -3
  81. data/spec/request/peer/request_offer_spec.rb +18 -92
  82. data/spec/request/peer/request_trickle_spec.rb +9 -28
  83. data/spec/request/peer/request_trickles_spec.rb +23 -0
  84. data/spec/rrj/responses/responses_admin_spec.rb +39 -0
  85. data/spec/rrj/responses/responses_event_spec.rb +25 -0
  86. data/spec/rrj/responses/responses_response_spec.rb +31 -0
  87. data/spec/rrj/responses/responses_standard_spec.rb +43 -0
  88. data/spec/rrj/rrj_config_spec.rb +7 -7
  89. data/spec/rrj/rrj_rabbitmq_spec.rb +1 -1
  90. data/spec/rrj/tools/replace_admin_spec.rb +86 -0
  91. data/spec/rrj/tools/replace_handle_spec.rb +78 -0
  92. data/spec/rrj/tools/replace_session_spec.rb +66 -0
  93. data/spec/rrj/tools/replace_spec.rb +69 -0
  94. data/spec/rrj/tools/type_spec.rb +150 -0
  95. data/spec/spec_helper.rb +46 -7
  96. data/spec/support/examples_request.rb +33 -61
  97. data/spec/support/examples_response.rb +30 -0
  98. data/spec/support/schemas/request/admin/handles.json +15 -0
  99. data/spec/support/schemas/request/admin/set_locking_debug.json +13 -0
  100. data/spec/support/schemas/request/admin/set_log_level.json +11 -0
  101. data/spec/support/schemas/request/admin/tokens.json +13 -0
  102. data/spec/support/type.rb +66 -0
  103. metadata +41 -69
  104. data/config/requests/peer/trickles.json +0 -7
  105. data/lib/rrj/tools/replaces/standard.rb +0 -101
  106. data/spec/fixtures/config/requests/admin/handle_info.json +0 -3
  107. data/spec/fixtures/config/requests/admin/handles.json +0 -3
  108. data/spec/fixtures/config/requests/admin/log_level.json +0 -3
  109. data/spec/fixtures/config/requests/admin/sessions.json +0 -3
  110. data/spec/fixtures/config/requests/base/attach.json +0 -3
  111. data/spec/fixtures/config/requests/base/create.json +0 -4
  112. data/spec/fixtures/config/requests/base/destroy.json +0 -3
  113. data/spec/fixtures/config/requests/base/detach.json +0 -3
  114. data/spec/fixtures/config/requests/base/info.json +0 -3
  115. data/spec/fixtures/config/requests/base/keepalive.json +0 -3
  116. data/spec/fixtures/config/requests/peer/answer.json +0 -3
  117. data/spec/fixtures/config/requests/peer/offer.json +0 -3
  118. data/spec/fixtures/config/requests/peer/trickle.json +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e7097b3084bdf28a6ca3d98594bf42b6ec88a11
4
- data.tar.gz: 12039167df87de0454f6b47f81764392e0b5cb92
3
+ metadata.gz: e1558392e819c90c47f344453a5cb2c3a35a736e
4
+ data.tar.gz: ea73603197dbeaa4a66cc9944878bda5a87f0f65
5
5
  SHA512:
6
- metadata.gz: 515d7007165d7a1e53485b27bb75265aa5522ebf876655c07945c789efef28cd3ec99071543d8c7062df8c62fe4611d2aa30107ccbd66bf84e74f0b5e7c341da
7
- data.tar.gz: 58611d01139e576079557531897b65c24b80e275cce625e519358c263c91432d09cfbd45d6acac4542cd8e862ba96fe6c6c42356e4a25192d60a483e67e92efb
6
+ metadata.gz: c17fddb071389955d91bff722fa07724789ccc4442e7867408a5311b6e718b02fcb6893b44ca365856be06706d8597c1cbbf85ae8b1f8bc3b1a1cf6ee1532ce9
7
+ data.tar.gz: 0daeb4638c093421bda626bc56cb70e4f1985753010d78a559838875df816796333486c58500f3b767f5bc4e0a1c72334ada87a677b1b9026e24b9cc208386df
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in rrj.gemspec
data/README.md CHANGED
@@ -1,8 +1,4 @@
1
- [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus)
2
- [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus)
3
- [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
4
-
5
- # ruby-rabbitmq-janus -- RRJ
1
+ # Ruby RabbitMQ Janus | [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus) [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus) [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
6
2
 
7
3
  Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
8
4
 
@@ -14,29 +10,73 @@ RabbitMQ server in a queue for janus server. janus processes a message and send
14
10
 
15
11
  This gem is product by [Dazzl.tv](http://dazzl.tv)
16
12
 
13
+ ```linux
14
+ ------------ ---------- -------
15
+ |Rails Apps| |RabbitMQ| |Janus|
16
+ ------------ ---------- -------
17
+ | | |
18
+ | Request : { "janus": "info" } | |
19
+ | --------------------------------> | |
20
+ | Create request json. | |
21
+ | Sending in queue. | |
22
+ | | -----------------------------> |
23
+ | | Read a message in queue | ----- |
24
+ | | | | Return a response
25
+ | | | | to treatment executed.
26
+ | | | <---- |
27
+ | | |
28
+ | | |
29
+ | | <---------------------------- |
30
+ | <-------------------------------- | |
31
+ | | |
32
+ | | |
33
+ | | |
34
+ | | |
35
+ ```
36
+
17
37
  ## Menu
38
+
18
39
  * [How to use](#how-to-use)
19
- * [Installation](#installation)
20
- * [Configuration](#configuration)
40
+ * [Installation](#installation)
41
+ * [Configuration](#configuration)
21
42
  * [Generators](#generators)
22
43
  * [Requests](#requests)
23
- * [Usage](#usage)
44
+ * [Usage](#usage)
45
+ * [Information](#usage-information)
46
+ * [Standard request](#standard-request)
47
+ * [Admin request](#admin-request)
48
+ * [Listen Janus Event](#listen-janus-event)
24
49
  * [Upgrade](#upgrade)
25
50
  * [Development](#development)
26
- * [RSpec](#rspec-test)
27
- * [Documentation](#documentation)
51
+ * [RSpec](#rspec-test)
52
+ * [Documentation](#documentation)
28
53
  * [Read documentation](#read-documentation)
29
54
  * [Generate developer documentation](#generate-developer-documentation)
55
+ * [Contributing](#contributing)
56
+ * [Plus](#plus)
30
57
 
31
58
  ## How to use
32
59
 
33
60
  ### Installation
34
61
 
35
- Use rubygem for installing gem in your application. Add in your Gemfile
62
+ Use rubygem for installing gem in your application. Add in your Gemfile :
63
+
36
64
  ```ruby
37
65
  gem 'ruby_rabbitmq_janus'
38
66
  ```
39
67
 
68
+ And then execute :
69
+
70
+ ```linux
71
+ bundle
72
+ ```
73
+
74
+ Or install it yourself as :
75
+
76
+ ```linux
77
+ gem install evostream-event
78
+ ```
79
+
40
80
  ### Configuration
41
81
 
42
82
  If you want used a customize configuration see [ruby-rabbitmq-janus.yml](config/default.md)
@@ -68,8 +108,61 @@ For more explain in requests files see [default requests](config/requests.md).
68
108
 
69
109
  ### Usage
70
110
 
111
+ #### Usage information
112
+
113
+ This gem use rabbitmq for manage request sending to Janus, so see
114
+ [documentation Janus](https://janus.conf.meetecho.com/docs/pages.html) and
115
+ [documentation Rabbitmq](http://www.rabbitmq.com/documentation.html). This gem
116
+ use bunny gem for create connection with rabbitmq. See many guide :
117
+ [bunny documentation](http://rubybunny.info/articles/guides.html).
118
+
119
+ #### Standard Request
120
+
121
+ ```ruby
122
+ require 'ruby_rabbitmq_janus'
123
+
124
+ # Initialize standard object
125
+ t = RubyRabbitmqJanus::RRJ.new
126
+
127
+ # Ask info Janus Instance
128
+ t.start_transaction do |transaction|
129
+ transaction.publish_message('base::info')
130
+ end
131
+
132
+ => @request={"janus"=>"server_info" ... }
133
+ ```
134
+
135
+ #### Admin Request
71
136
 
72
- TODO ...
137
+ ```ruby
138
+ require 'ruby_rabbitmq_janus'
139
+
140
+ # Initialize admin object
141
+ t = RubyRabbitmqJanus::RRJAdmin.new
142
+
143
+ # Ask info sessions in Janus Instance
144
+ t.start_transaction_admin do |transaction|
145
+ transaction.publish_message('admin::sessions')
146
+ end
147
+
148
+ => @request={"janus"=>"success" ... "sessions"=>[123, 456, 789]}
149
+ ```
150
+
151
+ #### Listen Janus Event
152
+
153
+ ```ruby
154
+ require 'ruby_rabbitmq_janus'
155
+
156
+ # Create a class in your Rails application
157
+ actions = RubyRabbitmqJanus::ActionEvents.new.action
158
+
159
+ # Initialize a thread for listen public queue and send class to thread
160
+ RubyRabbitmqJanus::Janus::Concurrencies::Event.instance.run(@actions)
161
+ ```
162
+
163
+ ## Upgrade
164
+
165
+ For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
73
166
 
74
167
  ## Development
75
168
 
@@ -84,32 +177,40 @@ rabbitmq and use plugin echotest for janus server.
84
177
 
85
178
  Use tags for rspec :
86
179
 
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 |
180
+ | Describe | Type | Name |
181
+ | ------------------------------------------------------------- | --------------- | --------------- |
182
+ | **Internaly function** | config | |
183
+ | Use bunny gem | | rabbit |
184
+ | Test log functions | | log |
185
+ | Test configuration function | | config |
186
+ | Test Gem contains CONSTANTS | | describe |
187
+ | **Level request sending to janus (admin monitor API or classic)** | level | |
188
+ | Request with no admin right. | | base |
189
+ | Request with admin right in Janus application. | | admin |
190
+ | Request candidate/jsep | | peer |
191
+ | **Request JSON sending to Rabbitmq -> Janus** | request | |
192
+ | Test request attach type | | attach |
193
+ | Test request type create | | create |
194
+ | Test request type detach | | detach |
195
+ | Test request type janus info | | info |
196
+ | Test request type test | | test |
197
+ | Test request type handle list | | handles |
198
+ | Test request type sesssion list | | sessions |
199
+ | Test request type handle information | | handle_info |
200
+ | Test request type (un)locking debug | | set_locking_debug |
201
+ | Test request type change log level | | set_log_level |
202
+ | ~~Test request type tokens list~~ | | tokens |
203
+ | Test request type destroy session | | destroy |
204
+ | Test request keepalive | | keepalive |
205
+ | ~~Test request type sdp offer~~ | | offer |
206
+ | Test request type trickle, send on candidate | | trickle |
207
+ | Test request type trickles, send array candidate | | trickles |
103
208
 
104
209
  Example usage rspec with tags :
105
210
  ```ruby
106
211
  rspec --tag --name:config --tag level:base
107
212
  ```
108
213
 
109
- ## Upgrade
110
-
111
- For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
112
-
113
214
  ### Documentation
114
215
 
115
216
  #### Read documentation
@@ -128,3 +229,15 @@ yard server
128
229
  ```
129
230
 
130
231
  [See Yard Getting Started](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
232
+
233
+ ## Contributing
234
+
235
+ Bug reports and pull requests are welcome on GitHub at
236
+ https://github.com/dazzl-tv/ruby-rabbitmq-janus This project is intended to be a
237
+ safe, welcoming space for collaboration, and contributors are expected to adhere
238
+ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
239
+
240
+ ## Plus
241
+
242
+ Janus Admin Monitor project use this gem for manage data in Janus Meetecho with
243
+ Admin/Monitor API.
data/config/default.yml CHANGED
@@ -35,6 +35,8 @@ janus:
35
35
  # Create an array to plugin
36
36
  plugins:
37
37
  - janus.plugin.echotest
38
+ - janus.plugin.videoroom
39
+ - janus.plugin.sip
38
40
 
39
41
  # Options gem
40
42
  gem:
data/config/requests.md CHANGED
@@ -53,7 +53,8 @@ Some fields are customizables. For this fields is a gem to apply a transformatio
53
53
 
54
54
  Each fields use an type :
55
55
 
56
- * "\<number\>" - Is an integer
56
+ * "\<number\>" - Is a integer
57
+ * "\<number\>" - Is a integer
57
58
  * "\<string\>" - Is a string
58
59
  * "\<plugin[X]\>" - Is a plugin with X is a key to array in config file
59
60
  * "\<array\>" - Is a array. If array contains a single value is transform to string format.
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "add_token",
3
+ "token": "<string>",
4
+ "transaction": "<transaction>",
5
+ "admin_secret": "<string>"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "allow_token",
3
+ "token": "<string>",
4
+ "transaction": "<transaction>",
5
+ "admin_secret": "<string>"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "disallow_token",
3
+ "token": "<string>",
4
+ "transaction": "<transaction>",
5
+ "admin_secret": "<string>"
6
+ }
@@ -2,6 +2,6 @@
2
2
  "janus": "handle_info",
3
3
  "session_id": "<number>",
4
4
  "handle_id": "<number>",
5
- "transaction": "<string>",
5
+ "transaction": "<transaction>",
6
6
  "admin_secret": "<string>"
7
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "janus": "list_handles",
3
3
  "session_id": "<number>",
4
- "transaction": "<string>",
4
+ "transaction": "<transaction>",
5
5
  "admin_secret": "<string>"
6
6
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus": "remove_token",
3
+ "token": "<string>",
4
+ "transaction": "<transaction>",
5
+ "admin_secret": "<string>"
6
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "janus": "list_sessions",
3
- "transaction": "<string>",
3
+ "transaction": "<transaction>",
4
4
  "admin_secret": "<string>"
5
5
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "janus" : "set_locking_debug",
3
+ "debug" : "<boolean>",
4
+ "transaction": "<transaction>",
5
+ "admin_secret": "<string>"
6
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "janus": "set_log_level",
3
3
  "level": "<integer>",
4
- "transaction": "<string>",
4
+ "transaction": "<transaction>",
5
5
  "admin_secret": "<string>"
6
6
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "janus": "list_tokens",
3
+ "transaction": "<transaction>",
4
+ "admin_secret": "<string>"
5
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "janus": "attach",
3
3
  "session_id": "<number>",
4
- "transaction": "<string>",
4
+ "transaction": "<transaction>",
5
5
  "plugin": "<plugin[0]>"
6
6
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "janus": "create",
3
- "transaction": "<string>"
3
+ "transaction": "<transaction>"
4
4
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "janus": "destroy",
3
3
  "session_id": "<number>",
4
- "transaction": "<string>"
4
+ "transaction": "<transaction>"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "janus": "detach",
3
3
  "session_id": "<number>",
4
4
  "handle_id": "<number>",
5
- "transaction": "<string>"
5
+ "transaction": "<transaction>"
6
6
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "janus": "info",
3
- "transaction": "<string>"
3
+ "transaction": "<transaction>"
4
4
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "janus": "keepalive",
3
3
  "session_id": "<number>",
4
- "transaction": "<string>"
4
+ "transaction": "<transaction>"
5
5
  }
@@ -2,7 +2,7 @@
2
2
  "janus": "message",
3
3
  "session_id": "<number>",
4
4
  "handle_id": "<number>",
5
- "transaction": "<string>",
5
+ "transaction": "<transaction>",
6
6
  "body": {
7
7
  "request": "configure"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "janus": "message",
3
3
  "session_id": "<number>",
4
4
  "handle_id": "<number>",
5
- "transaction": "<string>",
5
+ "transaction": "<transaction>",
6
6
  "body": {
7
7
  "audio": true,
8
8
  "video": true
@@ -2,6 +2,6 @@
2
2
  "janus": "trickle",
3
3
  "session_id": "<number>",
4
4
  "handle_id": "<number>",
5
- "transaction": "<string>",
5
+ "transaction": "<transaction>",
6
6
  "candidate": "<array>"
7
7
  }
@@ -13,6 +13,9 @@ require 'actions'
13
13
  # Initialize a gem and create an session with a keepalive
14
14
  ::RRJ = RubyRabbitmqJanus::RRJ.new
15
15
 
16
+ # For admin management
17
+ # ::RRJ = RubyRabbitmqJanus::RRJAdmin.new
18
+
16
19
  # This test disable this gems execution when you running an task with rake
17
20
  unless File.basename($PROGRAM_NAME) == 'rake'
18
21
  Rails.configuration.after_initialize do
data/lib/rrj/admin.rb ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
5
+
6
+ # # RubyRabbitmqJanus - RRJAdmin
7
+ #
8
+ # This class inherite to a classic initializer but it's used for
9
+ # admin request sending to janus (Admin/Monitor API).
10
+ #
11
+ # **Is used just for sending a message to Janus Monitor/Admin API.**.
12
+ # **The queue is always ***exclusive*** for not transmitting data to
13
+ # anyone.**
14
+ #
15
+ # @see https://janus.conf.meetecho.com/docs/admin.html
16
+ class RRJAdmin < RRJ
17
+ # Create a transaction between apps and Janus for request without handle
18
+ #
19
+ # @param [Hash] options
20
+ # Give a session number for use another session in Janus
21
+ #
22
+ # @example Get Janus session
23
+ # @rrj.start_transaction_admin do |transaction|
24
+ # response = transaction.publish_message('admin:sessions').sessions
25
+ # end
26
+ #
27
+ # @since 2.0.0
28
+ def start_transaction_admin(options = {})
29
+ session = option.use_current_session?(options)
30
+ transaction = Janus::Transactions::Admin.new(session)
31
+ transaction.connect { yield(transaction) }
32
+ end
33
+ end
34
+ end