oversip 1.0.5 → 1.0.6.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/oversip CHANGED
@@ -2,9 +2,15 @@
2
2
  # -*- encoding: binary -*-
3
3
 
4
4
  unless RUBY_VERSION >= "1.9.2"
5
- raise LoadError, "OverSIP requires Ruby version >= 1.9.2 (current version is #{RUBY_VERSION})"
5
+ raise ::LoadError, "OverSIP requires Ruby version >= 1.9.2 (current version is #{RUBY_VERSION})"
6
6
  end
7
7
 
8
+ # When OverSIP is executed automaticaly via the system init (i.e. after booting the host)
9
+ # the Encoding.default_external is US_ASCII which causes fails when reading daat from
10
+ # some files (i.e. the cacert.pem file which contains no valid US_ASCII symbols). So
11
+ # make the default external encoding UTF-8 right now.
12
+ ::Encoding.default_external = ::Encoding::UTF_8
13
+
8
14
  # First of all, trap some signals in order to ignore them if they arrive while
9
15
  # loading server libraries.
10
16
  [:HUP, :INT, :USR1, :USR2].each {|signal| trap(signal) {} }
@@ -73,7 +79,7 @@ module OverSIP
73
79
  require "posix_mq"
74
80
 
75
81
  begin
76
- POSIX_MQ.unlink value
82
+ ::POSIX_MQ.unlink value
77
83
  rescue ::Errno::ENOENT
78
84
  rescue ::Errno::EACCES => e
79
85
  fatal "cannot remove '#{value}' posix message queue due file permissions"
@@ -141,7 +147,7 @@ module OverSIP
141
147
  end
142
148
 
143
149
  # Ignore user/group if the launcher is not being running as root.
144
- unless Process.euid == 0
150
+ unless ::Process.euid == 0
145
151
  log_system_warn "ignoring user/group parameters when not running as root"
146
152
  options.delete :user
147
153
  options.delete :group
@@ -149,15 +155,15 @@ module OverSIP
149
155
  # Get the uid and gid to run with.
150
156
  if options[:user]
151
157
  begin
152
- Etc.getpwnam options[:user]
153
- rescue ArgumentError
158
+ ::Etc.getpwnam options[:user]
159
+ rescue ::ArgumentError
154
160
  fatal "user '#{options[:user]}' does not exist in the system"
155
161
  end
156
162
  end
157
163
  if options[:group]
158
164
  begin
159
- Etc.getgrnam options[:group]
160
- rescue ArgumentError
165
+ ::Etc.getgrnam options[:group]
166
+ rescue ::ArgumentError
161
167
  fatal "group '#{options[:group]}' does not exist in the system"
162
168
  end
163
169
  end
@@ -170,21 +176,21 @@ module OverSIP
170
176
 
171
177
  # Set the command name (as it appears in "ps" output) to given --process_name option (-p)
172
178
  # or to the script filename otherwise.
173
- $0 = options[:process_name] || File.basename(__FILE__)
179
+ $0 = options[:process_name] || ::File.basename(__FILE__)
174
180
 
175
- OverSIP.master_name = $0
176
- log_system_info "master process name: #{OverSIP.master_name}"
181
+ ::OverSIP.master_name = $0
182
+ log_system_info "master process name: #{::OverSIP.master_name}"
177
183
 
178
- OverSIP::Config.load options[:config_dir], options[:config_file]
184
+ ::OverSIP::Config.load options[:config_dir], options[:config_file]
179
185
  log_system_info "applied configuration:"
180
- OverSIP::Config.print options[:colorize]
186
+ ::OverSIP::Config.print options[:colorize]
181
187
 
182
188
  log_system_info "creating Posix Message Queue for communicating master and syslogger processes"
183
- OverSIP::Logger.init_logger_mq options[:num_instances], options[:group]
184
- OverSIP::Logger.load_methods
189
+ ::OverSIP::Logger.init_logger_mq options[:num_instances], options[:group]
190
+ ::OverSIP::Logger.load_methods
185
191
 
186
- OverSIP::Launcher.daemonize!(options)
187
- OverSIP::Launcher.run(options)
192
+ ::OverSIP::Launcher.daemonize!(options)
193
+ ::OverSIP::Launcher.run(options)
188
194
 
189
195
  end # def run
190
196
  end # class Executable
@@ -313,6 +313,14 @@ module OverSIP
313
313
  @configuration[:websocket][:enable_ipv6] = nil
314
314
  end
315
315
 
316
+ unless @configuration[:websocket][:enable_ipv4]
317
+ @configuration[:websocket][:listen_ipv4] = nil
318
+ end
319
+
320
+ unless @configuration[:websocket][:enable_ipv6]
321
+ @configuration[:websocket][:listen_ipv6] = nil
322
+ end
323
+
316
324
  if ( @use_sip_udp_or_tcp or @use_sip_tls ) and @configuration[:sip][:listen_ipv4] == nil and @configuration[:sip][:enable_ipv4]
