ruby_rabbitmq_janus 3.0.0.pre.336 → 3.0.0.pre.351

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -29
  3. data/bin/ruby_rabbitmq_janus +1 -1
  4. data/config/default.yml +1 -3
  5. data/config/requests/admin/allow_token.json +2 -1
  6. data/config/requests/admin/disallow_token.json +2 -1
  7. data/config/requests/admin/set_session_timeout.json +2 -3
  8. data/config/requests/peer/trickles.json +7 -0
  9. data/lib/rrj/admin.rb +0 -2
  10. data/lib/rrj/errors/error.rb +7 -2
  11. data/lib/rrj/errors/janus/janus.rb +3 -17
  12. data/lib/rrj/errors/janus/messages/message.rb +1 -1
  13. data/lib/rrj/errors/janus/responses/admin.rb +67 -23
  14. data/lib/rrj/errors/janus/responses/base.rb +15 -0
  15. data/lib/rrj/errors/janus/responses/code.rb +41 -0
  16. data/lib/rrj/errors/janus/responses/event.rb +23 -28
  17. data/lib/rrj/errors/janus/responses/standard.rb +43 -32
  18. data/lib/rrj/errors/janus/transactions/transaction.rb +1 -1
  19. data/lib/rrj/errors/process/concurency.rb +1 -1
  20. data/lib/rrj/errors/rabbit/listener/base.rb +8 -1
  21. data/lib/rrj/init.rb +5 -8
  22. data/lib/rrj/janus/janus.rb +6 -6
  23. data/lib/rrj/janus/messages/admin.rb +1 -5
  24. data/lib/rrj/janus/messages/message.rb +0 -10
  25. data/lib/rrj/janus/messages/standard.rb +0 -4
  26. data/lib/rrj/janus/responses/admin.rb +50 -9
  27. data/lib/rrj/janus/responses/error.rb +159 -0
  28. data/lib/rrj/janus/responses/event.rb +14 -14
  29. data/lib/rrj/janus/responses/response.rb +43 -13
  30. data/lib/rrj/janus/responses/standard.rb +46 -14
  31. data/lib/rrj/janus/transactions/admin.rb +0 -6
  32. data/lib/rrj/janus/transactions/handle.rb +0 -10
  33. data/lib/rrj/janus/transactions/session.rb +0 -6
  34. data/lib/rrj/janus/transactions/transaction.rb +0 -2
  35. data/lib/rrj/models/concerns/instances.rb +0 -4
  36. data/lib/rrj/process/concurrency.rb +0 -2
  37. data/lib/rrj/process/event.rb +0 -4
  38. data/lib/rrj/process/event_admin.rb +0 -4
  39. data/lib/rrj/rabbit/base_event.rb +0 -2
  40. data/lib/rrj/rabbit/connect.rb +0 -12
  41. data/lib/rrj/rabbit/listener/base.rb +10 -8
  42. data/lib/rrj/rabbit/listener/from.rb +0 -3
  43. data/lib/rrj/rabbit/listener/from_admin.rb +0 -3
  44. data/lib/rrj/rabbit/propertie.rb +7 -9
  45. data/lib/rrj/rabbit/publisher/admin.rb +0 -4
  46. data/lib/rrj/rabbit/publisher/base.rb +0 -4
  47. data/lib/rrj/rabbit/publisher/exclusive.rb +0 -4
  48. data/lib/rrj/rabbit/publisher/keepalive.rb +0 -4
  49. data/lib/rrj/rabbit/publisher/non_exclusive.rb +0 -4
  50. data/lib/rrj/task.rb +0 -2
  51. data/lib/rrj/tools/bin/config.rb +2 -1
  52. data/lib/rrj/tools/gem/cluster.rb +0 -4
  53. data/lib/rrj/tools/gem/config/queues.rb +0 -5
  54. data/lib/rrj/tools/gem/{log.rb → logger.rb} +0 -0
  55. data/lib/rrj/tools/gem/option.rb +1 -6
  56. data/lib/rrj/tools/gem/requests.rb +0 -2
  57. data/lib/rrj/tools/replaces/admin.rb +2 -5
  58. data/lib/rrj/tools/replaces/handle.rb +0 -6
  59. data/lib/rrj/tools/replaces/replace.rb +0 -10
  60. data/lib/rrj/tools/replaces/session.rb +0 -4
  61. data/lib/rrj/tools/replaces/type.rb +5 -4
  62. data/spec/config/database.rb +1 -2
  63. data/spec/config/initializer.rb +5 -5
  64. data/spec/rrj/ruby_rabbitmq_janus_spec.rb +1 -1
  65. data/spec/ruby_rabbitmq_janus/janus/responses/admin_handles_spec.rb +22 -0
  66. data/spec/ruby_rabbitmq_janus/janus/responses/admin_info_spec.rb +22 -0
  67. data/spec/ruby_rabbitmq_janus/janus/responses/admin_level_spec.rb +22 -0
  68. data/spec/ruby_rabbitmq_janus/janus/responses/admin_libnice_debug_spec.rb +22 -0
  69. data/spec/ruby_rabbitmq_janus/janus/responses/admin_locking_debug_spec.rb +22 -0
  70. data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_colors_spec.rb +22 -0
  71. data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_timestamps_spec.rb +22 -0
  72. data/spec/ruby_rabbitmq_janus/janus/responses/admin_max_nack_queue_spec.rb +22 -0
  73. data/spec/ruby_rabbitmq_janus/janus/responses/admin_no_media_timer_spec.rb +22 -0
  74. data/spec/ruby_rabbitmq_janus/janus/responses/admin_sessions_spec.rb +22 -0
  75. data/spec/ruby_rabbitmq_janus/janus/responses/admin_spec.rb +1 -34
  76. data/spec/ruby_rabbitmq_janus/janus/responses/admin_timeout_spec.rb +22 -0
  77. data/spec/ruby_rabbitmq_janus/janus/responses/event_data_spec.rb +22 -0
  78. data/spec/ruby_rabbitmq_janus/janus/responses/event_event_spec.rb +22 -0
  79. data/spec/ruby_rabbitmq_janus/janus/responses/event_jsep_spec.rb +22 -0
  80. data/spec/ruby_rabbitmq_janus/janus/responses/event_keys_spec.rb +28 -0
  81. data/spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb +27 -15
  82. data/spec/ruby_rabbitmq_janus/janus/responses/standard_data_spec.rb +22 -0
  83. data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_data_spec.rb +28 -0
  84. data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_spec.rb +22 -0
  85. data/spec/ruby_rabbitmq_janus/janus/responses/standard_sdp_spec.rb +28 -0
  86. data/spec/ruby_rabbitmq_janus/janus/responses/standard_sender_spec.rb +28 -0
  87. data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_id_spec.rb +22 -0
  88. data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_spec.rb +28 -0
  89. data/spec/ruby_rabbitmq_janus/models/janus_instance_spec.rb +7 -2
  90. data/spec/ruby_rabbitmq_janus/rabbit/connect_spec.rb +0 -4
  91. data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_classic_spec.rb +12 -0
  92. data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_token_spec.rb +12 -0
  93. data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +31 -0
  94. data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +43 -0
  95. data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +43 -0
  96. data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +32 -0
  97. data/spec/ruby_rabbitmq_janus/rrj_admin_list_handles_spec.Rb +32 -0
  98. data/spec/ruby_rabbitmq_janus/rrj_admin_list_sessions_spec.rb +25 -0
  99. data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +33 -0
  100. data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +43 -0
  101. data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +20 -0
  102. data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +20 -0
  103. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +20 -0
  104. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +75 -0
  105. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +20 -0
  106. data/spec/ruby_rabbitmq_janus/rrj_admin_set_max_nack_queue_spec.rb +56 -0
  107. data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +47 -0
  108. data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +47 -0
  109. data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +38 -0
  110. data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +38 -0
  111. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +43 -0
  112. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +43 -0
  113. data/spec/ruby_rabbitmq_janus/rrj_answer_spec.rb +79 -0
  114. data/spec/ruby_rabbitmq_janus/rrj_attach_spec.rb +56 -0
  115. data/spec/ruby_rabbitmq_janus/rrj_create_spec.rb +25 -0
  116. data/spec/ruby_rabbitmq_janus/rrj_destroy_spec.rb +56 -0
  117. data/spec/ruby_rabbitmq_janus/rrj_detach_spec.rb +56 -0
  118. data/spec/ruby_rabbitmq_janus/rrj_info_spec.rb +36 -0
  119. data/spec/ruby_rabbitmq_janus/rrj_keepalive_spec.rb +56 -0
  120. data/spec/ruby_rabbitmq_janus/rrj_offer_spec.rb +57 -0
  121. data/spec/ruby_rabbitmq_janus/rrj_trickle_spec.rb +41 -0
  122. data/spec/ruby_rabbitmq_janus/rrj_trickles_spec.rb +43 -0
  123. data/spec/ruby_rabbitmq_janus/tools/cluster_spec.rb +12 -7
  124. data/spec/ruby_rabbitmq_janus/tools/config_gem_spec.rb +94 -0
  125. data/spec/ruby_rabbitmq_janus/tools/config_janus_spec.rb +44 -0
  126. data/spec/ruby_rabbitmq_janus/tools/config_queues_spec.rb +34 -0
  127. data/spec/ruby_rabbitmq_janus/tools/config_rabbit_spec.rb +28 -0
  128. data/spec/ruby_rabbitmq_janus/tools/config_spec.rb +4 -77
  129. data/spec/ruby_rabbitmq_janus/tools/replaces/admin_spec.rb +13 -12
  130. data/spec/ruby_rabbitmq_janus/tools/replaces/handle_spec.rb +12 -11
  131. data/spec/ruby_rabbitmq_janus/tools/replaces/replace_spec.rb +15 -14
  132. data/spec/ruby_rabbitmq_janus/tools/replaces/session_spec.rb +12 -11
  133. data/spec/ruby_rabbitmq_janus/tools/type_spec.rb +20 -1
  134. data/spec/spec_helper.rb +23 -8
  135. data/spec/support/examples_admin.rb +43 -0
  136. data/spec/support/examples_base.rb +65 -0
  137. data/spec/support/examples_config.rb +4 -2
  138. data/spec/support/examples_message.rb +4 -2
  139. data/spec/support/initialize_janus_instance.rb +80 -0
  140. data/spec/support/schemas/config/{rabbit_options_admin.json → rabbit_options_admin_instance_classic.json} +0 -0
  141. data/spec/support/schemas/config/{rabbit_options_admin2.json → rabbit_options_admin_instance_token.json} +0 -0
  142. data/spec/support/schemas/config/{rabbit_options.json → rabbit_options_instance_classic.json} +0 -0
  143. data/spec/support/schemas/config/{rabbit_options2.json → rabbit_options_instance_token.json} +0 -0
  144. data/spec/support/schemas/request/admin/set_libnice_debug.json +13 -0
  145. data/spec/support/schemas/request/admin/set_log_colors.json +13 -0
  146. data/spec/support/schemas/request/admin/set_log_level.json +4 -2
  147. data/spec/support/schemas/request/admin/set_log_timestamps.json +13 -0
  148. data/spec/support/schemas/request/admin/set_max_nack_queue.json +13 -0
  149. data/spec/support/schemas/request/admin/set_no_media_timer.json +13 -0
  150. data/spec/support/schemas/request/admin/set_session_timeout.json +13 -0
  151. data/spec/support/schemas/request/peer/trickles.json +13 -0
  152. data/spec/support/sdp.rb +2 -0
  153. data/spec/support/type.rb +9 -7
  154. metadata +93 -55
  155. data/lib/rrj/errors/janus/responses/response.rb +0 -44
  156. data/spec/config/instance.rb +0 -63
  157. data/spec/request/admin/request_add_token_spec.rb +0 -29
  158. data/spec/request/admin/request_allow_token_spec.rb +0 -21
  159. data/spec/request/admin/request_disallow_token_spec.rb +0 -21
  160. data/spec/request/admin/request_handle_info_spec.rb +0 -21
  161. data/spec/request/admin/request_list_handles_spec.rb +0 -20
  162. data/spec/request/admin/request_list_sessions_spec.rb +0 -21
  163. data/spec/request/admin/request_list_tokens_spec.rb +0 -18
  164. data/spec/request/admin/request_remove_token_spec.rb +0 -18
  165. data/spec/request/admin/request_set_libnice_debug_spec.rb +0 -28
  166. data/spec/request/admin/request_set_locking_debug_spec.rb +0 -28
  167. data/spec/request/admin/request_set_log_colors_spec.rb +0 -28
  168. data/spec/request/admin/request_set_log_level_spec.rb +0 -70
  169. data/spec/request/admin/request_set_log_timestamps_spec.rb +0 -28
  170. data/spec/request/admin/request_set_max_nack_queue_spec.rb +0 -28
  171. data/spec/request/admin/request_set_no_media_timer_spec.rb +0 -28
  172. data/spec/request/admin/request_set_session_timeout_spec.rb +0 -35
  173. data/spec/request/admin/request_start_pcap_spec.rb +0 -28
  174. data/spec/request/admin/request_start_text2pcap_spec.rb +0 -27
  175. data/spec/request/admin/request_stop_pcap_spec.rb +0 -21
  176. data/spec/request/admin/request_stop_text2pcap_spec.rb +0 -28
  177. data/spec/request/base/request_attach_spec.rb +0 -27
  178. data/spec/request/base/request_create_spec.rb +0 -22
  179. data/spec/request/base/request_destroy_spec.rb +0 -23
  180. data/spec/request/base/request_detach_spec.rb +0 -27
  181. data/spec/request/base/request_info_spec.rb +0 -22
  182. data/spec/request/base/request_keepalive_spec.rb +0 -23
  183. data/spec/request/peer/request_offer_spec.rb +0 -27
  184. data/spec/request/peer/request_trickle_spec.rb +0 -30
  185. data/spec/request/peer/request_trickles_spec.rb +0 -30
  186. data/spec/responses/admin_handle_info.json +0 -32
  187. data/spec/responses/admin_list_handles.json +0 -4
  188. data/spec/responses/admin_list_sessions.json +0 -4
  189. data/spec/responses/admin_set_libnice_debug.json +0 -4
  190. data/spec/responses/admin_set_locking_debug.json +0 -4
  191. data/spec/responses/admin_set_log_colors.json +0 -4
  192. data/spec/responses/admin_set_log_level.json +0 -4
  193. data/spec/responses/base_info.json +0 -5
  194. data/spec/ruby_rabbitmq_janus/janus/responses/event_spec.rb +0 -26
  195. data/spec/ruby_rabbitmq_janus/janus/responses/standard_spec.rb +0 -44
  196. data/spec/ruby_rabbitmq_janus/rabbit/propertie_2_spec.rb +0 -28
  197. data/spec/ruby_rabbitmq_janus/rabbit/propertie_spec.rb +0 -29
  198. data/spec/ruby_rabbitmq_janus/tools/logger_spec.rb +0 -84
  199. data/spec/support/admin_requester.rb +0 -48
  200. data/spec/support/aruba.rb +0 -3
  201. data/spec/support/examples_request.rb +0 -65
  202. data/spec/support/examples_response.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7eb3308fd4b4101d40215b0a2f3bbd390aa66886f6c11b958a629a13a850070
