oversip_p 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +22 -0
  3. data/LICENSE +25 -0
  4. data/README.md +43 -0
  5. data/Rakefile +54 -0
  6. data/bin/oversip +184 -0
  7. data/etc/oversip.conf +274 -0
  8. data/etc/proxies.conf +145 -0
  9. data/etc/server.rb +315 -0
  10. data/etc/tls/ca/cacert.pem +3894 -0
  11. data/etc/tls/demo-tls.oversip.net.crt +17 -0
  12. data/etc/tls/demo-tls.oversip.net.key +15 -0
  13. data/etc/tls/upgrade-cacert.sh +12 -0
  14. data/etc/tls/utils/create-cert.rb +162 -0
  15. data/etc/tls/utils/get-sip-identities.rb +95 -0
  16. data/ext/common/c_util.h +74 -0
  17. data/ext/common/ruby_c_util.h +88 -0
  18. data/ext/sip_parser/common_headers.h +210 -0
  19. data/ext/sip_parser/ext_help.h +18 -0
  20. data/ext/sip_parser/extconf.rb +3 -0
  21. data/ext/sip_parser/sip_message_parser.c +29741 -0
  22. data/ext/sip_parser/sip_parser.h +250 -0
  23. data/ext/sip_parser/sip_parser_ruby.c +1370 -0
  24. data/ext/sip_parser/sip_uri_parser.c +39699 -0
  25. data/ext/stud/extconf.rb +43 -0
  26. data/ext/stun/ext_help.h +16 -0
  27. data/ext/stun/extconf.rb +3 -0
  28. data/ext/stun/stun_ruby.c +394 -0
  29. data/ext/utils/ext_help.h +14 -0
  30. data/ext/utils/extconf.rb +3 -0
  31. data/ext/utils/haproxy_protocol.c +6163 -0
  32. data/ext/utils/haproxy_protocol.h +27 -0
  33. data/ext/utils/ip_utils.c +5952 -0
  34. data/ext/utils/ip_utils.h +64 -0
  35. data/ext/utils/outbound_utils.c +3227 -0
  36. data/ext/utils/outbound_utils.h +27 -0
  37. data/ext/utils/utils_ruby.c +392 -0
  38. data/ext/utils/utils_ruby.h +76 -0
  39. data/ext/websocket_framing_utils/ext_help.h +18 -0
  40. data/ext/websocket_framing_utils/extconf.rb +3 -0
  41. data/ext/websocket_framing_utils/ws_framing_utils.h +47 -0
  42. data/ext/websocket_framing_utils/ws_framing_utils_ruby.c +135 -0
  43. data/ext/websocket_http_parser/ext_help.h +18 -0
  44. data/ext/websocket_http_parser/extconf.rb +3 -0
  45. data/ext/websocket_http_parser/ws_http_parser.c +1635 -0
  46. data/ext/websocket_http_parser/ws_http_parser.h +87 -0
  47. data/ext/websocket_http_parser/ws_http_parser_ruby.c +630 -0
  48. data/lib/oversip/config.rb +597 -0
  49. data/lib/oversip/config_validators.rb +126 -0
  50. data/lib/oversip/default_server.rb +52 -0
  51. data/lib/oversip/errors.rb +10 -0
  52. data/lib/oversip/fiber_pool.rb +56 -0
  53. data/lib/oversip/launcher.rb +635 -0
  54. data/lib/oversip/logger.rb +84 -0
  55. data/lib/oversip/modules/outbound_mangling.rb +56 -0
  56. data/lib/oversip/modules/user_assertion.rb +73 -0
  57. data/lib/oversip/proxies_config.rb +189 -0
  58. data/lib/oversip/ruby_ext/eventmachine.rb +38 -0
  59. data/lib/oversip/sip/client.rb +428 -0
  60. data/lib/oversip/sip/client_transaction.rb +586 -0
  61. data/lib/oversip/sip/constants.rb +88 -0
  62. data/lib/oversip/sip/core.rb +217 -0
  63. data/lib/oversip/sip/launcher.rb +221 -0
  64. data/lib/oversip/sip/listeners/connection.rb +54 -0
  65. data/lib/oversip/sip/listeners/ipv4_tcp_client.rb +21 -0
  66. data/lib/oversip/sip/listeners/ipv4_tcp_server.rb +22 -0
  67. data/lib/oversip/sip/listeners/ipv4_tls_client.rb +21 -0
  68. data/lib/oversip/sip/listeners/ipv4_tls_server.rb +22 -0
  69. data/lib/oversip/sip/listeners/ipv4_tls_tunnel_server.rb +22 -0
  70. data/lib/oversip/sip/listeners/ipv4_udp_server.rb +21 -0
  71. data/lib/oversip/sip/listeners/ipv6_tcp_client.rb +21 -0
  72. data/lib/oversip/sip/listeners/ipv6_tcp_server.rb +22 -0
  73. data/lib/oversip/sip/listeners/ipv6_tls_client.rb +21 -0
  74. data/lib/oversip/sip/listeners/ipv6_tls_server.rb +22 -0
  75. data/lib/oversip/sip/listeners/ipv6_tls_tunnel_server.rb +22 -0
  76. data/lib/oversip/sip/listeners/ipv6_udp_server.rb +21 -0
  77. data/lib/oversip/sip/listeners/tcp_client.rb +97 -0
  78. data/lib/oversip/sip/listeners/tcp_connection.rb +202 -0
  79. data/lib/oversip/sip/listeners/tcp_server.rb +71 -0
  80. data/lib/oversip/sip/listeners/tls_client.rb +125 -0
  81. data/lib/oversip/sip/listeners/tls_server.rb +88 -0
  82. data/lib/oversip/sip/listeners/tls_tunnel_connection.rb +89 -0
  83. data/lib/oversip/sip/listeners/tls_tunnel_server.rb +61 -0
  84. data/lib/oversip/sip/listeners/udp_connection.rb +214 -0
  85. data/lib/oversip/sip/listeners.rb +24 -0
  86. data/lib/oversip/sip/message.rb +177 -0
  87. data/lib/oversip/sip/message_processor.rb +213 -0
  88. data/lib/oversip/sip/name_addr.rb +51 -0
  89. data/lib/oversip/sip/proxy.rb +324 -0
  90. data/lib/oversip/sip/request.rb +179 -0
  91. data/lib/oversip/sip/response.rb +37 -0
  92. data/lib/oversip/sip/rfc3263.rb +643 -0
  93. data/lib/oversip/sip/server_transaction.rb +295 -0
  94. data/lib/oversip/sip/sip.rb +76 -0
  95. data/lib/oversip/sip/tags.rb +39 -0
  96. data/lib/oversip/sip/timers.rb +55 -0
  97. data/lib/oversip/sip/transport_manager.rb +130 -0
  98. data/lib/oversip/sip/uac.rb +89 -0
  99. data/lib/oversip/sip/uac_request.rb +84 -0
  100. data/lib/oversip/sip/uri.rb +208 -0
  101. data/lib/oversip/syslog.rb +68 -0
  102. data/lib/oversip/system_callbacks.rb +45 -0
  103. data/lib/oversip/tls.rb +172 -0
  104. data/lib/oversip/utils.rb +30 -0
  105. data/lib/oversip/version.rb +21 -0
  106. data/lib/oversip/websocket/constants.rb +55 -0
  107. data/lib/oversip/websocket/http_request.rb +59 -0
  108. data/lib/oversip/websocket/launcher.rb +183 -0
  109. data/lib/oversip/websocket/listeners/connection.rb +51 -0
  110. data/lib/oversip/websocket/listeners/ipv4_ws_server.rb +22 -0
  111. data/lib/oversip/websocket/listeners/ipv4_wss_server.rb +22 -0
  112. data/lib/oversip/websocket/listeners/ipv4_wss_tunnel_server.rb +22 -0
  113. data/lib/oversip/websocket/listeners/ipv6_ws_server.rb +22 -0
  114. data/lib/oversip/websocket/listeners/ipv6_wss_server.rb +22 -0
  115. data/lib/oversip/websocket/listeners/ipv6_wss_tunnel_server.rb +22 -0
  116. data/lib/oversip/websocket/listeners/ws_server.rb +331 -0
  117. data/lib/oversip/websocket/listeners/wss_server.rb +88 -0
  118. data/lib/oversip/websocket/listeners/wss_tunnel_server.rb +133 -0
  119. data/lib/oversip/websocket/listeners.rb +13 -0
  120. data/lib/oversip/websocket/websocket.rb +13 -0
  121. data/lib/oversip/websocket/ws_framing.rb +545 -0
  122. data/lib/oversip/websocket/ws_sip_app.rb +120 -0
  123. data/lib/oversip.rb +127 -0
  124. data/test/oversip_test_helper.rb +19 -0
  125. data/test/test_http_parser.rb +73 -0
  126. data/test/test_name_addr.rb +27 -0
  127. data/test/test_name_addr_parser.rb +24 -0
  128. data/test/test_sip_message_parser.rb +168 -0
  129. data/test/test_sip_uri_parser.rb +56 -0
  130. data/test/test_uri.rb +68 -0
  131. data/thirdparty/stud/stud.tar.gz +0 -0
  132. metadata +334 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b0af28ece88d6d586ab78387230438424963e8aad32cf135d4cd9ded4a2b5b5a
