oversip 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +10 -11
- data/bin/oversip +10 -27
- data/etc/tls/ca/cacert.pem +717 -718
- data/ext/sip_parser/common_headers.h +1 -0
- data/ext/sip_parser/sip_message_parser.c +43 -42
- data/ext/sip_parser/sip_parser_ruby.c +10 -0
- data/ext/utils/ip_utils.h +2 -0
- data/ext/utils/utils_ruby.h +2 -1
- data/ext/websocket_framing_utils/ws_framing_utils.h +2 -1
- data/ext/websocket_framing_utils/ws_framing_utils_ruby.c +1 -1
- data/lib/oversip/config.rb +6 -6
- data/lib/oversip/default_server.rb +0 -10
- data/lib/oversip/launcher.rb +29 -67
- data/lib/oversip/logger.rb +29 -108
- data/lib/oversip/sip/launcher.rb +7 -7
- data/lib/oversip/syslog.rb +22 -12
- data/lib/oversip/version.rb +5 -5
- data/lib/oversip/websocket/launcher.rb +7 -7
- data/lib/oversip.rb +61 -15
- data/test/oversip_test_helper.rb +0 -1
- metadata +154 -215
- data/lib/oversip/master_process.rb +0 -67
- data/lib/oversip/posix_mq.rb +0 -126
- data/lib/oversip/ruby_ext/process.rb +0 -9
- data/lib/oversip/syslogger_process.rb +0 -80
data/lib/oversip/launcher.rb
CHANGED
@@ -30,15 +30,15 @@ module OverSIP::Launcher
|
|
30
30
|
if grandparent == $$
|
31
31
|
# Master process will inmediatelly write in the ready_pipe its PID so we get
|
32
32
|
# its PID.
|
33
|
-
|
33
|
+
pid = nil
|
34
34
|
begin
|
35
35
|
::Timeout.timeout(READY_PIPE_TIMEOUT/2) do
|
36
|
-
|
36
|
+
pid = rd.gets("\n").to_i rescue nil
|
37
37
|
end
|
38
38
|
rescue ::Timeout::Error
|
39
39
|
fatal "master process didn't notify its PID within #{READY_PIPE_TIMEOUT/2} seconds"
|
40
40
|
end
|
41
|
-
unless
|
41
|
+
unless pid
|
42
42
|
fatal "master process failed to start"
|
43
43
|
end
|
44
44
|
|
@@ -56,14 +56,14 @@ module OverSIP::Launcher
|
|
56
56
|
rescue ::Timeout::Error
|
57
57
|
log_system_crit "master process is not ready within #{READY_PIPE_TIMEOUT/2} seconds, killing it..."
|
58
58
|
begin
|
59
|
-
::Process.kill(:TERM,
|
59
|
+
::Process.kill(:TERM, pid)
|
60
60
|
10.times do |i|
|
61
61
|
sleep 0.05
|
62
|
-
::Process.wait(
|
63
|
-
::Process.kill(0,
|
62
|
+
::Process.wait(pid, ::Process::WNOHANG) rescue nil
|
63
|
+
::Process.kill(0, pid) rescue break
|
64
64
|
end
|
65
|
-
::Process.kill(0,
|
66
|
-
::Process.kill(:KILL,
|
65
|
+
::Process.kill(0, pid)
|
66
|
+
::Process.kill(:KILL, pid) rescue nil
|
67
67
|
rescue ::Errno::ESRCH
|
68
68
|
end
|
69
69
|
fatal "master process killed"
|
@@ -88,7 +88,7 @@ module OverSIP::Launcher
|
|
88
88
|
configuration = ::OverSIP.configuration
|
89
89
|
|
90
90
|
# Store the master process PID.
|
91
|
-
::OverSIP.
|
91
|
+
::OverSIP.pid = $$
|
92
92
|
|
93
93
|
begin
|
94
94
|
# Inmediatelly write into the ready_pipe so grandparent process reads it
|
@@ -96,31 +96,13 @@ module OverSIP::Launcher
|
|
96
96
|
ready_pipe = options.delete(:ready_pipe)
|
97
97
|
ready_pipe.write($$.to_s + "\n") if ready_pipe
|
98
98
|
|
99
|
-
#
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
::OverSIP::TLS.module_init
|
108
|
-
::OverSIP::SIP.module_init
|
109
|
-
::OverSIP::SIP::RFC3263.module_init
|
110
|
-
::OverSIP::WebSocket.module_init
|
111
|
-
::OverSIP::WebSocket::WsFraming.class_init
|
112
|
-
::OverSIP::WebSocket::WsSipApp.class_init
|
113
|
-
|
114
|
-
# I'm the syslogger process.
|
115
|
-
else
|
116
|
-
# Close the pipe in the syslogger process.
|
117
|
-
ready_pipe.close rescue nil
|
118
|
-
ready_pipe = nil
|
119
|
-
|
120
|
-
require "oversip/syslogger_process.rb"
|
121
|
-
::OverSIP::SysLoggerProcess.run options
|
122
|
-
exit
|
123
|
-
end
|
99
|
+
# Init modules.
|
100
|
+
::OverSIP::TLS.module_init
|
101
|
+
::OverSIP::SIP.module_init
|
102
|
+
::OverSIP::SIP::RFC3263.module_init
|
103
|
+
::OverSIP::WebSocket.module_init
|
104
|
+
::OverSIP::WebSocket::WsFraming.class_init
|
105
|
+
::OverSIP::WebSocket::WsSipApp.class_init
|
124
106
|
|
125
107
|
@log_id = "launcher (master)"
|
126
108
|
|
@@ -152,7 +134,7 @@ module OverSIP::Launcher
|
|
152
134
|
::Fiber.new do
|
153
135
|
|
154
136
|
# Run OverSIP::SystemEvents.on_initialize.
|
155
|
-
|
137
|
+
log_system_debug "calling OverSIP::SystemEvents.on_initialize() method..."
|
156
138
|
begin
|
157
139
|
::OverSIP::SystemEvents.on_initialize
|
158
140
|
rescue ::Exception => e
|
@@ -161,7 +143,7 @@ module OverSIP::Launcher
|
|
161
143
|
end
|
162
144
|
|
163
145
|
# Run all the OverSIP::SystemCallbacks.on_started_callbacks.
|
164
|
-
|
146
|
+
log_system_debug "executing OverSIP::SystemCallbacks.on_started_callbacks..."
|
165
147
|
::OverSIP::SystemCallbacks.on_started_callbacks.each do |cb|
|
166
148
|
begin
|
167
149
|
cb.call
|
@@ -172,7 +154,7 @@ module OverSIP::Launcher
|
|
172
154
|
end
|
173
155
|
|
174
156
|
# Run OverSIP::SystemEvents.on_started within a fiber.
|
175
|
-
|
157
|
+
log_system_debug "calling OverSIP::SystemEvents.on_started() method..."
|
176
158
|
begin
|
177
159
|
::OverSIP::SystemEvents.on_started
|
178
160
|
rescue ::Exception => e
|
@@ -180,7 +162,6 @@ module OverSIP::Launcher
|
|
180
162
|
fatal e
|
181
163
|
end
|
182
164
|
|
183
|
-
log_system_notice "master process (PID #{$$}) ready"
|
184
165
|
log_system_notice "#{::OverSIP::PROGRAM_NAME} #{::OverSIP::VERSION} running in background"
|
185
166
|
|
186
167
|
# Write "ok" into the ready_pipe so grandparent process (launcher)
|
@@ -195,7 +176,8 @@ module OverSIP::Launcher
|
|
195
176
|
$stdout.reopen("/dev/null")
|
196
177
|
$stderr.reopen("/dev/null")
|
197
178
|
::OverSIP.daemonized = true
|
198
|
-
|
179
|
+
|
180
|
+
# So update the logger to stop writting into stdout.
|
199
181
|
::OverSIP::Logger.load_methods
|
200
182
|
|
201
183
|
# Set the EventMachine error handler.
|
@@ -458,12 +440,15 @@ module OverSIP::Launcher
|
|
458
440
|
log_system_notice "#{signal.to_s.upcase} signal received, ignored"
|
459
441
|
end
|
460
442
|
rescue ::ArgumentError
|
461
|
-
|
443
|
+
log_system_debug "cannot trap signal #{signal.to_s.upcase}, it could not exist in this system, ignoring it"
|
462
444
|
end
|
463
445
|
end
|
464
446
|
|
465
|
-
#
|
466
|
-
|
447
|
+
# Ruby 2.0 does not allow trapping VTALRM signal. For other cases ignore it.
|
448
|
+
begin
|
449
|
+
trap :VTALRM do
|
450
|
+
end
|
451
|
+
rescue ::ArgumentError
|
467
452
|
end
|
468
453
|
|
469
454
|
# Signal HUP reloads OverSIP system configuration.
|
@@ -554,12 +539,6 @@ module OverSIP::Launcher
|
|
554
539
|
kill_stud_processes
|
555
540
|
::File.delete ::OverSIP.configuration[:tls][:full_cert] rescue nil
|
556
541
|
|
557
|
-
# Wait a bit so pending log messages in the Posix MQ can be queued.
|
558
|
-
sleep 0.1
|
559
|
-
::OverSIP::Logger.close
|
560
|
-
|
561
|
-
kill_syslogger_process
|
562
|
-
|
563
542
|
delete_pid_file
|
564
543
|
|
565
544
|
# Exit by preventing any exception.
|
@@ -570,29 +549,12 @@ module OverSIP::Launcher
|
|
570
549
|
|
571
550
|
|
572
551
|
def self.delete_pid_file
|
573
|
-
return false unless ::OverSIP.
|
552
|
+
return false unless ::OverSIP.pid
|
574
553
|
|
575
554
|
::File.delete(::OverSIP.pid_file) rescue nil
|
576
555
|
end
|
577
556
|
|
578
557
|
|
579
|
-
def self.kill_syslogger_process
|
580
|
-
return false unless ::OverSIP.master_pid
|
581
|
-
|
582
|
-
begin
|
583
|
-
::Process.kill(:TERM, ::OverSIP.syslogger_pid)
|
584
|
-
10.times do |i|
|
585
|
-
sleep 0.05
|
586
|
-
::Process.wait(::OverSIP.syslogger_pid, ::Process::WNOHANG) rescue nil
|
587
|
-
::Process.kill(0, ::OverSIP.syslogger_pid) rescue break
|
588
|
-
end
|
589
|
-
::Process.kill(0, ::OverSIP.syslogger_pid)
|
590
|
-
::Process.kill(:KILL, ::OverSIP.syslogger_pid) rescue nil
|
591
|
-
rescue ::Errno::ESRCH
|
592
|
-
end
|
593
|
-
end
|
594
|
-
|
595
|
-
|
596
558
|
def self.set_user_group user, group
|
597
559
|
uid = ::Etc.getpwnam(user).uid if user
|
598
560
|
gid = ::Etc.getgrnam(group).gid if group
|
@@ -651,7 +613,7 @@ module OverSIP::Launcher
|
|
651
613
|
|
652
614
|
|
653
615
|
def self.kill_stud_processes
|
654
|
-
return false unless ::OverSIP.
|
616
|
+
return false unless ::OverSIP.pid
|
655
617
|
return false unless ::OverSIP.stud_pids
|
656
618
|
|
657
619
|
::OverSIP.stud_pids.each do |pid|
|
data/lib/oversip/logger.rb
CHANGED
@@ -1,30 +1,16 @@
|
|
1
1
|
module OverSIP
|
2
2
|
|
3
3
|
# Logging client module. Any class desiring to log messages must include (or extend) this module.
|
4
|
-
# In order to identify itself in the logs, the class can define
|
4
|
+
# In order to identify itself in the logs, the class can define log_id() method or set @log_id
|
5
5
|
# attribute.
|
6
6
|
module Logger
|
7
7
|
|
8
|
-
def self.init_logger_mq group=nil
|
9
|
-
@@logger_mq = ::OverSIP::PosixMQ.create_queue({
|
10
|
-
:name => ::OverSIP.syslogger_mq_name,
|
11
|
-
:mode => :write,
|
12
|
-
:maxmsg => 1000,
|
13
|
-
:msgsize => 2000,
|
14
|
-
:group => group
|
15
|
-
})
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
8
|
def self.load_methods
|
20
|
-
|
21
|
-
if not ::OverSIP.daemonized?
|
22
|
-
::Syslog.close if ::Syslog.opened?
|
9
|
+
::Syslog.close if ::Syslog.opened?
|
23
10
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
11
|
+
syslog_options = ::Syslog::LOG_PID | ::Syslog::LOG_NDELAY
|
12
|
+
syslog_facility = ::OverSIP::Syslog::SYSLOG_FACILITY_MAPPING[::OverSIP.configuration[:core][:syslog_facility]] rescue ::Syslog::LOG_DAEMON
|
13
|
+
::Syslog.open(::OverSIP.master_name, syslog_options, syslog_facility)
|
28
14
|
|
29
15
|
begin
|
30
16
|
@@threshold = ::OverSIP::Syslog::SYSLOG_SEVERITY_MAPPING[::OverSIP.configuration[:core][:syslog_level]]
|
@@ -34,46 +20,25 @@ module OverSIP
|
|
34
20
|
|
35
21
|
$oversip_debug = ( @@threshold == 0 ? true : false )
|
36
22
|
|
37
|
-
|
38
|
-
|
39
|
-
::OverSIP::Syslog::SYSLOG_SEVERITY_MAPPING.each do |level, level_value|
|
23
|
+
::OverSIP::Syslog::SYSLOG_SEVERITY_MAPPING.each do |level_str, level_value|
|
40
24
|
method_str = "
|
41
|
-
def log_system_#{
|
25
|
+
def log_system_#{level_str}(msg)
|
42
26
|
"
|
43
27
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@@congested = true
|
50
|
-
::EM.add_timer(1) do
|
51
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_system_msg2str(4, \"logger message queue was full, some logs have been lost\", log_id), 1
|
52
|
-
@@congested = false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
rescue ::Errno::EMSGSIZE
|
56
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_system_msg2str(4, \"too long message could not be logged\", log_id), 1 rescue nil
|
57
|
-
rescue ::Exception => e
|
58
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_system_msg2str(4, \"unexpected logging error (\#{e.class}: \#{e.message})\", log_id), 1 rescue nil
|
59
|
-
end
|
60
|
-
"
|
61
|
-
end
|
28
|
+
method_str << "
|
29
|
+
return false if @@threshold > #{level_value}
|
30
|
+
|
31
|
+
::OverSIP::Syslog.log #{level_value}, msg, log_id, false
|
32
|
+
"
|
62
33
|
|
63
34
|
if not ::OverSIP.daemonized?
|
64
|
-
if %w{debug info notice}.include?
|
35
|
+
if %w{debug info notice}.include? level_str
|
65
36
|
method_str << "
|
66
|
-
puts ::OverSIP::Logger.fg_system_msg2str('#{
|
67
|
-
|
68
|
-
::OverSIP::Syslog.log ::OverSIP::Logger.syslog_system_msg2str(#{level_value}, msg, log_id)
|
69
|
-
end
|
70
|
-
"
|
37
|
+
puts ::OverSIP::Logger.fg_system_msg2str('#{level_str}', msg, log_id)
|
38
|
+
"
|
71
39
|
else
|
72
40
|
method_str << "
|
73
|
-
$stderr.puts ::OverSIP::Logger.fg_system_msg2str('#{
|
74
|
-
if not ::OverSIP.syslogger_ready?
|
75
|
-
::OverSIP::Syslog.log ::OverSIP::Logger.syslog_system_msg2str(#{level_value}, msg, log_id)
|
76
|
-
end
|
41
|
+
$stderr.puts ::OverSIP::Logger.fg_system_msg2str('#{level_str}', msg, log_id)
|
77
42
|
"
|
78
43
|
end
|
79
44
|
end
|
@@ -83,75 +48,31 @@ module OverSIP
|
|
83
48
|
self.module_eval method_str
|
84
49
|
|
85
50
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
return false if @@threshold > #{level_value} || @@congested
|
91
|
-
begin
|
92
|
-
unless @@logger_mq.trysend ::OverSIP::Logger.syslog_user_msg2str(#{level_value}, msg, log_id), 0
|
93
|
-
@@congested = true
|
94
|
-
::EM.add_timer(1) do
|
95
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_user_msg2str(4, \"logger message queue was full, some logs have been lost\", log_id), 1
|
96
|
-
@@congested = false
|
97
|
-
end
|
98
|
-
end
|
99
|
-
rescue ::Errno::EMSGSIZE
|
100
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_user_msg2str(4, \"too long message could not be logged\", log_id), 1 rescue nil
|
101
|
-
rescue ::Exception => e
|
102
|
-
@@logger_mq.trysend ::OverSIP::Logger.syslog_user_msg2str(4, \"unexpected logging error (\#{e.class}: \#{e.message})\", log_id), 1 rescue nil
|
103
|
-
end
|
104
|
-
end
|
105
|
-
"
|
106
|
-
|
107
|
-
self.module_eval method_str
|
108
|
-
end
|
51
|
+
# User logs.
|
52
|
+
method_str = "
|
53
|
+
def log_#{level_str}(msg)
|
54
|
+
return false if @@threshold > #{level_value}
|
109
55
|
|
110
|
-
|
111
|
-
|
56
|
+
::OverSIP::Syslog.log #{level_value}, msg, log_id, true
|
57
|
+
end
|
58
|
+
"
|
112
59
|
|
113
|
-
|
114
|
-
# - level_value: Integer representing the log level.
|
115
|
-
# - msg: the String or Exception to be logged.
|
116
|
-
# - log_id: a String helping to identify the generator of this log message.
|
117
|
-
def self.syslog_system_msg2str(level_value, msg, log_id)
|
118
|
-
case msg
|
119
|
-
when ::String
|
120
|
-
level_value.to_s << "<" << log_id << "> " << msg
|
121
|
-
when ::Exception
|
122
|
-
"#{level_value}<#{log_id}> #{msg.message} (#{msg.class })\n#{(msg.backtrace || [])[0..3].join("\n")}"
|
123
|
-
else
|
124
|
-
level_value.to_s << "<" << log_id << "> " << msg.inspect
|
125
|
-
end
|
126
|
-
end
|
60
|
+
self.module_eval method_str
|
127
61
|
|
128
|
-
|
129
|
-
case msg
|
130
|
-
when ::String
|
131
|
-
level_value.to_s << "<" << log_id << "> [user] " << msg
|
132
|
-
when ::Exception
|
133
|
-
"#{level_value}<#{log_id}> [user] #{msg.message} (#{msg.class })\n#{(msg.backtrace || [])[0..3].join("\n")}"
|
134
|
-
else
|
135
|
-
level_value.to_s << "<" << log_id << "> [user] " << msg.inspect
|
136
|
-
end
|
62
|
+
end # .each
|
137
63
|
end
|
138
64
|
|
139
|
-
def self.fg_system_msg2str(
|
65
|
+
def self.fg_system_msg2str(level_str, msg, log_id)
|
140
66
|
case msg
|
141
67
|
when ::String
|
142
|
-
"#{
|
68
|
+
"#{level_str.upcase}: <#{log_id}> " << msg
|
143
69
|
when ::Exception
|
144
|
-
"#{
|
70
|
+
"#{level_str.upcase}: <#{log_id}> #{msg.message} (#{msg.class })\n#{(msg.backtrace || [])[0..3].join("\n")}"
|
145
71
|
else
|
146
|
-
"#{
|
72
|
+
"#{level_str.upcase}: <#{log_id}> " << msg.inspect
|
147
73
|
end
|
148
74
|
end
|
149
75
|
|
150
|
-
def self.close
|
151
|
-
@@logger_mq.close rescue nil
|
152
|
-
@@logger_mq.unlink rescue nil
|
153
|
-
end
|
154
|
-
|
155
76
|
# Default logging identifier is the class name. If log_id() method is redefined by the
|
156
77
|
# class including this module, or it sets @log_id, then such a value takes preference.
|
157
78
|
def log_id
|
data/lib/oversip/sip/launcher.rb
CHANGED
@@ -101,7 +101,7 @@ module OverSIP::SIP
|
|
101
101
|
if enabled
|
102
102
|
::EM.start_server(ip, port, klass) do |conn|
|
103
103
|
conn.post_connection
|
104
|
-
conn.set_comm_inactivity_timeout
|
104
|
+
conn.set_comm_inactivity_timeout 7200
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -119,7 +119,7 @@ module OverSIP::SIP
|
|
119
119
|
if enabled
|
120
120
|
::EM.start_server(ip, port, klass) do |conn|
|
121
121
|
conn.post_connection
|
122
|
-
conn.set_comm_inactivity_timeout
|
122
|
+
conn.set_comm_inactivity_timeout 7200
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -139,7 +139,7 @@ module OverSIP::SIP
|
|
139
139
|
if enabled
|
140
140
|
::EM.start_server(ip, port, klass) do |conn|
|
141
141
|
conn.post_connection
|
142
|
-
conn.set_comm_inactivity_timeout
|
142
|
+
conn.set_comm_inactivity_timeout 7200
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
@@ -159,7 +159,7 @@ module OverSIP::SIP
|
|
159
159
|
if enabled
|
160
160
|
::EM.start_server(ip, port, klass) do |conn|
|
161
161
|
conn.post_connection
|
162
|
-
conn.set_comm_inactivity_timeout
|
162
|
+
conn.set_comm_inactivity_timeout 7200
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -179,7 +179,7 @@ module OverSIP::SIP
|
|
179
179
|
if enabled
|
180
180
|
::EM.start_server(ip, port, klass) do |conn|
|
181
181
|
conn.post_connection
|
182
|
-
conn.set_comm_inactivity_timeout
|
182
|
+
conn.set_comm_inactivity_timeout 7200
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -199,7 +199,7 @@ module OverSIP::SIP
|
|
199
199
|
if enabled
|
200
200
|
::EM.start_server(ip, port, klass) do |conn|
|
201
201
|
conn.post_connection
|
202
|
-
conn.set_comm_inactivity_timeout
|
202
|
+
conn.set_comm_inactivity_timeout 7200
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -218,4 +218,4 @@ module OverSIP::SIP
|
|
218
218
|
|
219
219
|
end
|
220
220
|
|
221
|
-
end
|
221
|
+
end
|
data/lib/oversip/syslog.rb
CHANGED
@@ -27,26 +27,36 @@ module OverSIP
|
|
27
27
|
"emerg" => 7
|
28
28
|
}
|
29
29
|
|
30
|
-
def self.log
|
31
|
-
|
32
|
-
msg = string[1..-1].gsub(/%/,"%%").gsub(/\x00/,"")
|
30
|
+
def self.log level_value, msg, log_id, user
|
31
|
+
user = user ? " [user] " : " "
|
33
32
|
|
34
|
-
case
|
35
|
-
when
|
33
|
+
msg = case msg
|
34
|
+
when ::String
|
35
|
+
"<#{log_id}>#{user}#{msg}"
|
36
|
+
when ::Exception
|
37
|
+
"<#{log_id}>#{user}#{msg.message} (#{msg.class })\n#{(msg.backtrace || [])[0..3].join("\n")}"
|
38
|
+
else
|
39
|
+
"<#{log_id}>#{user}#{msg.inspect}"
|
40
|
+
end
|
41
|
+
|
42
|
+
msg = msg.gsub(/%/,"%%").gsub(/\x00/,"")
|
43
|
+
|
44
|
+
case level_value
|
45
|
+
when 0
|
36
46
|
::Syslog.debug sprintf("%7s %s", "DEBUG:", msg)
|
37
|
-
when
|
47
|
+
when 1
|
38
48
|
::Syslog.info sprintf("%7s %s", "INFO:", msg)
|
39
|
-
when
|
49
|
+
when 2
|
40
50
|
::Syslog.notice sprintf("%7s %s", "NOTICE:", msg)
|
41
|
-
when
|
51
|
+
when 3
|
42
52
|
::Syslog.warning sprintf("%7s %s", "WARN:", msg)
|
43
|
-
when
|
53
|
+
when 4
|
44
54
|
::Syslog.err sprintf("%7s %s", "ERROR:", msg)
|
45
|
-
when
|
55
|
+
when 5
|
46
56
|
::Syslog.crit sprintf("%7s %s", "CRIT:", msg)
|
47
|
-
when
|
57
|
+
when 6
|
48
58
|
::Syslog.alert sprintf("%7s %s", "ALERT:", msg)
|
49
|
-
when
|
59
|
+
when 7
|
50
60
|
::Syslog.emerg sprintf("%7s %s", "EMERG:", msg)
|
51
61
|
else # Shouldn't occur.
|
52
62
|
::Syslog.err sprintf("%7s %s", "UNKNOWN:", msg)
|
data/lib/oversip/version.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module OverSIP
|
4
4
|
|
5
5
|
module Version
|
6
|
-
MAJOR =
|
7
|
-
MINOR =
|
8
|
-
TINY =
|
6
|
+
MAJOR = 2
|
7
|
+
MINOR = 0
|
8
|
+
TINY = 0
|
9
9
|
DEVEL = nil # Set to nil for stable releases.
|
10
10
|
end
|
11
11
|
|
@@ -15,7 +15,7 @@ module OverSIP
|
|
15
15
|
AUTHOR = "Inaki Baz Castillo"
|
16
16
|
AUTHOR_EMAIL = "ibc@aliax.net"
|
17
17
|
HOMEPAGE = "http://www.oversip.net"
|
18
|
-
year = "2012-
|
19
|
-
DESCRIPTION = "#{PROGRAM_NAME} #{VERSION}\n#{HOMEPAGE}\n#{year}, #{AUTHOR} <#{AUTHOR_EMAIL}
|
18
|
+
year = "2012-2014"
|
19
|
+
DESCRIPTION = "#{PROGRAM_NAME} #{VERSION}\n#{HOMEPAGE}\n#{year}, #{AUTHOR} <#{AUTHOR_EMAIL}>"
|
20
20
|
|
21
21
|
end
|
@@ -63,7 +63,7 @@ module OverSIP::WebSocket
|
|
63
63
|
if enabled
|
64
64
|
::EM.start_server(ip, port, klass) do |conn|
|
65
65
|
conn.post_connection
|
66
|
-
conn.set_comm_inactivity_timeout
|
66
|
+
conn.set_comm_inactivity_timeout 7200
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -81,7 +81,7 @@ module OverSIP::WebSocket
|
|
81
81
|
if enabled
|
82
82
|
::EM.start_server(ip, port, klass) do |conn|
|
83
83
|
conn.post_connection
|
84
|
-
conn.set_comm_inactivity_timeout
|
84
|
+
conn.set_comm_inactivity_timeout 7200
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -101,7 +101,7 @@ module OverSIP::WebSocket
|
|
101
101
|
if enabled
|
102
102
|
::EM.start_server(ip, port, klass) do |conn|
|
103
103
|
conn.post_connection
|
104
|
-
conn.set_comm_inactivity_timeout
|
104
|
+
conn.set_comm_inactivity_timeout 7200
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -121,7 +121,7 @@ module OverSIP::WebSocket
|
|
121
121
|
if enabled
|
122
122
|
::EM.start_server(ip, port, klass) do |conn|
|
123
123
|
conn.post_connection
|
124
|
-
conn.set_comm_inactivity_timeout
|
124
|
+
conn.set_comm_inactivity_timeout 7200
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
@@ -141,7 +141,7 @@ module OverSIP::WebSocket
|
|
141
141
|
if enabled
|
142
142
|
::EM.start_server(ip, port, klass) do |conn|
|
143
143
|
conn.post_connection
|
144
|
-
conn.set_comm_inactivity_timeout
|
144
|
+
conn.set_comm_inactivity_timeout 7200
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -161,7 +161,7 @@ module OverSIP::WebSocket
|
|
161
161
|
if enabled
|
162
162
|
::EM.start_server(ip, port, klass) do |conn|
|
163
163
|
conn.post_connection
|
164
|
-
conn.set_comm_inactivity_timeout
|
164
|
+
conn.set_comm_inactivity_timeout 7200
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -180,4 +180,4 @@ module OverSIP::WebSocket
|
|
180
180
|
|
181
181
|
end
|
182
182
|
|
183
|
-
end
|
183
|
+
end
|