4
- data.tar.gz: 0a4857a37cbfa0d8c36339299464ea235d940a20f9e80ce3555319c6b447ec2e
3
+ metadata.gz: 26081e2dcef6062935a89a824e2545e00303be4ea41272496692a5be73745a4b
4
+ data.tar.gz: d84fc9d5f8f597cb4d8306f2e81c596df72687cbdb42ff05e80a1036d9d54363
5
5
  SHA512:
6
- metadata.gz: 2129db9760da0dac75a6ff6a85589217c5c3e6ccceeef1170e06df2d96fc9ad3855e586a2890d6018275ec9b538a0a6b8ac9a0d81f8f0abb889c8e60d52585f9
7
- data.tar.gz: a927e49794cbbaab7743ed85992f26083bb029f6a9398793de011ff484505fb5b585c8f49deaa9b8e70b1783fb7c79ebb4a584804ce43810b00d6f33b2892b68
6
+ metadata.gz: 51f97d6b078e8b371138dc14cef095c120a9de8cea32c7d665adc539aa83525e4dfcb833b7834a088d75dff80e819c7e480ad1434750cc0ec06e437ed5aae49e
7
+ data.tar.gz: 233929c96f3f83c4ed996868a4c2b826234970ba75271441bac569c36a7cc2c396a79ad3586d368cb3b8eefb4df7bd680129024c32cc037a23b529f851d3dcf0
data/README.md CHANGED
@@ -16,6 +16,7 @@ This gem is product by [Dazzl.tv](http://dazzl.tv)
16
16
 
17
17
  * [How to use](#how-to-use)
18
18
  * [Installation](#installation)
19
+ * [Requirements](#requirements)
19
20
  * [Configuration](#configuration)
20
21
  * [Janus](#janus)
21
22
  * [Generators](#generators)
@@ -62,6 +63,11 @@ Install basic configuration :
62
63
  rails g ruby_rabbitmq_janus:install
63
64
  ```
64
65
 
66
+ ### Requirements
67
+
68
+ * Janus Gateway : minimum version `0.7.4` [Source Code](https://github.com/meetecho/janus-gateway) - [Documentation](https://janus.conf.meetecho.com/docs/)
69
+ * RabbitMQ server
70
+
65
71
  ### Configuration
66
72
 
67
73
  If you want used a customize configuration see [ruby-rabbitmq-janus.yml](config/default.md)
@@ -127,6 +133,8 @@ end
127
133
 
128
134
  #### Admin Request
129
135
 
136
+ __NOTE: The request authentication `HMAC-Signed token authentication` is not available.__
137
+
130
138
  ```ruby
131
139
  require 'ruby_rabbitmq_janus'
132
140
 
@@ -154,6 +162,18 @@ actions = RubyRabbitmqJanus::ActionEvents.new.action
154
162
  RubyRabbitmqJanus::Janus::Concurrencies::Event.new.run(@actions)
155
163
  ```
156
164
 
165
+ #### Listen Janus Admin Event
166
+
167
+ ```ruby
168
+ require 'ruby_rabbitmq_janus'
169
+
170
+ # Create a class in your Rails application
171
+ actions = RubyRabbitmqJanus::ActionAdminEvents.new.action
172
+
173
+ # Initialize a thread for listen public admin queue and send class to thread
174
+ RubyRabbitmqJanus::Janus::Concurrencies::EventAdmin.new.run(@actions)
175
+ ```
176
+
157
177
  ## Upgrade
158
178
 
159
179
  For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
@@ -162,43 +182,74 @@ For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
162
182
 
163
183
  ### RSpec test
164
184
 
185
+ __Use docker for running SPEC__
186
+
165
187
  ```linux
166
- bundle exec rspec
188
+ # Prepare images
189
+ docker-compose build
190
+
191
+ # Launch tiers service RabbitMQ
192
+ docker-compose up -d rabbit
193
+
194
+ # Launch tiers service Janus (ensure rabbit is started before and READY)
195
+ docker-compose up -d janus janus_token
196
+
197
+ ## Excute ##
198
+
199
+ # Start for MongoID database
200
+ docker-compose run gem env MONGO=true bundle exec rake classic
201
+ docker-compose run gem env MONGO=true bundle exec rake concurrency
202
+
203
+ # Start for SQlite3 database
204
+ docker-compose run gem env MONGO=false bundle exec rake classic
205
+ docker-compose run gem env MONGO=false bundle exec rake concurrency
206
+
207
+ ## OR ##
208
+
209
+ # Navigate in container an
210
+ docker-compose run gem ash
211
+ export MONGO=true
212
+ bundle exec rake classic
167
213
  ```
168
214
 
215
+ NOTE : Use `SPEC_DEBUG=true bundle exec rake classic` for stopping rspec execution when first test fail.
216
+
169
217
  TIPS: for rspec install janus and rabbitmq server configured by default for user
170
218
  rabbitmq and use plugin echotest for janus server.
171
219
 
172
220
  Use tags for rspec :
173
221
 
174
- | Describe | Type | Name |
175
- | ------------------------------------------------------------- | --------------- | --------------- |
176
- | **Internaly function** | config | |
177
- | Use bunny gem | | rabbit |
178
- | Test log functions | | log |
179
- | Test configuration function | | config |
180
- | Test Gem contains CONSTANTS | | describe |
181
- | **Level request sending to janus (admin monitor API or classic)** | level | |
182
- | Request with no admin right. | | base |
183
- | Request with admin right in Janus application. | | admin |
184
- | Request candidate/jsep | | peer |
185
- | **Request JSON sending to Rabbitmq -> Janus** | request | |
186
- | Test request attach type | | attach |
187
- | Test request type create | | create |
188
- | Test request type detach | | detach |
189
- | Test request type janus info | | info |
190
- | Test request type test | | test |
191
- | Test request type handle list | | handles |
192
- | Test request type sesssion list | | sessions |
193
- | Test request type handle information | | handle_info |
194
- | Test request type (un)locking debug | | set_locking_debug |
195
- | Test request type change log level | | set_log_level |
196
- | ~~Test request type tokens list~~ | | tokens |
197
- | Test request type destroy session | | destroy |
198
- | Test request keepalive | | keepalive |
199
- | ~~Test request type sdp offer~~ | | offer |
200
- | Test request type trickle, send on candidate | | trickle |
201
- | Test request type trickles, send array candidate | | trickles |
222
+ | Describe | Type | Name |
223
+ | ------------------------------------------------------------- | --------------- | --------------- |
224
+ | Internaly function | config | |
225
+ | Use bunny gem | | rabbit |
226
+ | Test log functions | | log |
227
+ | Test configuration function | | config |
228
+ | Test Gem contains CONSTANTS | | describe |
229
+ | Level request sending to janus (admin monitor API or classic) | level | |
230
+ | Request basic. | | base |
231
+ | Request with admin right in Janus application. | | admin |
232
+ | Request candidate/jsep | | peer |
233
+ | Request JSON sending to Rabbitmq -> Janus | request | |
234
+ | Test request attach type | | attach |
235
+ | Test request type create | | create |
236
+ | Test request type detach | | detach |
237
+ | Test request type janus info | | info |
238
+ | Test request type test | | test |
239
+ | Test request type handle list | | handles |
240
+ | Test request type sesssion list | | sessions |
241
+ | Test request type handle information | | handle_info |
242
+ | Test request type (un)locking debug | | set_locking_debug |
243
+ | Test request type change log level | | set_log_level |
244
+ | Test request type tokens list | | tokens |
245
+ | Test request type destroy session | | destroy |
246
+ | Test request keepalive | | keepalive |
247
+ | Test request type sdp offer | | offer |
248
+ | Test request type trickle, send on candidate | | trickle |
249
+ | Test request type trickles, send array candidate | | trickles |
250
+ | Event(s) thread | event | |
251
+ | Test thread public queue | | event |
252
+ | Test thread admin queue | | event_admin |
202
253
 
203
254
  Example usage rspec with tags :
204
255
  ```ruby
@@ -13,7 +13,7 @@
13
13
  # for writing in another logger instead rails logs.
14
14
 
15
15
  require 'rrj/tools/bin/config'
16
- require 'rrj/tools/gem/log'
16
+ require 'rrj/tools/gem/logger'
17
17
 
18
18
  Log = RubyRabbitmqJanus::Tools::Logger.create
19
19
  RubyRabbitmqJanus::Tools::Logger.start
@@ -27,8 +27,6 @@ queues:
27
27
  from: from-janus-admin
28
28
  # Queue sending a message for admin API janus
29
29
  to: to-janus-admin
30
- # Name to queue for managing instances
31
- instance: janus-instance-thread
32
30
 
33
31
  # Janus plugin used
34
32
  janus:
@@ -78,5 +76,5 @@ gem:
78
76
  orm: 'mongoid'
79
77
  # Read response json for RSpec
80
78
  response_path: 'spec/supports/rrj/responses'
81
- # Number ofprocess read public queue
79
+ # Number of process read public queue
82
80
  process: 1
@@ -2,5 +2,6 @@
2
2
  "janus": "allow_token",
3
3
  "token": "<string>",
4
4
  "transaction": "<transaction>",
5
- "admin_secret": "<string>"
5
+ "admin_secret": "<string>",
6
+ "plugins": "<plugins>"
6
7
  }
@@ -2,5 +2,6 @@
2
2
  "janus": "disallow_token",
3
3
  "token": "<string>",
4
4
  "transaction": "<transaction>",
5
- "admin_secret": "<string>"
5
+ "admin_secret": "<string>",
6
+ "plugins": "<plugins>"
6
7
  }
@@ -1,7 +1,6 @@
1
1
  {
2
- "janus": "set_log_level",
2
+ "janus": "set_session_timeout",
3
3
  "transaction": "<transaction>",
4
4
  "admin_secret": "<string>",
5
- "timeout": "<integer>",
6
- "level": "<integer>"
5
+ "timeout": "<integer>"
7
6
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "janus": "trickle",
3
+ "session_id": "<number>",
4
+ "handle_id": "<number>",
5
+ "transaction": "<transaction>",
6
+ "candidates": "<array>"
7
+ }
@@ -38,8 +38,6 @@ module RubyRabbitmqJanus
38
38
  def admin_endpoint(options = {})
39
39
  transaction = Janus::Transactions::Admin.new(options)
40
40
  transaction.connect { yield(transaction) }
41
- rescue
42
- raise Errors::RRJAdmin::StartTransactionAdmin, options
43
41
  end
44
42
  end
45
43
  end
@@ -12,19 +12,24 @@ module RubyRabbitmqJanus
12
12
  # @param [String] message Text returning in raise
13
13
  # @param [Symbol] level Important to error
14
14
  def initialize(message, level)
15
- super(message)
16
15
  write_error(message, level)
16
+ super(message)
17
17
  end
18
18
 
19
19
  private
20
20
 
21
21
  def write_error(message, level = :unknown)
22
22
  if defined?(::Log)
23
- ::Log.add(level, message)
23
+ ::Log.send(level.class.eql?(Symbol) ? level : int_to_level(level),
24
+ message)
24
25
  else
25
26
  p "#{level}, #{message}"
26
27
  end
27
28
  end
29
+
30
+ def int_to_level(sym_level)
31
+ %I[debug info warn error fatal unknown].index(sym_level)
32
+ end
28
33
  end
29
34
  end
30
35
  end
@@ -1,26 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
4
-
5
- module RubyRabbitmqJanus
6
- module Errors
7
- # Define errors to message sending and response to janus
8
- class BaseJanus < RRJError
9
- # Initialize a error standard for janus module
10
- #
11
- # @param [String] message Text returning in raise
12
- def initialize(message, level)
13
- super "[JANUS]#{message}", level
14
- end
15
- end
16
- end
17
- end
18
-
19
3
  require 'rrj/errors/janus/messages/message'
20
4
  require 'rrj/errors/janus/messages/admin'
21
5
  require 'rrj/errors/janus/messages/standard'
22
6
 
23
- require 'rrj/errors/janus/responses/response'
7
+ require 'rrj/errors/janus/responses/base'
8
+
9
+ require 'rrj/errors/janus/responses/code'
24
10
  require 'rrj/errors/janus/responses/admin'
25
11
  require 'rrj/errors/janus/responses/event'
26
12
  require 'rrj/errors/janus/responses/standard'
@@ -4,7 +4,7 @@ module RubyRabbitmqJanus
4
4
  module Errors
5
5
  module Janus
6
6
  # Define a super class for all error in Janus::Message
7
- class BaseMessage < BaseJanus
7
+ class BaseMessage < RubyRabbitmqJanus::Errors::RRJError
8
8
  def initialize(message, level)
9
9
  super "[Message]#{message}", level
10
10
  end
@@ -1,36 +1,80 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
4
-
5
3
  module RubyRabbitmqJanus
6
4
  module Errors
7
5
  module Janus
8
- # Define a super class for all error in Janus::Responses::ResponseAdmin
9
- class BaseResponseAdmin < RubyRabbitmqJanus::Errors::Janus::BaseResponse
10
- def initialize(message)
11
- super "[Admin] #{message}"
12
- end
13
- end
6
+ module Responses
7
+ module Admin
8
+ class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
9
+ def initialize(message)
10
+ super 'Admin', message
11
+ end
12
+ end
14
13
 
15
- module ResponseAdmin
16
- # Error for Janus::Responses::ResponseAdmin#sessions
17
- class Sessions < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
18
- def initializer
19
- super 'Error sessions information reading'
14
+ class Sessions < Base
15
+ def initialize
16
+ super "Missing key 'sessions'"
17
+ end
20
18
  end
21
- end
22
19
 
23
- # Error for Janus::Responses::ResponseAdmin#handles
24
- class Handles < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
25
- def initializer
26
- super 'Error handles information reading'
20
+ class Handles < Base
21
+ def initialize
22
+ super "Missing key 'handles'"
23
+ end
24
+ end
25
+
26
+ class Info < Base
27
+ def initialize
28
+ super "Missing key 'info'"
29
+ end
30
+ end
31
+
32
+ class LibniceDebug < Base
33
+ def initialize
34
+ super "Missing key 'libnice_debug'"
35
+ end
36
+ end
37
+
38
+ class LockingDebug < Base
39
+ def initialize
40
+ super "Missing key 'locking_debug'"
41
+ end
42
+ end
43
+
44
+ class LogColors < Base
45
+ def initialize
46
+ super "Missing key 'log_color'"
47
+ end
48
+ end
49
+
50
+ class Level < Base
51
+ def initialize
52
+ super "Missing key 'log_level'"
53
+ end
54
+ end
55
+
56
+ class LogTimestamps < Base
57
+ def initialize
58
+ super "Missing key 'log_timestamps'"
59
+ end
60
+ end
61
+
62
+ class MaxNackQueue < Base
63
+ def initialize
64
+ super "Missing key 'max_nack_queue'"
65
+ end
66
+ end
67
+
68
+ class NoMediaTimer < Base
69
+ def initialize
70
+ super "Missing key 'no_media_timer'"
71
+ end
27
72
  end
28
- end
29
73
 
30
- # Error for Janus::Responses::ResponseAdmin#info
31
- class Info < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
32
- def initializer
33
- super 'Error info information reading'
74
+ class Timeout < Base
75
+ def initialize
76
+ super "Missing key 'session_timeout'"
77
+ end
34
78
  end
35
79
  end
36
80
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ module Responses
7
+ class Base < RubyRabbitmqJanus::Errors::RRJError
8
+ def initialize(klass, message, level = :warn)
9
+ super "[Response][#{klass}] #{message}", level
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ module Responses
7
+ class Nok < RubyRabbitmqJanus::Errors::RRJError
8
+ def initialize(request)
9
+ super "[#{request.error_code}] Reason : #{request.error_reason}", :error
10
+ end
11
+ end
12
+
13
+ Unknown = Nok
14
+ NotAcceptingSession = Nok
15
+ WebRTCState = Nok
16
+ TokenNotFound = Nok
17
+ UnexpectedAnswer = Nok
18
+ SessionConflit = Nok
19
+ InvalidElementType = Nok
20
+ TrickleInvalidStream = Nok
21
+ JSEPInvalidSDP = Nok
22
+ JSEPUnknownType = Nok
23
+ PluginDetach = Nok
24
+ PluginMessage = Nok
25
+ PluginAttach = Nok
26
+ PluginNotFound = Nok
27
+ HandleNotFound = Nok
28
+ SessionNotFound = Nok
29
+ InvalidRequestPath = Nok
30
+ MissingMandatoryElement = Nok
31
+ InvalidJSONObject = Nok
32
+ InvalidJSON = Nok
33
+ UnknownRequest = Nok
34
+ MissingRequest = Nok
35
+ TransportSpecific = Nok
36
+ UnauthorizedPlugin = Nok
37
+ Unauthorized = Nok
38
+ end
39
+ end
40
+ end
41
+ end