4
+ data.tar.gz: 9674501195d60508e628a9f52a60291fa1f90d3ac696e36ceee974f8d83bdc80
5
+ SHA512:
6
+ metadata.gz: 2f75e78a9a99e04bac9e73edd5288a59fcfcf8c9e81b44b23f30e6765377b1909f7d582886b66c470cb02706734bb8b6e4bfe51f03f762d899d86f17c69e5a1e
7
+ data.tar.gz: 68f6970a37273c69361d0ab534a5daab3004464adf246a10becc6c89bd42691efaed0c9a79176e01004ec95ac7823f23beb6dd0319fea3b5f85af81a4e8979ec
data/AUTHORS ADDED
@@ -0,0 +1,22 @@
1
+ MAIN AUTHOR
2
+ ===========
3
+
4
+ - Iñaki Baz Castillo <ibc@aliax.net> (Github @ibc)
5
+
6
+
7
+
8
+ CONTRIBUTORS
9
+ ============
10
+
11
+ - Jon Bonilla <manwe@aholab.ehu.es> (Github @manwe)
12
+
13
+ Lots of help with packaging for Debian based distributions.
14
+ The first deployment of OverSIP in production for thousands of clients.
15
+
16
+ - Saúl Ibarra Corretgé <saghul@gmail.com> (Github @saghul)
17
+
18
+ Testing, ideas, proposals, too many proposals.
19
+
20
+ - José Luis Millán <jmillan@aliax.net> (Github @jmillan)
21
+
22
+ Intensive testing with JsSIP library acting as a SIP Outbound UA with OverSIP.
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Name: OverSIP
2
+ Maintainer: Iñaki Baz Castillo <ibc@aliax.net>
3
+ Copyright (c) 2012-2016 Iñaki Baz Castillo
4
+
5
+
6
+ License: The MIT License
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining
9
+ a copy of this software and associated documentation files (the
10
+ "Software"), to deal in the Software without restriction, including
11
+ without limitation the rights to use, copy, modify, merge, publish,
12
+ distribute, sublicense, and/or sell copies of the Software, and to
13
+ permit persons to whom the Software is furnished to do so, subject to
14
+ the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ <p align="center"><a href="http://oversip.net"><img src="http://oversip.net/images/oversip-banner.png"/></a></p>
2
+
3
+ [![Build Status](https://secure.travis-ci.org/versatica/OverSIP.png?branch=master)](http://travis-ci.org/versatica/OverSIP)
4
+
5
+ ## Website
6
+
7
+ * [www.oversip.net](http://www.oversip.net)
8
+
9
+
10
+ ## Overview
11
+
12
+ OverSIP is a powerful and flexible SIP proxy & server by the authors of [RFC 7118](http://tools.ietf.org/html/rfc7118) (*The WebSocket Protocol as a Transport for SIP*):
13
+
14
+ * Works on Linux/BSD/OSX
15
+ * Fully asynchronous event-based design, never block!
16
+ * Enjoy coding your SIP logic in Ruby language, feel free to code whatever you need!
17
+ * Fast: core and message parsers written in C language
18
+ * SIP over UDP, TCP, TLS and WebSocket (use true SIP in your web apps)
19
+ * Full support for IPv4, IPv6 and DNS resolution (NAPTR, SRV, A, AAAA)
20
+ * The perfect Outbound Edge Proxy
21
+ * Written by the authors of [RFC 7118 "The WebSocket Protocol as a Transport for SIP"](http://tools.ietf.org/html/rfc7118) and [JsSIP](http://jssip.net)
22
+
23
+
24
+ ## Documentation
25
+
26
+ * [www.oversip.net/documentation](http://www.oversip.net/documentation/)
27
+
28
+
29
+ ## Authors
30
+
31
+ ### Main Author
32
+
33
+ * Iñaki Baz Castillo (<ibc@aliax.net> | [github](https://github.com/ibc) | [twitter](https://twitter.com/ibc_tw))
34
+
35
+ ### Contributors
36
+
37
+ * José Luis Millán (<jmillan@aliax.net> | [github](https://github.com/jmillan) | [twitter](https://twitter.com/jomivi))
38
+ * Saúl Ibarra Corretgé (<saghul@gmail.com> | [github](https://github.com/saghul) | [twitter](https://twitter.com/saghul))
39
+ * Jon Bonilla (<manwe@aholab.ehu.es> | [github](https://github.com/manwe) | [twitter](https://twitter.com/jbmanwe))
40
+
41
+ ## License
42
+
43
+ OverSIP is released under the [MIT license](http://www.oversip.net/license).
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ require "rake/testtask"
2
+ require "rake/clean"
3
+
4
+
5
+ OVERSIP_EXTENSIONS = [
6
+ { :dir => "ext/sip_parser", :lib => "sip_parser.#{RbConfig::CONFIG["DLEXT"]}", :dest => "lib/oversip/sip" },
7
+ { :dir => "ext/stun", :lib => "stun.#{RbConfig::CONFIG["DLEXT"]}", :dest => "lib/oversip" },
8
+ { :dir => "ext/utils", :lib => "utils.#{RbConfig::CONFIG["DLEXT"]}", :dest => "lib/oversip" },
9
+ { :dir => "ext/websocket_framing_utils", :lib => "ws_framing_utils.#{RbConfig::CONFIG["DLEXT"]}", :dest => "lib/oversip/websocket" },
10
+ { :dir => "ext/websocket_http_parser", :lib => "ws_http_parser.#{RbConfig::CONFIG["DLEXT"]}", :dest => "lib/oversip/websocket" },
11
+ ]
12
+
13
+ OVERSIP_EXTENSIONS.each do |ext|
14
+ file ext[:lib] => Dir.glob(["#{ext[:dir]}/*{.c,.h}"]) do
15
+ Dir.chdir(ext[:dir]) do
16
+ ruby "extconf.rb"
17
+ sh "make"
18
+ end
19
+ cp "#{ext[:dir]}/#{ext[:lib]}", "#{ext[:dest]}/"
20
+ end
21
+
22
+ CLEAN.include("#{ext[:dir]}/*{.o,.log,.so,.a,.bundle}")
23
+ CLEAN.include("#{ext[:dir]}/Makefile")
24
+ CLEAN.include("#{ext[:dest]}/#{ext[:lib]}")
25
+ end
26
+
27
+ # Stud stuff.
28
+ directory "tmp"
29
+ file "bin/oversip_stud" => "tmp" do
30
+ Dir.chdir("ext/stud") do
31
+ ruby "extconf.rb"
32
+ end
33
+ FileUtils.remove_dir "tmp"
34
+ end
35
+ CLEAN.include("ext/stud/Makefile")
36
+ CLEAN.include("thirdparty/stud/mkmf.log")
37
+ CLEAN.include("bin/oversip_stud")
38
+
39
+
40
+ OVERSIP_COMPILE_ITEMS = OVERSIP_EXTENSIONS.map {|e| e[:lib]} << "bin/oversip_stud"
41
+
42
+ task :default => :compile
43
+
44
+ desc "Compile"
45
+ task :compile => OVERSIP_COMPILE_ITEMS
46
+
47
+ Rake::TestTask.new do |t|
48
+ t.libs << "test"
49
+ end
50
+
51
+ # Make the :test task depend on the shared object, so it will be built automatically
52
+ # before running the tests.
53
+ desc "Run tests"
54
+ task :test => OVERSIP_COMPILE_ITEMS
data/bin/oversip ADDED
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: binary -*-
3
+
4
+ unless RUBY_VERSION >= "1.9.2"
5
+ raise ::LoadError, "OverSIP requires Ruby version >= 1.9.2 (current version is #{RUBY_VERSION})"
6
+ end
7
+
8
+ $LOAD_PATH.insert 0, File.expand_path(File.join(File.dirname(__FILE__), "../", "lib"))
9
+
10
+ # When OverSIP is executed automaticaly via the system init (i.e. after booting the host)
11
+ # the Encoding.default_external is US_ASCII which causes fails when reading daat from
12
+ # some files (i.e. the cacert.pem file which contains no valid US_ASCII symbols). So
13
+ # make the default external encoding UTF-8 right now.
14
+ ::Encoding.default_external = ::Encoding::UTF_8
15
+
16
+ # First of all, trap some signals in order to ignore them if they arrive while
17
+ # loading server libraries.
18
+ [:HUP, :INT, :USR1, :USR2].each {|signal| trap(signal) {} }
19
+
20
+ require "optparse"
21
+ require "etc"
22
+ require "oversip"
23
+
24
+
25
+ module OverSIP
26
+
27
+ class Executable
28
+ extend ::OverSIP::Logger
29
+
30
+ @log_id = "executable"
31
+
32
+ def self.run
33
+ $0 = ::File.basename(__FILE__)
34
+ ::OverSIP::Logger.load_methods
35
+
36
+ # Options by default.
37
+ options = {
38
+ :colorize => true
39
+ }
40
+
41
+ OptionParser.new("", 28, " ") do |opts|
42
+ opts.banner = "#{::OverSIP::DESCRIPTION}" \
43
+ "\n\nUsage: #{File.basename(__FILE__)} " \
44
+ "[#{::OverSIP::PROGRAM_NAME} options] [Ruby options]"
45
+
46
+ opts.separator "\n#{::OverSIP::PROGRAM_NAME} options:"
47
+
48
+ opts.on("-P", "--pid FILE", "Create a PID file (required)") do |value|
49
+ options[:pid_file] = value
50
+ end
51
+
52
+ opts.on("-p", "--process-name NAME", "Change the running process name (default 'oversip')") do |value|
53
+ options[:process_name] = value
54
+ $0 = options[:process_name]
55
+ ::OverSIP::Logger.load_methods
56
+ end
57
+
58
+ opts.on("--config-dir DIR", "Absolute path to the directory with user configuration files (default '/etc/oversip/')") do |value|
59
+ options[:config_dir] = value
60
+ end
61
+
62
+ opts.on("--config-file FILE", "Name of the configuration file within the configuration directory (default 'oversip.conf')") do |value|
63
+ options[:config_file] = value
64
+ end
65
+
66
+ opts.on("-u", "--user USER", "System user to run with") do |value|
67
+ options[:user] = value
68
+ end
69
+
70
+ opts.on("-g", "--group GROUP", "System group to run with") do |value|
71
+ options[:group] = value
72
+ end
73
+
74
+ opts.on("--no-color", "Don't colorize text printed in stdout") do |value|
75
+ options[:colorize] = false
76
+ end
77
+
78
+ opts.separator "\nRuby options:"
79
+
80
+ opts.on("-d", "--debug", "Set debugging flags ($DEBUG = true)") do
81
+ $DEBUG = true
82
+ end
83
+
84
+ opts.on("-w", "--warn", "Turn warnings on ($-w = true)") do
85
+ $-w = true
86
+ end
87
+
88
+ opts.on("-I", "--include PATH", "Add PATH to $LOAD_PATH (may be used more than once)") do |path|
89
+ $LOAD_PATH.unshift(*path.split(/:/))
90
+ end
91
+
92
+ opts.on("-r", "--require LIBRARY", "Load LIBRARY before running the programm (may be used more than once)") do |library|
93
+ require library
94
+ end
95
+
96
+ opts.separator "\nCommon options:"
97
+
98
+ opts.on_tail("-h", "--help", "Show this message") do
99
+ puts opts.to_s
100
+ exit
101
+ end
102
+
103
+ opts.on_tail("-v", "--version", "Show version") do
104
+ puts ::OverSIP::DESCRIPTION
105
+ exit
106
+ end
107
+
108
+ begin
109
+ opts.parse! ARGV
110
+ rescue ::OptionParser::InvalidOption => e
111
+ log_system_error e.message
112
+ puts
113
+ puts opts.to_s
114
+ exit! 1
115
+ rescue ::OptionParser::MissingArgument => e
116
+ log_system_error e.message
117
+ puts
118
+ puts opts.to_s
119
+ exit! 1
120
+ end
121
+ end
122
+
123
+ log_system_notice "#{::OverSIP::PROGRAM_NAME} #{::OverSIP::VERSION} starting..."
124
+
125
+ # Options checks.
126
+
127
+ # PID file is required.
128
+ unless options[:pid_file]
129
+ ::OverSIP::Launcher.fatal "PID file is required (use -P or --pid option)"
130
+ end
131
+
132
+ # Ignore user/group if the launcher is not being running as root.
133
+ unless ::Process.euid == 0
134
+ if options[:user] or options[:group]
135
+ log_system_warn "ignoring user/group parameters when not running as root"
136
+ end
137
+
138
+ options.delete :user
139
+ options.delete :group
140
+ else
141
+ # Get the uid and gid to run with.
142
+ if options[:user]
143
+ begin
144
+ ::Etc.getpwnam options[:user]
145
+ rescue ::ArgumentError
146
+ ::OverSIP::Launcher.fatal "user '#{options[:user]}' does not exist in the system"
147
+ end
148
+ end
149
+ if options[:group]
150
+ begin
151
+ ::Etc.getgrnam options[:group]
152
+ rescue ::ArgumentError
153
+ ::OverSIP::Launcher.fatal "group '#{options[:group]}' does not exist in the system"
154
+ end
155
+ end
156
+ end
157
+
158
+ # Set the command name (as it appears in "ps" output) to given --process_name option (-p)
159
+ # or to the script filename otherwise.
160
+ ::OverSIP.master_name = options[:process_name] || ::File.basename(__FILE__)
161
+ $0 = ::OverSIP.master_name
162
+ log_system_info "process name: #{::OverSIP.master_name}"
163
+
164
+ ::OverSIP::Config.load options[:config_dir], options[:config_file]
165
+ ::OverSIP::Config.print options[:colorize]
166
+
167
+ ::OverSIP::Logger::load_methods
168
+
169
+ begin
170
+ ::Process.setrlimit Process::RLIMIT_NOFILE, 65536, 65536
171
+ rescue => e
172
+ # ::OverSIP::Launcher.fatal e
173
+ log_system_error "error increasing rlimits for 'nofiles': #{e.message} (#{e.class})"
174
+ end
175
+
176
+ ::OverSIP::Launcher.daemonize!(options)
177
+ ::OverSIP::Launcher.run(options)
178
+
179
+ end # def run
180
+ end # class Executable
181
+ end # module OverSIP
182
+
183
+
184
+ ::OverSIP::Executable.run
data/etc/oversip.conf ADDED
@@ -0,0 +1,274 @@
1
+ #
2
+ # OverSIP - Main Configuration.
3
+ #
4
+ #
5
+ # IMPORTANT:
6
+ # This is a YAML [1] format configuration file. DON'T USE tab for indentation
7
+ # as it's not allowed and would raise unexpected errors. Instead, respect
8
+ # the existing indentation spaces.
9
+ # [1] http://en.wikipedia.org/wiki/YAML
10
+
11
+
12
+ core:
13
+
14
+ # DNS nameserver to use. Note that OverSIP requires a recursive DNS server
15
+ # (recommended unbound: a DNS recursive and caching DNS resolver).
16
+ # Value can be:
17
+ # - An IPv4.
18
+ # - An array of IPv4 (for failover).
19
+ # - _null_: nameservers in /etc/resolv.conf are used.
20
+ # Default value is _null_.
21
+ #
22
+ nameservers: null
23
+
24
+ # Syslog facility. Can be "kern", "user", "daemon", "local0"..."local7".
25
+ # By default "daemon".
26
+ #
27
+ syslog_facility: daemon
28
+
29
+ # Syslog level. Can be "debug", "info", "notice", "warn", "error", "crit".
30
+ # By default "info".
31
+ #
32
+ syslog_level: debug
33
+
34
+
35
+ sip:
36
+
37
+ # Use SIP over UDP. By default _yes_.
38
+ #
39
+ sip_udp: yes
40
+
41
+ # Use SIP over TCP. By default _yes_.
42
+ #
43
+ sip_tcp: yes
44
+
45
+ # Use SIP over TLS. By default _yes_.
46
+ #
47
+ sip_tls: yes
48
+
49
+ # Enable or disable IPv4. By default _yes_.
50
+ #
51
+ enable_ipv4: yes
52
+
53
+ # IPv4 in which OverSIP listens for SIP messages. Using "0.0.0.0" is not
54
+ # allowed.
55
+ # - Use an IPv4 string for listening in that address.
56
+ # - Use _null_ for IP autodiscovery.
57
+ # Default value is _null_.
58
+ #
59
+ listen_ipv4: null
60
+
61
+ # Advertised IPv4 for Via, Record-Route and Path headers.
62
+ # Useful when OverSIP runs behind a NAT and must expose the router public
63
+ # IPv4 to the outside.
64
+ # Default value is _null_ which means that the local IPv4 is used.
65
+ #
66
+ advertised_ipv4: null
67
+
68
+ # Enable or disable IPv6. By default _yes_.
69
+ #
70
+ enable_ipv6: yes
71
+
72
+ # IPv6 in which OverSIP listens for SIP messages. Using "::" is not
73
+ # allowed.
74
+ # - Use an IPv6 string for listening in that address.
75
+ # - Use _null_ for IP autodiscovery.
76
+ # Default value is _null_.
77
+ #
78
+ listen_ipv6: null
79
+
80
+ # Advertised IPv6 for Via, Record-Route and Path headers.
81
+ # Useful when OverSIP runs behind a NAT and must expose the router public
82
+ # IPv4 to the outside.
83
+ # Default value is _null_ which means that the local IPv6 is used.
84
+ #
85
+ advertised_ipv6: null
86
+
87
+ # Listening port for SIP over UDP and TCP.
88
+ # By default 5060.
89
+ #
90
+ listen_port: 5060
91
+
92
+ # Listening port for SIP over TLS.
93
+ # By default 5061.
94
+ #
95
+ listen_port_tls: 5061
96
+
97
+ # By enabling this option OverSIP does not listen in SIP TLS but, instead,
98
+ # runs an instance of Stud TLS proxy which communicates with OverSIP using
99
+ # plain TCP.
100
+ # By default _yes_.
101
+ #
102
+ use_tls_tunnel: yes
103
+
104
+ # The port which listens for TCP traffic from the Stud TLS proxy running in
105
+ # this host.
106
+ # By default 5062.
107
+ #
108
+ listen_port_tls_tunnel: 5062
109
+
110
+ # Call the OverSIP::SipEvents.on_client_tls_handshake() callback when a SIP
111
+ # client attemps a TLS handshake with OverSIP.
112
+ # By default _yes_.
113
+ #
114
+ callback_on_client_tls_handshake: yes
115
+
116
+ # Local domains OverSIP is responsible for. Value can be:
117
+ # - A domain.
118
+ # - An array of domains.
119
+ # - _null_: no one, just local IP's are matched as local destinations.
120
+ # Default value is _null_.
121
+ #
122
+ # local domains: [ example.net, sip.example.org ]
123
+ local_domains: null
124
+
125
+ # TCP keepalive interval (in seconds).
126
+ # When acting as a TCP server, OverSIP sends TCP packets with null data payload
127
+ # as described in http://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/.
128
+ # If not set, TCP keepalive is disabled.
129
+ # Minimun value is 180 seconds. Default value is _null_ (not enabled).
130
+ #
131
+ tcp_keepalive_interval: 300
132
+
133
+ # Use a hostname for Record-Route/Path header when using TLS or WSS transports
134
+ # over IPv4 (rather than using the server IP). This is good when a peer
135
+ # sends us an in-dialog request via TLS so it could check whether the host part
136
+ # of the top Route header matches a domain in the certificate we provide to it.
137
+ # If not set, the server IPv4 will be used.
138
+ # Default value is _null_ (IPv4 is used).
139
+ #
140
+ # record_route_hostname_tls_ipv4: outbound.example.net
141
+ record_route_hostname_tls_ipv4: null
142
+
143
+ # The same for IPv6.
144
+ # If not set, the server IPv6 will be used.
145
+ # Default value is _null_ (IPv6 is used).
146
+ #
147
+ # record_route_hostname_tls_ipv6: outbound.example.net
148
+ record_route_hostname_tls_ipv6: null
149
+
150
+
151
+ websocket:
152
+
153
+ # Use SIP over WebSocket. By default _yes_.
154
+ #
155
+ sip_ws: yes
156
+
157
+ # Use SIP over WebSocket with TLS. By default _yes_.
158
+ #
159
+ sip_wss: yes
160
+
161
+ # Enable or disable IPv4. By default _yes_.
162
+ #
163
+ enable_ipv4: yes
164
+
165
+ # IPv4 in which OverSIP listens for WebSocket messages. Using "0.0.0.0" is not
166
+ # allowed.
167
+ # - Use an IPv4 string for listening in that address.
168
+ # - Use _null_ for IP autodiscovery.
169
+ # Default value is _null_.
170
+ #
171
+ listen_ipv4: null
172
+
173
+ # Advertised IPv4 for Via, Record-Route and Path headers.
174
+ # Useful when OverSIP runs behind a NAT and must expose the router public
175
+ # IPv4 to the outside.
176
+ # Default value is _null_ which means that the local IPv4 is used.
177
+ #
178
+ advertised_ipv4: null
179
+
180
+ # Enable or disable IPv6. By default _yes_.
181
+ #
182
+ enable_ipv6: yes
183
+
184
+ # IPv6 in which OverSIP listens for SIP messages. Using "::" is not
185
+ # allowed.
186
+ # - Use an IPv6 string for listening in that address.
187
+ # - Use _null_ for IP autodiscovery.
188
+ # Default value is _null_.
189
+ #
190
+ listen_ipv6: null
191
+
192
+ # Advertised IPv6 for Via, Record-Route and Path headers.
193
+ # Useful when OverSIP runs behind a NAT and must expose the router public
194
+ # IPv4 to the outside.
195
+ # Default value is _null_ which means that the local IPv6 is used.
196
+ #
197
+ advertised_ipv6: null
198
+
199
+ # Listening port for WebSocket over HTTP.
200
+ # By default 10080.
201
+ #
202
+ listen_port: 10080
203
+
204
+ # Listening port for WebSocket over HTTPS.
205
+ # By default 10443.
206
+ #
207
+ listen_port_tls: 10443
208
+
209
+ # By enabling this option OverSIP does not listen in WebSocket TLS but, instead,
210
+ # runs an instance of Stud TLS proxy which communicates with OverSIP using
211
+ # plain TCP.
212
+ # By default _yes_.
213
+ #
214
+ use_tls_tunnel: yes
215
+
216
+ # The port which listens for TCP traffic from the Stud TLS proxy running in
217
+ # this host.
218
+ # By default 10444.
219
+ #
220
+ listen_port_tls_tunnel: 10444
221
+
222
+ # Call the OverSIP::WebSocketEvents.on_client_tls_handshake() callback when a WebSocket
223
+ # client attemps a TLS handshake with OverSIP.
224
+ # By default _yes_.
225
+ #
226
+ callback_on_client_tls_handshake: yes
227
+
228
+ # WebSocket message max size (bytes). By default 65536.
229
+ #
230
+ max_ws_message_size: 65536
231
+
232
+ # WebSocket frame max size (bytes). By default 65536.
233
+ #
234
+ max_ws_frame_size: 65536
235
+
236
+ # WebSocket PING frames interval (in seconds).
237
+ # If set, OverSIP sends WebSocket PING control frames as the given interval.
238
+ # Minimun value is 180. Default value is _null_.
239
+ #
240
+ ws_keepalive_interval: 300
241
+
242
+
243
+ # TLS parameters affect to any interface of OverSIP using TLS, including SIP and WebSocket.
244
+ tls:
245
+
246
+ # Server TLS public certificate. It must be the name of a readable file containing a
247
+ # chain of X509 certificates in PEM format, with the most-resolved certificate at the
248
+ # top of the file, successive intermediate certs in the middle, and the root (or CA)
249
+ # cert at the bottom.
250
+ # If not set, TLS is disabled. Default value is _null_.
251
+ # If a relative path is given, it's searched under the tls/ directoy in the OverSIP
252
+ # configuration directory (typically /etc/oversip/).
253
+ #
254
+ public_cert: demo-tls.oversip.net.crt
255
+
256
+ # Server TLS private certificate. It must be the name of a readable file containing a
257
+ # private key in the PEM format.
258
+ # If not set, TLS is disabled. Default value is _null_.
259
+ # If a relative path is given, it's searched under the tls/ directoy in the OverSIP
260
+ # configuration directory (typically /etc/oversip/).
261
+ # NOTE: The private key MUST NOT require password.
262
+ #
263
+ private_cert: demo-tls.oversip.net.key
264
+
265
+ # Directory of TLS CAs. It must be the name of a readable directory. Every file in
266
+ # that directory will be inspected and every X509 certificate in PEM format extracted.
267
+ # This is useful for storing the list of trusted CAs (i.e. http://curl.haxx.se/ca/cacert.pem)
268
+ # or CAs not in a standard trust hierarchy.
269
+ # This is *required* for validating certificates provided by remote peers.
270
+ # If _null_ this feature is dssabled. Default value is _null_.
271
+ # If a relative path is given, it's searched under the tls/ directoy in the OverSIP
272
+ # configuration directory (typically /etc/oversip/).
273
+ #
274
+ ca_dir: ca/