oversip 1.1.0.beta5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/etc/oversip.conf +16 -4
- data/etc/proxies.conf +8 -9
- data/etc/server.rb +59 -0
- data/ext/sip_parser/sip_parser.c +12066 -11975
- data/ext/sip_parser/sip_parser.h +1 -0
- data/ext/sip_parser/sip_parser_ruby.c +15 -4
- data/ext/utils/haproxy_protocol.c +4 -1
- data/ext/websocket_framing_utils/ws_framing_utils_ruby.c +2 -2
- data/lib/oversip/config.rb +50 -38
- data/lib/oversip/default_server.rb +12 -0
- data/lib/oversip/launcher.rb +10 -35
- data/lib/oversip/master_process.rb +2 -2
- data/lib/oversip/proxies_config.rb +2 -2
- data/lib/oversip/sip/client_transaction.rb +1 -7
- data/lib/oversip/sip/grammar/uri.rb +23 -1
- data/lib/oversip/sip/listeners/{reactor.rb → connection.rb} +16 -2
- data/lib/oversip/sip/listeners/ipv4_udp_server.rb +1 -1
- data/lib/oversip/sip/listeners/ipv6_udp_server.rb +1 -1
- data/lib/oversip/sip/listeners/tcp_client.rb +2 -3
- data/lib/oversip/sip/listeners/{tcp_reactor.rb → tcp_connection.rb} +14 -2
- data/lib/oversip/sip/listeners/tcp_server.rb +2 -5
- data/lib/oversip/sip/listeners/tls_client.rb +15 -12
- data/lib/oversip/sip/listeners/tls_server.rb +11 -11
- data/lib/oversip/sip/listeners/{tls_tunnel_reactor.rb → tls_tunnel_connection.rb} +20 -20
- data/lib/oversip/sip/listeners/tls_tunnel_server.rb +2 -5
- data/lib/oversip/sip/listeners/{udp_reactor.rb → udp_connection.rb} +4 -4
- data/lib/oversip/sip/listeners.rb +6 -10
- data/lib/oversip/sip/message.rb +4 -3
- data/lib/oversip/sip/message_processor.rb +17 -17
- data/lib/oversip/sip/modules/core.rb +18 -13
- data/lib/oversip/sip/modules/user_assertion.rb +7 -53
- data/lib/oversip/sip/proxy.rb +3 -3
- data/lib/oversip/sip/request.rb +2 -0
- data/lib/oversip/sip/rfc3263.rb +3 -3
- data/lib/oversip/sip/sip.rb +6 -0
- data/lib/oversip/sip/transport_manager.rb +8 -8
- data/lib/oversip/tls.rb +18 -22
- data/lib/oversip/version.rb +1 -1
- data/lib/oversip/websocket/constants.rb +0 -1
- data/lib/oversip/websocket/http_request.rb +4 -8
- data/lib/oversip/websocket/launcher.rb +83 -139
- data/lib/oversip/websocket/listeners/connection.rb +47 -0
- data/lib/oversip/websocket/{ws_apps/ipv4_ws_sip_app.rb → listeners/ipv4_ws_server.rb} +3 -3
- data/lib/oversip/websocket/{ws_apps/ipv4_wss_sip_app.rb → listeners/ipv4_wss_server.rb} +2 -2
- data/lib/oversip/websocket/listeners/ipv4_wss_tunnel_server.rb +21 -0
- data/lib/oversip/websocket/{ws_apps/ipv6_ws_sip_app.rb → listeners/ipv6_ws_server.rb} +3 -3
- data/lib/oversip/websocket/{ws_apps/ipv6_wss_sip_app.rb → listeners/ipv6_wss_server.rb} +2 -3
- data/lib/oversip/websocket/listeners/ipv6_wss_tunnel_server.rb +21 -0
- data/lib/oversip/websocket/listeners/{tcp_server.rb → ws_server.rb} +63 -43
- data/lib/oversip/websocket/listeners/{tls_server.rb → wss_server.rb} +14 -13
- data/lib/oversip/websocket/listeners/{tls_tunnel_server.rb → wss_tunnel_server.rb} +36 -10
- data/lib/oversip/websocket/listeners.rb +10 -9
- data/lib/oversip/websocket/websocket.rb +13 -0
- data/lib/oversip/websocket/ws_framing.rb +35 -97
- data/lib/oversip/websocket/ws_sip_app.rb +120 -0
- data/lib/oversip.rb +1 -1
- data/test/oversip_test_helper.rb +2 -2
- data/test/test_http_parser.rb +2 -2
- data/test/test_sip_parser.rb +18 -3
- data/test/test_uri.rb +44 -0
- metadata +39 -42
- data/lib/oversip/websocket/listeners/ipv4_tcp_server.rb +0 -15
- data/lib/oversip/websocket/listeners/ipv4_tls_server.rb +0 -15
- data/lib/oversip/websocket/listeners/ipv4_tls_tunnel_server.rb +0 -15
- data/lib/oversip/websocket/listeners/ipv6_tcp_server.rb +0 -15
- data/lib/oversip/websocket/listeners/ipv6_tls_server.rb +0 -15
- data/lib/oversip/websocket/listeners/ipv6_tls_tunnel_server.rb +0 -15
- data/lib/oversip/websocket/ws_app.rb +0 -77
- data/lib/oversip/websocket/ws_apps/ws_autobahn_app.rb +0 -23
- data/lib/oversip/websocket/ws_apps/ws_sip_app.rb +0 -156
- data/lib/oversip/websocket/ws_apps.rb +0 -9
data/etc/oversip.conf
CHANGED
@@ -46,7 +46,7 @@ sip:
|
|
46
46
|
#
|
47
47
|
sip_tls: yes
|
48
48
|
|
49
|
-
# Enable or
|
49
|
+
# Enable or disable IPv4. By default _yes_.
|
50
50
|
#
|
51
51
|
enable_ipv4: yes
|
52
52
|
|
@@ -58,7 +58,7 @@ sip:
|
|
58
58
|
#
|
59
59
|
listen_ipv4: null
|
60
60
|
|
61
|
-
# Enable or
|
61
|
+
# Enable or disable IPv6. By default _yes_.
|
62
62
|
#
|
63
63
|
enable_ipv6: yes
|
64
64
|
|
@@ -93,6 +93,12 @@ sip:
|
|
93
93
|
#
|
94
94
|
listen_port_tls_tunnel: 5062
|
95
95
|
|
96
|
+
# Call the OverSIP::SipEvents.on_client_tls_handshake() callback when a SIP
|
97
|
+
# client attemps a TLS handshake with OverSIP.
|
98
|
+
# By default _yes_.
|
99
|
+
#
|
100
|
+
callback_on_client_tls_handshake: yes
|
101
|
+
|
96
102
|
# Local domains OverSIP is responsible for. Value can be:
|
97
103
|
# - A domain.
|
98
104
|
# - An array of domains.
|
@@ -138,7 +144,7 @@ websocket:
|
|
138
144
|
#
|
139
145
|
sip_wss: yes
|
140
146
|
|
141
|
-
# Enable or
|
147
|
+
# Enable or disable IPv4. By default _yes_.
|
142
148
|
#
|
143
149
|
enable_ipv4: yes
|
144
150
|
|
@@ -150,7 +156,7 @@ websocket:
|
|
150
156
|
#
|
151
157
|
listen_ipv4: null
|
152
158
|
|
153
|
-
# Enable or
|
159
|
+
# Enable or disable IPv6. By default _yes_.
|
154
160
|
#
|
155
161
|
enable_ipv6: yes
|
156
162
|
|
@@ -185,6 +191,12 @@ websocket:
|
|
185
191
|
#
|
186
192
|
listen_port_tls_tunnel: 10444
|
187
193
|
|
194
|
+
# Call the OverSIP::WebSocketEvents.on_client_tls_handshake() callback when a WebSocket
|
195
|
+
# client attemps a TLS handshake with OverSIP.
|
196
|
+
# By default _yes_.
|
197
|
+
#
|
198
|
+
callback_on_client_tls_handshake: yes
|
199
|
+
|
188
200
|
# WebSocket message max size (bytes). By default 65536.
|
189
201
|
#
|
190
202
|
max_ws_message_size: 65536
|
data/etc/proxies.conf
CHANGED
@@ -65,8 +65,9 @@ default_proxy:
|
|
65
65
|
ip_type_preference: ["ipv4", "ipv6"]
|
66
66
|
|
67
67
|
# DNS failover on received 503.
|
68
|
-
#
|
69
|
-
#
|
68
|
+
# If a DNS query retrieves more than a single destinations and the first attempt
|
69
|
+
# receives a 503 response, then OverSIP tries the next destination (when this parameter
|
70
|
+
# is set) or replies a 500 error upstream (when not set).
|
70
71
|
# Default value is _yes_.
|
71
72
|
#
|
72
73
|
dns_failover_on_503: yes
|
@@ -92,13 +93,11 @@ default_proxy:
|
|
92
93
|
#
|
93
94
|
timer_F: 32
|
94
95
|
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
|
100
|
-
# Default value is _no_.
|
101
|
-
tls_validation: no
|
96
|
+
# Call the OverSIP::SIP.on_server_tls_handshake() callback when
|
97
|
+
# establishing an outbound SIP TLS connection with a remote SIP peer.
|
98
|
+
# By default _yes_.
|
99
|
+
#
|
100
|
+
callback_on_server_tls_handshake: yes
|
102
101
|
|
103
102
|
|
104
103
|
# Proxy configuration for routing in-dialog requests.
|
data/etc/server.rb
CHANGED
@@ -171,6 +171,10 @@ def (OverSIP::SipEvents).on_request request
|
|
171
171
|
log_notice "on_error: #{status} '#{reason}'"
|
172
172
|
end
|
173
173
|
|
174
|
+
proxy.on_invite_timeout do
|
175
|
+
log_notice "INVITE timeout, no final response before Timer C expires."
|
176
|
+
end
|
177
|
+
|
174
178
|
proxy.route request
|
175
179
|
return
|
176
180
|
|
@@ -215,6 +219,43 @@ def (OverSIP::SipEvents).on_request request
|
|
215
219
|
return
|
216
220
|
|
217
221
|
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
|
226
|
+
# This callback is called when a client initiates a SIP TLS handshake.
|
227
|
+
def (OverSIP::SipEvents).on_client_tls_handshake connection, pems
|
228
|
+
|
229
|
+
log_info "validating TLS connection from IP #{connection.remote_ip} and port #{connection.remote_port}"
|
230
|
+
|
231
|
+
cert, validated, tls_error, tls_error_string = ::OverSIP::TLS.validate pems
|
232
|
+
identities = ::OverSIP::TLS.get_sip_identities cert
|
233
|
+
|
234
|
+
if validated
|
235
|
+
log_info "client provides a valid TLS certificate with SIP identities #{identities}"
|
236
|
+
else
|
237
|
+
log_notice "client provides an invalid TLS certificate with SIP identities #{identities} (TLS error: #{tls_error.inspect}, description: #{tls_error_string.inspect})"
|
238
|
+
#connection.close
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
# This callback is called when conntacting a SIP TLS server and the TLS handshake takes place.
|
245
|
+
def (OverSIP::SipEvents).on_server_tls_handshake connection, pems
|
246
|
+
|
247
|
+
log_info "validating TLS connection to IP #{connection.remote_ip} and port #{connection.remote_port}"
|
248
|
+
|
249
|
+
cert, validated, tls_error, tls_error_string = ::OverSIP::TLS.validate pems
|
250
|
+
identities = ::OverSIP::TLS.get_sip_identities cert
|
251
|
+
|
252
|
+
if validated
|
253
|
+
log_info "server provides a valid TLS certificate with SIP identities #{identities}"
|
254
|
+
else
|
255
|
+
log_notice "server provides an invalid TLS certificate with SIP identities #{identities} (TLS error: #{tls_error.inspect}, description: #{tls_error_string.inspect})"
|
256
|
+
#connection.close
|
257
|
+
end
|
258
|
+
|
218
259
|
end
|
219
260
|
|
220
261
|
|
@@ -245,3 +286,21 @@ end
|
|
245
286
|
# def (OverSIP::WebSocketEvents).on_disconnection connection, client_closed
|
246
287
|
# [...]
|
247
288
|
# end
|
289
|
+
|
290
|
+
|
291
|
+
# This callback is called when a client initiates a WebSocket TLS handshake.
|
292
|
+
def (OverSIP::WebSocketEvents).on_client_tls_handshake connection, pems
|
293
|
+
|
294
|
+
log_info "validating TLS connection from IP #{connection.remote_ip} and port #{connection.remote_port}"
|
295
|
+
|
296
|
+
cert, validated, tls_error, tls_error_string = ::OverSIP::TLS.validate pems
|
297
|
+
identities = ::OverSIP::TLS.get_sip_identities cert
|
298
|
+
|
299
|
+
if validated
|
300
|
+
log_info "client provides a valid TLS certificate with SIP identities #{identities}"
|
301
|
+
else
|
302
|
+
log_notice "client provides an invalid TLS certificate with SIP identities #{identities} (TLS error: #{tls_error.inspect}, description: #{tls_error_string.inspect})"
|
303
|
+
#connection.close
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|