oversip 1.3.3 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/oversip CHANGED
@@ -82,10 +82,10 @@ module OverSIP
82
82
  ::POSIX_MQ.unlink value
83
83
  rescue ::Errno::ENOENT
84
84
  rescue ::Errno::EACCES => e
85
- fatal "cannot remove '#{value}' posix message queue due file permissions"
85
+ ::OverSIP::Launcher.fatal "cannot remove '#{value}' posix message queue due file permissions"
86
86
  exit 1
87
87
  rescue ::Errno::EINVAL => e
88
- fatal "cannot remove '#{value}' posix message queue, invalid name"
88
+ ::OverSIP::Launcher.fatal "cannot remove '#{value}' posix message queue, invalid name"
89
89
  exit 1
90
90
  ensure
91
91
  exit
@@ -143,7 +143,7 @@ module OverSIP
143
143
 
144
144
  # PID file is required.
145
145
  unless options[:pid_file]
146
- fatal "PID file is required (use -P or --pid option)"
146
+ ::OverSIP::Launcher.fatal "PID file is required (use -P or --pid option)"
147
147
  end
148
148
 
149
149
  # Ignore user/group if the launcher is not being running as root.
@@ -157,14 +157,14 @@ module OverSIP
157
157
  begin
158
158
  ::Etc.getpwnam options[:user]
159
159
  rescue ::ArgumentError
160
- fatal "user '#{options[:user]}' does not exist in the system"
160
+ ::OverSIP::Launcher.fatal "user '#{options[:user]}' does not exist in the system"
161
161
  end
162
162
  end
163
163
  if options[:group]
164
164
  begin
165
165
  ::Etc.getgrnam options[:group]
166
166
  rescue ::ArgumentError
167
- fatal "group '#{options[:group]}' does not exist in the system"
167
+ ::OverSIP::Launcher.fatal "group '#{options[:group]}' does not exist in the system"
168
168
  end
169
169
  end
170
170
  end
data/ext/utils/ip_utils.h CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
  #include <string.h>
5
5
  #include <netinet/in.h>
6
-
6
+ #include <sys/types.h>
7
+ #include <sys/socket.h>
7
8
 
