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.
- checksums.yaml +4 -4
- data/README.md +80 -29
- data/bin/ruby_rabbitmq_janus +1 -1
- data/config/default.yml +1 -3
- data/config/requests/admin/allow_token.json +2 -1
- data/config/requests/admin/disallow_token.json +2 -1
- data/config/requests/admin/set_session_timeout.json +2 -3
- data/config/requests/peer/trickles.json +7 -0
- data/lib/rrj/admin.rb +0 -2
- data/lib/rrj/errors/error.rb +7 -2
- data/lib/rrj/errors/janus/janus.rb +3 -17
- data/lib/rrj/errors/janus/messages/message.rb +1 -1
- data/lib/rrj/errors/janus/responses/admin.rb +67 -23
- data/lib/rrj/errors/janus/responses/base.rb +15 -0
- data/lib/rrj/errors/janus/responses/code.rb +41 -0
- data/lib/rrj/errors/janus/responses/event.rb +23 -28
- data/lib/rrj/errors/janus/responses/standard.rb +43 -32
- data/lib/rrj/errors/janus/transactions/transaction.rb +1 -1
- data/lib/rrj/errors/process/concurency.rb +1 -1
- data/lib/rrj/errors/rabbit/listener/base.rb +8 -1
- data/lib/rrj/init.rb +5 -8
- data/lib/rrj/janus/janus.rb +6 -6
- data/lib/rrj/janus/messages/admin.rb +1 -5
- data/lib/rrj/janus/messages/message.rb +0 -10
- data/lib/rrj/janus/messages/standard.rb +0 -4
- data/lib/rrj/janus/responses/admin.rb +50 -9
- data/lib/rrj/janus/responses/error.rb +159 -0
- data/lib/rrj/janus/responses/event.rb +14 -14
- data/lib/rrj/janus/responses/response.rb +43 -13
- data/lib/rrj/janus/responses/standard.rb +46 -14
- data/lib/rrj/janus/transactions/admin.rb +0 -6
- data/lib/rrj/janus/transactions/handle.rb +0 -10
- data/lib/rrj/janus/transactions/session.rb +0 -6
- data/lib/rrj/janus/transactions/transaction.rb +0 -2
- data/lib/rrj/models/concerns/instances.rb +0 -4
- data/lib/rrj/process/concurrency.rb +0 -2
- data/lib/rrj/process/event.rb +0 -4
- data/lib/rrj/process/event_admin.rb +0 -4
- data/lib/rrj/rabbit/base_event.rb +0 -2
- data/lib/rrj/rabbit/connect.rb +0 -12
- data/lib/rrj/rabbit/listener/base.rb +10 -8
- data/lib/rrj/rabbit/listener/from.rb +0 -3
- data/lib/rrj/rabbit/listener/from_admin.rb +0 -3
- data/lib/rrj/rabbit/propertie.rb +7 -9
- data/lib/rrj/rabbit/publisher/admin.rb +0 -4
- data/lib/rrj/rabbit/publisher/base.rb +0 -4
- data/lib/rrj/rabbit/publisher/exclusive.rb +0 -4
- data/lib/rrj/rabbit/publisher/keepalive.rb +0 -4
- data/lib/rrj/rabbit/publisher/non_exclusive.rb +0 -4
- data/lib/rrj/task.rb +0 -2
- data/lib/rrj/tools/bin/config.rb +2 -1
- data/lib/rrj/tools/gem/cluster.rb +0 -4
- data/lib/rrj/tools/gem/config/queues.rb +0 -5
- data/lib/rrj/tools/gem/{log.rb → logger.rb} +0 -0
- data/lib/rrj/tools/gem/option.rb +1 -6
- data/lib/rrj/tools/gem/requests.rb +0 -2
- data/lib/rrj/tools/replaces/admin.rb +2 -5
- data/lib/rrj/tools/replaces/handle.rb +0 -6
- data/lib/rrj/tools/replaces/replace.rb +0 -10
- data/lib/rrj/tools/replaces/session.rb +0 -4
- data/lib/rrj/tools/replaces/type.rb +5 -4
- data/spec/config/database.rb +1 -2
- data/spec/config/initializer.rb +5 -5
- data/spec/rrj/ruby_rabbitmq_janus_spec.rb +1 -1
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_handles_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_info_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_level_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_libnice_debug_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_locking_debug_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_colors_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_log_timestamps_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_max_nack_queue_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_no_media_timer_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_sessions_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_spec.rb +1 -34
- data/spec/ruby_rabbitmq_janus/janus/responses/admin_timeout_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_data_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_event_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_jsep_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/event_keys_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb +27 -15
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_data_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_data_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_plugin_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_sdp_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_sender_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_id_spec.rb +22 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_session_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/models/janus_instance_spec.rb +7 -2
- data/spec/ruby_rabbitmq_janus/rabbit/connect_spec.rb +0 -4
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_classic_spec.rb +12 -0
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_instance_token_spec.rb +12 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +31 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +32 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_handles_spec.Rb +32 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_sessions_spec.rb +25 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +33 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +75 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +20 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_max_nack_queue_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +47 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +47 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +38 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +38 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/rrj_answer_spec.rb +79 -0
- data/spec/ruby_rabbitmq_janus/rrj_attach_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_create_spec.rb +25 -0
- data/spec/ruby_rabbitmq_janus/rrj_destroy_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_detach_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_info_spec.rb +36 -0
- data/spec/ruby_rabbitmq_janus/rrj_keepalive_spec.rb +56 -0
- data/spec/ruby_rabbitmq_janus/rrj_offer_spec.rb +57 -0
- data/spec/ruby_rabbitmq_janus/rrj_trickle_spec.rb +41 -0
- data/spec/ruby_rabbitmq_janus/rrj_trickles_spec.rb +43 -0
- data/spec/ruby_rabbitmq_janus/tools/cluster_spec.rb +12 -7
- data/spec/ruby_rabbitmq_janus/tools/config_gem_spec.rb +94 -0
- data/spec/ruby_rabbitmq_janus/tools/config_janus_spec.rb +44 -0
- data/spec/ruby_rabbitmq_janus/tools/config_queues_spec.rb +34 -0
- data/spec/ruby_rabbitmq_janus/tools/config_rabbit_spec.rb +28 -0
- data/spec/ruby_rabbitmq_janus/tools/config_spec.rb +4 -77
- data/spec/ruby_rabbitmq_janus/tools/replaces/admin_spec.rb +13 -12
- data/spec/ruby_rabbitmq_janus/tools/replaces/handle_spec.rb +12 -11
- data/spec/ruby_rabbitmq_janus/tools/replaces/replace_spec.rb +15 -14
- data/spec/ruby_rabbitmq_janus/tools/replaces/session_spec.rb +12 -11
- data/spec/ruby_rabbitmq_janus/tools/type_spec.rb +20 -1
- data/spec/spec_helper.rb +23 -8
- data/spec/support/examples_admin.rb +43 -0
- data/spec/support/examples_base.rb +65 -0
- data/spec/support/examples_config.rb +4 -2
- data/spec/support/examples_message.rb +4 -2
- data/spec/support/initialize_janus_instance.rb +80 -0
- data/spec/support/schemas/config/{rabbit_options_admin.json → rabbit_options_admin_instance_classic.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options_admin2.json → rabbit_options_admin_instance_token.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options.json → rabbit_options_instance_classic.json} +0 -0
- data/spec/support/schemas/config/{rabbit_options2.json → rabbit_options_instance_token.json} +0 -0
- data/spec/support/schemas/request/admin/set_libnice_debug.json +13 -0
- data/spec/support/schemas/request/admin/set_log_colors.json +13 -0
- data/spec/support/schemas/request/admin/set_log_level.json +4 -2
- data/spec/support/schemas/request/admin/set_log_timestamps.json +13 -0
- data/spec/support/schemas/request/admin/set_max_nack_queue.json +13 -0
- data/spec/support/schemas/request/admin/set_no_media_timer.json +13 -0
- data/spec/support/schemas/request/admin/set_session_timeout.json +13 -0
- data/spec/support/schemas/request/peer/trickles.json +13 -0
- data/spec/support/sdp.rb +2 -0
- data/spec/support/type.rb +9 -7
- metadata +93 -55
- data/lib/rrj/errors/janus/responses/response.rb +0 -44
- data/spec/config/instance.rb +0 -63
- data/spec/request/admin/request_add_token_spec.rb +0 -29
- data/spec/request/admin/request_allow_token_spec.rb +0 -21
- data/spec/request/admin/request_disallow_token_spec.rb +0 -21
- data/spec/request/admin/request_handle_info_spec.rb +0 -21
- data/spec/request/admin/request_list_handles_spec.rb +0 -20
- data/spec/request/admin/request_list_sessions_spec.rb +0 -21
- data/spec/request/admin/request_list_tokens_spec.rb +0 -18
- data/spec/request/admin/request_remove_token_spec.rb +0 -18
- data/spec/request/admin/request_set_libnice_debug_spec.rb +0 -28
- data/spec/request/admin/request_set_locking_debug_spec.rb +0 -28
- data/spec/request/admin/request_set_log_colors_spec.rb +0 -28
- data/spec/request/admin/request_set_log_level_spec.rb +0 -70
- data/spec/request/admin/request_set_log_timestamps_spec.rb +0 -28
- data/spec/request/admin/request_set_max_nack_queue_spec.rb +0 -28
- data/spec/request/admin/request_set_no_media_timer_spec.rb +0 -28
- data/spec/request/admin/request_set_session_timeout_spec.rb +0 -35
- data/spec/request/admin/request_start_pcap_spec.rb +0 -28
- data/spec/request/admin/request_start_text2pcap_spec.rb +0 -27
- data/spec/request/admin/request_stop_pcap_spec.rb +0 -21
- data/spec/request/admin/request_stop_text2pcap_spec.rb +0 -28
- data/spec/request/base/request_attach_spec.rb +0 -27
- data/spec/request/base/request_create_spec.rb +0 -22
- data/spec/request/base/request_destroy_spec.rb +0 -23
- data/spec/request/base/request_detach_spec.rb +0 -27
- data/spec/request/base/request_info_spec.rb +0 -22
- data/spec/request/base/request_keepalive_spec.rb +0 -23
- data/spec/request/peer/request_offer_spec.rb +0 -27
- data/spec/request/peer/request_trickle_spec.rb +0 -30
- data/spec/request/peer/request_trickles_spec.rb +0 -30
- data/spec/responses/admin_handle_info.json +0 -32
- data/spec/responses/admin_list_handles.json +0 -4
- data/spec/responses/admin_list_sessions.json +0 -4
- data/spec/responses/admin_set_libnice_debug.json +0 -4
- data/spec/responses/admin_set_locking_debug.json +0 -4
- data/spec/responses/admin_set_log_colors.json +0 -4
- data/spec/responses/admin_set_log_level.json +0 -4
- data/spec/responses/base_info.json +0 -5
- data/spec/ruby_rabbitmq_janus/janus/responses/event_spec.rb +0 -26
- data/spec/ruby_rabbitmq_janus/janus/responses/standard_spec.rb +0 -44
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_2_spec.rb +0 -28
- data/spec/ruby_rabbitmq_janus/rabbit/propertie_spec.rb +0 -29
- data/spec/ruby_rabbitmq_janus/tools/logger_spec.rb +0 -84
- data/spec/support/admin_requester.rb +0 -48
- data/spec/support/aruba.rb +0 -3
- data/spec/support/examples_request.rb +0 -65
- data/spec/support/examples_response.rb +0 -30
@@ -1,43 +1,38 @@
|
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
module Responses
|
7
|
+
module Event
|
8
|
+
class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
|
9
|
+
def initialize(message)
|
10
|
+
super 'Event', message
|
11
|
+
end
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
super 'Error janus information reading'
|
14
|
+
class Event < Base
|
15
|
+
def initialize
|
16
|
+
super 'Error janus information reading'
|
17
|
+
end
|
20
18
|
end
|
21
|
-
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
class Data < Base
|
21
|
+
def initialize
|
22
|
+
super 'Error plugin data information reading'
|
23
|
+
end
|
27
24
|
end
|
28
|
-
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
class Jsep < Base
|
27
|
+
def initialize
|
28
|
+
super 'Error JSEP information reading'
|
29
|
+
end
|
34
30
|
end
|
35
|
-
end
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
class Keys < Base
|
33
|
+
def initialize
|
34
|
+
super 'Error session_id and sender information reading'
|
35
|
+
end
|
41
36
|
end
|
42
37
|
end
|
43
38
|
end
|
@@ -1,51 +1,62 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# :reek:IrresponsibleModule
|
4
|
-
|
5
3
|
module RubyRabbitmqJanus
|
6
4
|
module Errors
|
7
5
|
module Janus
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
module Responses
|
7
|
+
module Standard
|
8
|
+
class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
|
9
|
+
def initialize(message)
|
10
|
+
super 'Standard', message
|
11
|
+
end
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
class Session < Base
|
15
|
+
def initialize
|
16
|
+
super 'Error reading response session'
|
17
|
+
end
|
19
18
|
end
|
20
|
-
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
class Sender < Base
|
21
|
+
def initialize
|
22
|
+
super 'Error reading response sender'
|
23
|
+
end
|
25
24
|
end
|
26
|
-
end
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
class SessionId < Base
|
27
|
+
def initialize
|
28
|
+
super 'Error reading response session_id'
|
29
|
+
end
|
31
30
|
end
|
32
|
-
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
class Plugin < Base
|
33
|
+
def initialize
|
34
|
+
super 'rror reading response plugin'
|
35
|
+
end
|
37
36
|
end
|
38
|
-
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
class PluginData < Base
|
39
|
+
def initialize
|
40
|
+
super 'Error reading response plugin data'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Data < Base
|
45
|
+
def initialize
|
46
|
+
super 'Error reading response data'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class JSEP < Base
|
51
|
+
def initialize
|
52
|
+
super 'Error reading response JSEP'
|
53
|
+
end
|
43
54
|
end
|
44
|
-
end
|
45
55
|
|
46
|
-
|
47
|
-
|
48
|
-
|
56
|
+
class SDP < Base
|
57
|
+
def initialize
|
58
|
+
super 'Error reading SDP (jsep > sdp in response)'
|
59
|
+
end
|
49
60
|
end
|
50
61
|
end
|
51
62
|
end
|
@@ -4,7 +4,7 @@ module RubyRabbitmqJanus
|
|
4
4
|
module Errors
|
5
5
|
module Janus
|
6
6
|
# Define a super class for all errors in Janus::Transactions::Transaction
|
7
|
-
class BaseTransaction <
|
7
|
+
class BaseTransaction < RubyRabbitmqJanus::Errors::RRJError
|
8
8
|
def initialize(message, level = :fatal)
|
9
9
|
super "[Transaction]#{message}", level
|
10
10
|
end
|
@@ -4,7 +4,7 @@ module RubyRabbitmqJanus
|
|
4
4
|
module Errors
|
5
5
|
module Process
|
6
6
|
# Define a super class for all error in Process::Concurency class
|
7
|
-
class BaseConcurency < RubyRabbitmqJanus::Errors::
|
7
|
+
class BaseConcurency < RubyRabbitmqJanus::Errors::RRJError
|
8
8
|
def initialize(message)
|
9
9
|
super "[Concurency]#{message}", :fatal
|
10
10
|
end
|
@@ -26,12 +26,19 @@ module RubyRabbitmqJanus
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
# Error when response is
|
29
|
+
# Error when response is empty
|
30
30
|
class ResponseEmpty < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
|
31
31
|
def initialize(response)
|
32
32
|
super "Response is empty ! (#{response})"
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
# Error when response is nil
|
37
|
+
class ResponseNil < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
|
38
|
+
def initialize(response)
|
39
|
+
super "Response is nil ! (#{response})"
|
40
|
+
end
|
41
|
+
end
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
data/lib/rrj/init.rb
CHANGED
@@ -9,12 +9,13 @@ require 'logger'
|
|
9
9
|
require 'key_path'
|
10
10
|
require 'erb'
|
11
11
|
require 'rrj/tools/bin/config'
|
12
|
-
require 'rrj/tools/gem/
|
13
|
-
|
14
|
-
# :reek:UtilityFunction
|
12
|
+
require 'rrj/tools/gem/logger'
|
15
13
|
|
16
14
|
Log = RubyRabbitmqJanus::Tools::Logger.create unless defined?(Log)
|
17
15
|
RubyRabbitmqJanus::Tools::Logger.start
|
16
|
+
#
|
17
|
+
# :reek:UtilityFunction
|
18
|
+
# :reek:MissingSafeMethod { exclude: [ cleanup_connection! ] }
|
18
19
|
|
19
20
|
# Primary module for this gem
|
20
21
|
module RubyRabbitmqJanus
|
@@ -43,8 +44,6 @@ module RubyRabbitmqJanus
|
|
43
44
|
# => #<RubyRabbitmqJanus::RRJ:0x007 @session=123>
|
44
45
|
def initialize
|
45
46
|
@option = Tools::Option.new
|
46
|
-
rescue => exception
|
47
|
-
raise Errors::RRJ::InstanciateGem, exception
|
48
47
|
end
|
49
48
|
|
50
49
|
# Create a transaction between Apps and Janus in queue public
|
@@ -173,10 +172,8 @@ module RubyRabbitmqJanus
|
|
173
172
|
# Warning: All data in database and Janus Instance is delete
|
174
173
|
#
|
175
174
|
# @since 2.1.0
|
176
|
-
def cleanup_connection
|
175
|
+
def cleanup_connection!
|
177
176
|
Models::JanusInstance.destroys
|
178
|
-
rescue
|
179
|
-
raise Errors::RRJ::CleanupConnection
|
180
177
|
end
|
181
178
|
|
182
179
|
private
|
data/lib/rrj/janus/janus.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rrj/janus/messages/message'
|
4
|
-
require 'rrj/janus/responses/response'
|
5
4
|
require 'rrj/janus/transactions/transaction'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
require 'rrj/janus/responses/response'
|
7
|
+
require 'rrj/janus/responses/standard'
|
8
|
+
require 'rrj/janus/responses/admin'
|
9
|
+
require 'rrj/janus/responses/error'
|
10
|
+
require 'rrj/janus/responses/event'
|
11
|
+
require 'rrj/janus/responses/rspec'
|
@@ -9,15 +9,11 @@ module RubyRabbitmqJanus
|
|
9
9
|
class Admin < Message
|
10
10
|
def initialize(template_request, options = {})
|
11
11
|
super(template_request, options)
|
12
|
-
rescue
|
13
|
-
raise Errors::Janus::MessageAdmin::Initializer
|
14
12
|
end
|
15
13
|
|
16
14
|
# Return options to message for rabbitmq
|
17
15
|
def options
|
18
|
-
properties.options_admin
|
19
|
-
rescue
|
20
|
-
raise Errors::Janus::MessageAdmin::Options
|
16
|
+
properties.options_admin
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
@@ -47,8 +47,6 @@ module RubyRabbitmqJanus
|
|
47
47
|
@properties = Rabbit::Propertie.new(options['instance'])
|
48
48
|
load_request_file
|
49
49
|
prepare_request(options)
|
50
|
-
rescue
|
51
|
-
raise Errors::Janus::Message::Initializer
|
52
50
|
end
|
53
51
|
|
54
52
|
# Return request to json format
|
@@ -56,8 +54,6 @@ module RubyRabbitmqJanus
|
|
56
54
|
# @return [String] Request to JSON format
|
57
55
|
def to_json(*_args)
|
58
56
|
@request.to_json
|
59
|
-
rescue
|
60
|
-
raise Errors::Janus::Message::ToJson
|
61
57
|
end
|
62
58
|
|
63
59
|
# Return request to json format with nice format
|
@@ -65,8 +61,6 @@ module RubyRabbitmqJanus
|
|
65
61
|
# @return [String] Request to JSON format with indent
|
66
62
|
def to_nice_json
|
67
63
|
JSON.pretty_generate to_hash
|
68
|
-
rescue
|
69
|
-
raise Errors::Janus::Message::ToNiceJson
|
70
64
|
end
|
71
65
|
|
72
66
|
# Return request to hash format
|
@@ -74,8 +68,6 @@ module RubyRabbitmqJanus
|
|
74
68
|
# @return [Hash] Request to Hash format
|
75
69
|
def to_hash
|
76
70
|
@request
|
77
|
-
rescue
|
78
|
-
raise Errors::Janus::Message::ToHash
|
79
71
|
end
|
80
72
|
|
81
73
|
# Return correlation to message
|
@@ -83,8 +75,6 @@ module RubyRabbitmqJanus
|
|
83
75
|
# @return [String] Correlation string
|
84
76
|
def correlation
|
85
77
|
@properties.correlation
|
86
|
-
rescue
|
87
|
-
raise Errors::Janus::Message::Correlation
|
88
78
|
end
|
89
79
|
|
90
80
|
private
|
@@ -9,15 +9,11 @@ module RubyRabbitmqJanus
|
|
9
9
|
class Standard < Message
|
10
10
|
def initialize(template_request, options = {})
|
11
11
|
super(template_request, options)
|
12
|
-
rescue
|
13
|
-
raise Errors::Janus::MessageStandard::Initializer
|
14
12
|
end
|
15
13
|
|
16
14
|
# Return options to message for rabbitmq
|
17
15
|
def options
|
18
16
|
properties.options
|
19
|
-
rescue
|
20
|
-
raise Errors::Janus::MessageStandard::Options
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
@@ -4,32 +4,73 @@ module RubyRabbitmqJanus
|
|
4
4
|
module Janus
|
5
5
|
module Responses
|
6
6
|
# Response for admin request
|
7
|
+
#
|
8
|
+
# @see Example request response https://janus.conf.meetecho.com/docs/admin.html
|
7
9
|
class Admin < Standard
|
8
10
|
# List of sessions running in Janus Instance.
|
9
11
|
#
|
10
12
|
# @return [Array] List of sessions
|
11
13
|
def sessions
|
12
|
-
|
13
|
-
rescue
|
14
|
-
raise Errors::Janus::ResponseAdmin::Sessions
|
14
|
+
read_data(__method__.to_s)
|
15
15
|
end
|
16
16
|
|
17
17
|
# List of handles running in one session in Janus Instance.
|
18
18
|
#
|
19
19
|
# @return [Array] List of handles
|
20
20
|
def handles
|
21
|
-
|
22
|
-
rescue
|
23
|
-
raise Errors::Janus::ResponseAdmin::Handles
|
21
|
+
read_data(__method__.to_s)
|
24
22
|
end
|
25
23
|
|
26
24
|
# Info to session or handle in Janus Instance
|
27
25
|
#
|
28
26
|
# @return [Hash] Information to session/handle
|
29
27
|
def info
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
read_data(__method__.to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
def libnice_debug
|
32
|
+
read_data(__method__.to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
def locking_debug
|
36
|
+
read_data(__method__.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
def log_colors
|
40
|
+
read_data(__method__.to_s)
|
41
|
+
end
|
42
|
+
|
43
|
+
def level
|
44
|
+
read_data(__method__.to_s)
|
45
|
+
end
|
46
|
+
|
47
|
+
def log_timestamps
|
48
|
+
read_data(__method__.to_s)
|
49
|
+
end
|
50
|
+
|
51
|
+
def max_nack_queue
|
52
|
+
read_data(__method__.to_s)
|
53
|
+
end
|
54
|
+
|
55
|
+
def no_media_timer
|
56
|
+
read_data(__method__.to_s)
|
57
|
+
end
|
58
|
+
|
59
|
+
def timeout
|
60
|
+
read_data(__method__.to_s)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def read_data(key)
|
66
|
+
raise build_exception(key) unless key?(key)
|
67
|
+
|
68
|
+
request[key]
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_exception(key)
|
72
|
+
"RubyRabbitmqJanus::Errors::Janus::Responses::Admin::#{key.camelize}"
|
73
|
+
.constantize
|
33
74
|
end
|
34
75
|
end
|
35
76
|
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Metrics/LineLength
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
module Janus
|
7
|
+
module Responses
|
8
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
9
|
+
#
|
10
|
+
# @since 3.0.0
|
11
|
+
#
|
12
|
+
# Manage exception to response Janus
|
13
|
+
class Errors
|
14
|
+
# Unauthorized (can only happen when using apisecret/auth token)
|
15
|
+
def _403(request)
|
16
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::Unauthorized, request
|
17
|
+
end
|
18
|
+
|
19
|
+
# Unauthorized access to a plugin (can only
|
20
|
+
# happen when using auth token)
|
21
|
+
def _405(request)
|
22
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::UnauthorizedPlugin, request
|
23
|
+
end
|
24
|
+
|
25
|
+
# Transport related error
|
26
|
+
def _450(request)
|
27
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::TransportSpecific, request
|
28
|
+
end
|
29
|
+
|
30
|
+
# The request is missing in the message
|
31
|
+
def _452(request)
|
32
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::MissingRequest, request
|
33
|
+
end
|
34
|
+
|
35
|
+
# The Janus core does not suppurt this request
|
36
|
+
def _453(request)
|
37
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::UnknownRequest, request
|
38
|
+
end
|
39
|
+
|
40
|
+
# The payload is not a valid JSON message
|
41
|
+
def _454(request)
|
42
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::InvalidJSON, request
|
43
|
+
end
|
44
|
+
|
45
|
+
# The object is not a valid JSON object as expected
|
46
|
+
def _455(request)
|
47
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::InvalidJSONObject, request
|
48
|
+
end
|
49
|
+
|
50
|
+
# A mandatory element is missing in the message
|
51
|
+
def _456(request)
|
52
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::MissingMandatoryElement, request
|
53
|
+
end
|
54
|
+
|
55
|
+
# The request cannot be handled for this webserver path
|
56
|
+
def _457(request)
|
57
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::InvalidRequestPath, request
|
58
|
+
end
|
59
|
+
|
60
|
+
# The session the request refers to doesn't exist
|
61
|
+
def _458(request)
|
62
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::SessionNotFound, request
|
63
|
+
end
|
64
|
+
|
65
|
+
# The handle the request refers to doesn't exist
|
66
|
+
def _459(request)
|
67
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::HandleNotFound, request
|
68
|
+
end
|
69
|
+
|
70
|
+
# The plugin the request wants to talk to doesn't exist
|
71
|
+
def _460(request)
|
72
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::PluginNotFound, request
|
73
|
+
end
|
74
|
+
|
75
|
+
# An error occurring when trying to attach to
|
76
|
+
# a plugin and create a handle
|
77
|
+
def _461(request)
|
78
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::PluginAttach, request
|
79
|
+
end
|
80
|
+
|
81
|
+
# An error occurring when trying to send a message/request to the plugin
|
82
|
+
def _462(request)
|
83
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::PluginMessage, request
|
84
|
+
end
|
85
|
+
|
86
|
+
# brief An error occurring when trying to detach from
|
87
|
+
# a plugin and destroy the related handle
|
88
|
+
def _463(request)
|
89
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::PluginDetach, request
|
90
|
+
end
|
91
|
+
|
92
|
+
# The Janus core doesn't support this SDP type
|
93
|
+
def _464(request)
|
94
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::JSEPUnknownType, request
|
95
|
+
end
|
96
|
+
|
97
|
+
# The Session Description provided by the peer is invalid
|
98
|
+
def _465(request)
|
99
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::JSEPInvalidSDP, request
|
100
|
+
end
|
101
|
+
|
102
|
+
# The stream a trickle candidate for does not exist or is invalid
|
103
|
+
def _466(request)
|
104
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::TrickleInvalidStream, request
|
105
|
+
end
|
106
|
+
|
107
|
+
# A JSON element is of the wrong type
|
108
|
+
# (e.g., an integer instead of a string)
|
109
|
+
def _467(request)
|
110
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::InvalidElementType, request
|
111
|
+
end
|
112
|
+
|
113
|
+
# The ID provided to create a new session is already in use
|
114
|
+
def _468(request)
|
115
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::SessionConflit, request
|
116
|
+
end
|
117
|
+
|
118
|
+
# We got an ANSWER to an OFFER we never made
|
119
|
+
def _469(request)
|
120
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::UnexpectedAnswer, request
|
121
|
+
end
|
122
|
+
|
123
|
+
# The auth token the request refers to doesn't exist
|
124
|
+
def _470(request)
|
125
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::TokenNotFound, request
|
126
|
+
end
|
127
|
+
|
128
|
+
# The current request cannot be handled because
|
129
|
+
# of not compatible WebRTC state
|
130
|
+
def _471(request)
|
131
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::WebRTCState, request
|
132
|
+
end
|
133
|
+
|
134
|
+
# The server is currently configured not to accept new sessions
|
135
|
+
def _472(request)
|
136
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::NotAcceptingSession, request
|
137
|
+
end
|
138
|
+
|
139
|
+
# Unknown/undocumented error
|
140
|
+
def _490(request)
|
141
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::Unknown, request
|
142
|
+
end
|
143
|
+
|
144
|
+
def respond_to_missing?(name, include_private); end
|
145
|
+
|
146
|
+
# rubocop:disable Style/MethodMissingSuper
|
147
|
+
def method_missing(_method, request)
|
148
|
+
default_error(request)
|
149
|
+
end
|
150
|
+
# rubocop:enable Style/MethodMissingSuper
|
151
|
+
|
152
|
+
def default_error(request)
|
153
|
+
raise RubyRabbitmqJanus::Errors::Janus::Responses::Nok, request
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
# rubocop:enable Metrics/LineLength
|