317
325
  unless (@configuration[:sip][:listen_ipv4] = discover_local_ip(:ipv4))
318
326
  log_system_warn "dissabling IPv4 for SIP"
@@ -92,7 +92,7 @@ module OverSIP::Launcher
92
92
  ready_pipe.write($$.to_s + "\n") if ready_pipe
93
93
 
94
94
  # I'm master process.
95
- if syslogger_pid = fork
95
+ if (syslogger_pid = fork) != nil
96
96
  ::OverSIP.syslogger_pid = syslogger_pid
97
97
  log_system_info "starting syslogger process (PID #{syslogger_pid})..."
98
98
  ::OverSIP::Logger.load_methods
@@ -55,17 +55,19 @@ module OverSIP
55
55
  # If --num-instances is given, then multiply it by its value.
56
56
  mq_size *= options[:num_instances]
57
57
 
58
- log_system_debug "queue requires #{mq_size} bytes" if $oversip_debug
58
+ log_system_info "queue requires #{mq_size} bytes"
59
59
 
60
60
  # Set RLIMIT_MSGQUEUE (ulimit) in order to create the queue with required
61
61
  # ammount of memory.
62
62
  if ( current_rlimit = ::Process.getrlimit(12)[1] ) < mq_size
63
- log_system_debug "incrementing rlimits (currently #{current_rlimit} bytes) to #{mq_size} bytes (ulimit -q)" if $oversip_debug
63
+ log_system_info "incrementing rlimits for Posix Message Queues (currently #{current_rlimit} bytes) to #{mq_size} bytes (ulimit -q)"
64
64
  begin
65
65
  ::Process.setrlimit(12, mq_size)
66
66
  rescue ::Errno::EPERM
67
67
  fatal "current user has no permissions to increase rlimits to #{mq_size} bytes (ulimit -q)"
68
68
  end
69
+ else
70
+ log_system_info "rlimits for Posix Message Queues is #{current_rlimit} bytes (>= #{mq_size}), no need to increase it"
69
71
  end
70
72
 
71
73
  # Create the Posix message queue to write into it.
@@ -5,8 +5,8 @@ module OverSIP
5
5
  module Version
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 5
9
- DEVEL = nil # Set to nil for stable releases.
8
+ TINY = 6
9
+ DEVEL = "beta1" # Set to nil for stable releases.
10
10
  end
11
11
 
12
12
  PROGRAM_NAME = "OverSIP"
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oversip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
5
- prerelease:
4
+ version: 1.0.6.beta1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Inaki Baz Castillo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-30 00:00:00.000000000 Z
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine-le
16
- requirement: &23702300 !ruby/object:Gem::Requirement
16
+ requirement: &19017300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *23702300
24
+ version_requirements: *19017300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: iobuffer
27
- requirement: &23701840 !ruby/object:Gem::Requirement
27
+ requirement: &19016840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *23701840
35
+ version_requirements: *19016840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-posixmq
38
- requirement: &23701380 !ruby/object:Gem::Requirement
38
+ requirement: &19016380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *23701380
46
+ version_requirements: *19016380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: em-udns
49
- requirement: &23717300 !ruby/object:Gem::Requirement
49
+ requirement: &19032300 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.6
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *23717300
57
+ version_requirements: *19032300
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: escape_utils
60
- requirement: &23716840 !ruby/object:Gem::Requirement
60
+ requirement: &19031840 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.2.4
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *23716840
68
+ version_requirements: *19031840
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: term-ansicolor
71
- requirement: &23716460 !ruby/object:Gem::Requirement
71
+ requirement: &19031460 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *23716460
79
+ version_requirements: *19031460
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: posix-spawn
82
- requirement: &23715920 !ruby/object:Gem::Requirement
82
+ requirement: &19030920 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.3.6
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *23715920
90
+ version_requirements: *19030920
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &23715420 !ruby/object:Gem::Requirement
93
+ requirement: &19030420 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 0.9.2
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *23715420
101
+ version_requirements: *19030420
102
102
  description: ! "OverSIP is an async SIP server. Built on top of Ruby EventMachine\n
103
103
  \ library it follows the Reactor Pattern, allowing thousands of concurrent connections
104
104
  and requests\n handled by a single processor in a never-blocking fashion. It
@@ -263,9 +263,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  none: false
265
265
  requirements:
266
- - - ! '>='
266
+ - - ! '>'
267
267
  - !ruby/object:Gem::Version
268
- version: '0'
268
+ version: 1.3.1
269
269
  requirements: []
270
270
  rubyforge_project:
271
271
  rubygems_version: 1.8.11