8
9
  enum enum_ip_type {
9
10
  ip_type_ipv4 = 1,
@@ -4,7 +4,7 @@ module OverSIP::SIP
4
4
  DOUBLE_CRLF = "\r\n\r\n"
5
5
 
6
6
  # DOC: http://www.iana.org/assignments/sip-parameters
7
- REASON_PHARSE = {
7
+ REASON_PHRASE = {
8
8
  100 => "Trying",
9
9
  180 => "Ringing",
10
10
  181 => "Call Is Being Forwarded",
@@ -78,7 +78,7 @@ module OverSIP::SIP
78
78
  606 => "Not Acceptable"
79
79
  }
80
80
 
81
- REASON_PHARSE_NOT_SET = "Reason Phrase Not Set"
81
+ REASON_PHRASE_NOT_SET = "Reason Phrase Not Set"
82
82
 
83
83
  HDR_SERVER = "Server: #{::OverSIP::PROGRAM_NAME}/#{::OverSIP::VERSION}".freeze
84
84
  HDR_USER_AGENT = "User-Agent: #{::OverSIP::PROGRAM_NAME}/#{::OverSIP::VERSION}".freeze
@@ -139,10 +139,8 @@ module OverSIP::SIP
139
139
  return false if @destination_myself == false
140
140
 
141
141
  if local_uri? @ruri
142
- log_system_debug "RURI destination is myself" if $oversip_debug
143
142
  return @destination_myself = true
144
143
  else
145
- log_system_debug "RURI destination is not myself" if $oversip_debug
146
144
  return @destination_myself = false
147
145
  end
148
146
  end
@@ -13,6 +13,7 @@ module OverSIP::SIP
13
13
  @port = port
14
14
 
15
15
  @name_addr_modified = true
16
+ @uri_modified = true
16
17
  end
17
18
 
18
19
  def display_name= value
@@ -44,7 +44,7 @@ module OverSIP::SIP
44
44
  end
45
45
  return false unless @server_transaction.receive_response(status_code) if @server_transaction
46
46
 
47
- reason_phrase ||= REASON_PHARSE[status_code] || REASON_PHARSE_NOT_SET
47
+ reason_phrase ||= REASON_PHRASE[status_code] || REASON_PHRASE_NOT_SET
48
48
 
49
49
  if status_code > 100
50
50
  @internal_to_tag ||= @to_tag || ( @server_transaction ? ::SecureRandom.hex(6) : ::OverSIP::SIP::Tags.totag_for_sl_reply )
@@ -6,7 +6,7 @@ module OverSIP::SIP
6
6
  DEFAULT_FROM = "\"OverSIP #{::OverSIP::VERSION}\" <sip:uac@oversip.net>"
7
7
 
8
8
  attr_reader :sip_method, :ruri, :from, :from_tag, :to, :body, :call_id, :cseq
9
- attr_reader :antiloop_id
9
+ attr_reader :antiloop_id, :via_branch_id
10
10
  attr_reader :routes # Always nil (needed for OverSIP::SIP::Tags.create_antiloop_id().
11
11
  attr_accessor :tvars # Transaction variables (a hash).
12
12
 
@@ -32,6 +32,7 @@ module OverSIP::SIP
32
32
  @body = body
33
33
 
34
34
  @antiloop_id = ::OverSIP::SIP::Tags.create_antiloop_id(self)
35
+ @via_branch_id = ::SecureRandom.hex(4)
35
36
  end
36
37
 
37
38
 
@@ -5,7 +5,7 @@ module OverSIP
5
5
  module Version
6
6
  MAJOR = 1
7
7
  MINOR = 3
8
- TINY = 3
8
+ TINY = 5
9
9
  DEVEL = nil # Set to nil for stable releases.
10
10
  end
11
11
 
@@ -2,7 +2,7 @@ module OverSIP::WebSocket
2
2
 
3
3
  CRLF = "\r\n"
4
4
 
5
- REASON_PHARSE = {
5
+ REASON_PHRASE = {
6
6
  100 => "Continue",
7
7
  101 => "Switching Protocols",
8
8
  200 => "OK",
@@ -46,7 +46,7 @@ module OverSIP::WebSocket
46
46
  505 => "HTTP Version Not Supported"
47
47
  }
48
48
 
49
- REASON_PHARSE_NOT_SET = "Reason Phrase Not Set"
49
+ REASON_PHRASE_NOT_SET = "Reason Phrase Not Set"
50
50
 
51
51
  HDR_SERVER = "Server: #{::OverSIP::PROGRAM_NAME}/#{::OverSIP::VERSION}".freeze
52
52
 
@@ -34,7 +34,7 @@ module OverSIP::WebSocket
34
34
 
35
35
 
36
36
  def reply status_code, reason_phrase=nil, extra_headers={}
37
- reason_phrase ||= REASON_PHARSE[status_code] || REASON_PHARSE_NOT_SET
37
+ reason_phrase ||= REASON_PHRASE[status_code] || REASON_PHRASE_NOT_SET
38
38
  extra_headers ||= {}
39
39
 
40
40
  response = "#{@http_version} #{status_code} #{reason_phrase}\r\n"
data/lib/oversip.rb CHANGED
@@ -11,11 +11,12 @@ require "tempfile"
11
11
  # Ruby external gems.
12
12
 
13
13
  require "term/ansicolor"
14
+ gem "posix_mq", ">= 2.0.0"
14
15
  require "posix_mq"
15
16
  require "syslog"
16
17
  # Load EventMachine-LE here to avoid som EM based gem in server.rb to be loaded first
17
18
  # (and load eventmachine instead of eventmachine-le).
18
- gem "eventmachine-le", ">= 1.1.3"
19
+ gem "eventmachine-le", ">= 1.1.4"
19
20
  require "eventmachine-le"
20
21
 
21
22
 
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+
3
+ require "oversip_test_helper"
4
+
5
+
6
+ class TestNameAddr < OverSIPTest
7
+
8
+ def test_name_addr
9
+ full_name_addr = '"Iñaki Baz Castillo" <sips:i%C3%B1aki@aliax.net:5060;transport=tcp;foo=123;baz?X-Header-1=qwe&X-Header-2=asd>'
10
+ aor = "sip:i%C3%B1aki@aliax.net"
11
+
12
+ name_addr = ::OverSIP::SIP::NameAddr.new "Iñaki Baz Castillo", :sips, "iñaki", "aliax.net", 5060
13
+ name_addr.transport_param = :tcp
14
+ name_addr.set_param "FOO", "123"
15
+ name_addr.set_param "baz", nil
16
+ name_addr.headers = "?X-Header-1=qwe&X-Header-2=asd"
17
+
18
+ assert_true name_addr.sip?
19
+ assert_false name_addr.tel?
20
+ assert_false name_addr.unknown_scheme?
21
+ assert_equal "iñaki", name_addr.user
22
+ assert_equal "123", name_addr.get_param("Foo")
23
+ assert_equal aor, name_addr.aor
24
+ assert_equal full_name_addr, name_addr.to_s
25
+ end
26
+
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oversip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-15 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine-le
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.1.3
21
+ version: 1.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.1.3
29
+ version: 1.1.4
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: iobuffer
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 1.1.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: posix_mq
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 2.0.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: em-posixmq
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -318,6 +334,7 @@ files:
318
334
  - test/oversip_test_helper.rb
319
335
  - test/test_sip_parser.rb
320
336
  - test/test_http_parser.rb
337
+ - test/test_name_addr.rb
321
338
  - test/test_uri.rb
322
339
  - bin/oversip
323
340
  homepage: http://www.oversip.net
@@ -348,5 +365,6 @@ test_files:
348
365
  - test/oversip_test_helper.rb
349
366
  - test/test_sip_parser.rb
350
367
  - test/test_http_parser.rb
368
+ - test/test_name_addr.rb
351
369
  - test/test_uri.rb
352
370
  has_rdoc: false