oversip_p 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +22 -0
- data/LICENSE +25 -0
- data/README.md +43 -0
- data/Rakefile +54 -0
- data/bin/oversip +184 -0
- data/etc/oversip.conf +274 -0
- data/etc/proxies.conf +145 -0
- data/etc/server.rb +315 -0
- data/etc/tls/ca/cacert.pem +3894 -0
- data/etc/tls/demo-tls.oversip.net.crt +17 -0
- data/etc/tls/demo-tls.oversip.net.key +15 -0
- data/etc/tls/upgrade-cacert.sh +12 -0
- data/etc/tls/utils/create-cert.rb +162 -0
- data/etc/tls/utils/get-sip-identities.rb +95 -0
- data/ext/common/c_util.h +74 -0
- data/ext/common/ruby_c_util.h +88 -0
- data/ext/sip_parser/common_headers.h +210 -0
- data/ext/sip_parser/ext_help.h +18 -0
- data/ext/sip_parser/extconf.rb +3 -0
- data/ext/sip_parser/sip_message_parser.c +29741 -0
- data/ext/sip_parser/sip_parser.h +250 -0
- data/ext/sip_parser/sip_parser_ruby.c +1370 -0
- data/ext/sip_parser/sip_uri_parser.c +39699 -0
- data/ext/stud/extconf.rb +43 -0
- data/ext/stun/ext_help.h +16 -0
- data/ext/stun/extconf.rb +3 -0
- data/ext/stun/stun_ruby.c +394 -0
- data/ext/utils/ext_help.h +14 -0
- data/ext/utils/extconf.rb +3 -0
- data/ext/utils/haproxy_protocol.c +6163 -0
- data/ext/utils/haproxy_protocol.h +27 -0
- data/ext/utils/ip_utils.c +5952 -0
- data/ext/utils/ip_utils.h +64 -0
- data/ext/utils/outbound_utils.c +3227 -0
- data/ext/utils/outbound_utils.h +27 -0
- data/ext/utils/utils_ruby.c +392 -0
- data/ext/utils/utils_ruby.h +76 -0
- data/ext/websocket_framing_utils/ext_help.h +18 -0
- data/ext/websocket_framing_utils/extconf.rb +3 -0
- data/ext/websocket_framing_utils/ws_framing_utils.h +47 -0
- data/ext/websocket_framing_utils/ws_framing_utils_ruby.c +135 -0
- data/ext/websocket_http_parser/ext_help.h +18 -0
- data/ext/websocket_http_parser/extconf.rb +3 -0
- data/ext/websocket_http_parser/ws_http_parser.c +1635 -0
- data/ext/websocket_http_parser/ws_http_parser.h +87 -0
- data/ext/websocket_http_parser/ws_http_parser_ruby.c +630 -0
- data/lib/oversip/config.rb +597 -0
- data/lib/oversip/config_validators.rb +126 -0
- data/lib/oversip/default_server.rb +52 -0
- data/lib/oversip/errors.rb +10 -0
- data/lib/oversip/fiber_pool.rb +56 -0
- data/lib/oversip/launcher.rb +635 -0
- data/lib/oversip/logger.rb +84 -0
- data/lib/oversip/modules/outbound_mangling.rb +56 -0
- data/lib/oversip/modules/user_assertion.rb +73 -0
- data/lib/oversip/proxies_config.rb +189 -0
- data/lib/oversip/ruby_ext/eventmachine.rb +38 -0
- data/lib/oversip/sip/client.rb +428 -0
- data/lib/oversip/sip/client_transaction.rb +586 -0
- data/lib/oversip/sip/constants.rb +88 -0
- data/lib/oversip/sip/core.rb +217 -0
- data/lib/oversip/sip/launcher.rb +221 -0
- data/lib/oversip/sip/listeners/connection.rb +54 -0
- data/lib/oversip/sip/listeners/ipv4_tcp_client.rb +21 -0
- data/lib/oversip/sip/listeners/ipv4_tcp_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv4_tls_client.rb +21 -0
- data/lib/oversip/sip/listeners/ipv4_tls_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv4_tls_tunnel_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv4_udp_server.rb +21 -0
- data/lib/oversip/sip/listeners/ipv6_tcp_client.rb +21 -0
- data/lib/oversip/sip/listeners/ipv6_tcp_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv6_tls_client.rb +21 -0
- data/lib/oversip/sip/listeners/ipv6_tls_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv6_tls_tunnel_server.rb +22 -0
- data/lib/oversip/sip/listeners/ipv6_udp_server.rb +21 -0
- data/lib/oversip/sip/listeners/tcp_client.rb +97 -0
- data/lib/oversip/sip/listeners/tcp_connection.rb +202 -0
- data/lib/oversip/sip/listeners/tcp_server.rb +71 -0
- data/lib/oversip/sip/listeners/tls_client.rb +125 -0
- data/lib/oversip/sip/listeners/tls_server.rb +88 -0
- data/lib/oversip/sip/listeners/tls_tunnel_connection.rb +89 -0
- data/lib/oversip/sip/listeners/tls_tunnel_server.rb +61 -0
- data/lib/oversip/sip/listeners/udp_connection.rb +214 -0
- data/lib/oversip/sip/listeners.rb +24 -0
- data/lib/oversip/sip/message.rb +177 -0
- data/lib/oversip/sip/message_processor.rb +213 -0
- data/lib/oversip/sip/name_addr.rb +51 -0
- data/lib/oversip/sip/proxy.rb +324 -0
- data/lib/oversip/sip/request.rb +179 -0
- data/lib/oversip/sip/response.rb +37 -0
- data/lib/oversip/sip/rfc3263.rb +643 -0
- data/lib/oversip/sip/server_transaction.rb +295 -0
- data/lib/oversip/sip/sip.rb +76 -0
- data/lib/oversip/sip/tags.rb +39 -0
- data/lib/oversip/sip/timers.rb +55 -0
- data/lib/oversip/sip/transport_manager.rb +130 -0
- data/lib/oversip/sip/uac.rb +89 -0
- data/lib/oversip/sip/uac_request.rb +84 -0
- data/lib/oversip/sip/uri.rb +208 -0
- data/lib/oversip/syslog.rb +68 -0
- data/lib/oversip/system_callbacks.rb +45 -0
- data/lib/oversip/tls.rb +172 -0
- data/lib/oversip/utils.rb +30 -0
- data/lib/oversip/version.rb +21 -0
- data/lib/oversip/websocket/constants.rb +55 -0
- data/lib/oversip/websocket/http_request.rb +59 -0
- data/lib/oversip/websocket/launcher.rb +183 -0
- data/lib/oversip/websocket/listeners/connection.rb +51 -0
- data/lib/oversip/websocket/listeners/ipv4_ws_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ipv4_wss_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ipv4_wss_tunnel_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ipv6_ws_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ipv6_wss_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ipv6_wss_tunnel_server.rb +22 -0
- data/lib/oversip/websocket/listeners/ws_server.rb +331 -0
- data/lib/oversip/websocket/listeners/wss_server.rb +88 -0
- data/lib/oversip/websocket/listeners/wss_tunnel_server.rb +133 -0
- data/lib/oversip/websocket/listeners.rb +13 -0
- data/lib/oversip/websocket/websocket.rb +13 -0
- data/lib/oversip/websocket/ws_framing.rb +545 -0
- data/lib/oversip/websocket/ws_sip_app.rb +120 -0
- data/lib/oversip.rb +127 -0
- data/test/oversip_test_helper.rb +19 -0
- data/test/test_http_parser.rb +73 -0
- data/test/test_name_addr.rb +27 -0
- data/test/test_name_addr_parser.rb +24 -0
- data/test/test_sip_message_parser.rb +168 -0
- data/test/test_sip_uri_parser.rb +56 -0
- data/test/test_uri.rb +68 -0
- data/thirdparty/stud/stud.tar.gz +0 -0
- metadata +334 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class HttpRequest < ::Hash
|
4
|
+
|
5
|
+
include ::OverSIP::Logger
|
6
|
+
|
7
|
+
attr_accessor :connection
|
8
|
+
|
9
|
+
# HTTP request attributes.
|
10
|
+
attr_reader :http_method
|
11
|
+
attr_reader :http_version
|
12
|
+
attr_reader :uri_scheme
|
13
|
+
attr_reader :uri
|
14
|
+
attr_reader :uri_path
|
15
|
+
attr_reader :uri_query
|
16
|
+
attr_reader :uri_fragment
|
17
|
+
attr_reader :host
|
18
|
+
attr_reader :port
|
19
|
+
attr_reader :content_length
|
20
|
+
attr_reader :hdr_connection
|
21
|
+
attr_reader :hdr_upgrade
|
22
|
+
attr_reader :hdr_origin
|
23
|
+
attr_reader :hdr_sec_websocket_version
|
24
|
+
attr_reader :hdr_sec_websocket_key
|
25
|
+
attr_reader :hdr_sec_websocket_protocol
|
26
|
+
|
27
|
+
|
28
|
+
LOG_ID = "HTTP WS Request"
|
29
|
+
def log_id
|
30
|
+
LOG_ID
|
31
|
+
end
|
32
|
+
|
33
|
+
def unknown_method? ; @is_unknown_method end
|
34
|
+
|
35
|
+
|
36
|
+
def reply status_code, reason_phrase=nil, extra_headers={}
|
37
|
+
reason_phrase ||= REASON_PHRASE[status_code] || REASON_PHRASE_NOT_SET
|
38
|
+
extra_headers ||= {}
|
39
|
+
|
40
|
+
response = "#{@http_version} #{status_code} #{reason_phrase}\r\n"
|
41
|
+
|
42
|
+
extra_headers.each {|header| response << header << "\r\n"}
|
43
|
+
|
44
|
+
response << HDR_SERVER << "\r\n\r\n"
|
45
|
+
|
46
|
+
log_system_debug "replying #{status_code} \"#{reason_phrase}\"" if $oversip_debug
|
47
|
+
|
48
|
+
if @connection.error?
|
49
|
+
log_system_warn "cannot send response, connection is closed"
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
|
53
|
+
@connection.send_data response
|
54
|
+
return true
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
module Launcher
|
4
|
+
|
5
|
+
extend ::OverSIP::Logger
|
6
|
+
|
7
|
+
IP_TYPE = {
|
8
|
+
:ipv4 => "IPv4",
|
9
|
+
:ipv6 => "IPv6"
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
@log_id = "WebSocket launcher"
|
14
|
+
|
15
|
+
|
16
|
+
def self.run enabled, ip_type, ip, port, transport, virtual_ip=nil, virtual_port=nil
|
17
|
+
uri_ip = case ip_type
|
18
|
+
when :ipv4 ; ip
|
19
|
+
when :ipv6 ; "[#{ip}]"
|
20
|
+
end
|
21
|
+
|
22
|
+
if virtual_ip
|
23
|
+
uri_virtual_ip = case ip_type
|
24
|
+
when :ipv4 ; virtual_ip
|
25
|
+
when :ipv6 ; "[#{virtual_ip}]"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
klass = case transport
|
30
|
+
when :ws
|
31
|
+
case ip_type
|
32
|
+
when :ipv4 ; ::OverSIP::WebSocket::IPv4WsServer
|
33
|
+
when :ipv6 ; ::OverSIP::WebSocket::IPv6WsServer
|
34
|
+
end
|
35
|
+
when :wss
|
36
|
+
case ip_type
|
37
|
+
when :ipv4 ; ::OverSIP::WebSocket::IPv4WssServer
|
38
|
+
when :ipv6 ; ::OverSIP::WebSocket::IPv6WssServer
|
39
|
+
end
|
40
|
+
when :wss_tunnel
|
41
|
+
case ip_type
|
42
|
+
when :ipv4 ; ::OverSIP::WebSocket::IPv4WssTunnelServer
|
43
|
+
when :ipv6 ; ::OverSIP::WebSocket::IPv6WssTunnelServer
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
klass.ip = virtual_ip || ip
|
48
|
+
klass.port = virtual_port || port
|
49
|
+
|
50
|
+
case
|
51
|
+
|
52
|
+
when klass == ::OverSIP::WebSocket::IPv4WsServer
|
53
|
+
if ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
54
|
+
used_uri_host = ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
55
|
+
else
|
56
|
+
used_uri_host = uri_ip
|
57
|
+
end
|
58
|
+
klass.via_core = "SIP/2.0/WS #{used_uri_host}:#{port}"
|
59
|
+
klass.record_route = "<sip:#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
60
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
61
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
62
|
+
|
63
|
+
if enabled
|
64
|
+
::EM.start_server(ip, port, klass) do |conn|
|
65
|
+
conn.post_connection
|
66
|
+
conn.set_comm_inactivity_timeout 7200
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
when klass == ::OverSIP::WebSocket::IPv6WsServer
|
71
|
+
if ::OverSIP.configuration[:websocket][:advertised_ipv6]
|
72
|
+
used_uri_host = "[#{::OverSIP.configuration[:websocket][:advertised_ipv6]}]"
|
73
|
+
else
|
74
|
+
used_uri_host = uri_ip
|
75
|
+
end
|
76
|
+
klass.via_core = "SIP/2.0/WS #{used_uri_host}:#{port}"
|
77
|
+
klass.record_route = "<sip:#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
78
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
79
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
80
|
+
|
81
|
+
if enabled
|
82
|
+
::EM.start_server(ip, port, klass) do |conn|
|
83
|
+
conn.post_connection
|
84
|
+
conn.set_comm_inactivity_timeout 7200
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
when klass == ::OverSIP::WebSocket::IPv4WssServer
|
89
|
+
if ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv4]
|
90
|
+
used_uri_host = ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv4]
|
91
|
+
elsif ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
92
|
+
used_uri_host = ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
93
|
+
else
|
94
|
+
used_uri_host = uri_ip
|
95
|
+
end
|
96
|
+
klass.via_core = "SIP/2.0/WS #{used_uri_host}:#{port}"
|
97
|
+
klass.record_route = "<sip:#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
98
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
99
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
100
|
+
|
101
|
+
if enabled
|
102
|
+
::EM.start_server(ip, port, klass) do |conn|
|
103
|
+
conn.post_connection
|
104
|
+
conn.set_comm_inactivity_timeout 7200
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
when klass == ::OverSIP::WebSocket::IPv6WssServer
|
109
|
+
if ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv6]
|
110
|
+
used_uri_host = ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv6]
|
111
|
+
elsif ::OverSIP.configuration[:websocket][:advertised_ipv6]
|
112
|
+
used_uri_host = "[#{::OverSIP.configuration[:websocket][:advertised_ipv6]}]"
|
113
|
+
else
|
114
|
+
used_uri_host = uri_ip
|
115
|
+
end
|
116
|
+
klass.via_core = "SIP/2.0/WS #{used_uri_host}:#{port}"
|
117
|
+
klass.record_route = "<sip:#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
118
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
119
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{port};transport=ws;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
120
|
+
|
121
|
+
if enabled
|
122
|
+
::EM.start_server(ip, port, klass) do |conn|
|
123
|
+
conn.post_connection
|
124
|
+
conn.set_comm_inactivity_timeout 7200
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
when klass == ::OverSIP::WebSocket::IPv4WssTunnelServer
|
129
|
+
if ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv4]
|
130
|
+
used_uri_host = ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv4]
|
131
|
+
elsif ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
132
|
+
used_uri_host = ::OverSIP.configuration[:websocket][:advertised_ipv4]
|
133
|
+
else
|
134
|
+
used_uri_host = uri_virtual_ip
|
135
|
+
end
|
136
|
+
klass.via_core = "SIP/2.0/WSS #{used_uri_host}:#{virtual_port}"
|
137
|
+
klass.record_route = "<sip:#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
138
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
139
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
140
|
+
|
141
|
+
if enabled
|
142
|
+
::EM.start_server(ip, port, klass) do |conn|
|
143
|
+
conn.post_connection
|
144
|
+
conn.set_comm_inactivity_timeout 7200
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
when klass == ::OverSIP::WebSocket::IPv6WssTunnelServer
|
149
|
+
if ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv6]
|
150
|
+
used_uri_host = ::OverSIP.configuration[:sip][:record_route_hostname_tls_ipv6]
|
151
|
+
elsif ::OverSIP.configuration[:websocket][:advertised_ipv6]
|
152
|
+
used_uri_host = "[#{::OverSIP.configuration[:websocket][:advertised_ipv6]}]"
|
153
|
+
else
|
154
|
+
used_uri_host = uri_virtual_ip
|
155
|
+
end
|
156
|
+
klass.via_core = "SIP/2.0/WSS #{used_uri_host}:#{virtual_port}"
|
157
|
+
klass.record_route = "<sip:#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
158
|
+
klass.outbound_record_route_fragment = "@#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid}>"
|
159
|
+
klass.outbound_path_fragment = "@#{used_uri_host}:#{virtual_port};transport=wss;lr;ovid=#{OverSIP::SIP::Tags.value_for_route_ovid};ob>"
|
160
|
+
|
161
|
+
if enabled
|
162
|
+
::EM.start_server(ip, port, klass) do |conn|
|
163
|
+
conn.post_connection
|
164
|
+
conn.set_comm_inactivity_timeout 7200
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end # case
|
169
|
+
|
170
|
+
transport_str = case transport
|
171
|
+
when :tls_tunnel ; "TLS-Tunnel"
|
172
|
+
else ; transport.to_s.upcase
|
173
|
+
end
|
174
|
+
|
175
|
+
if enabled
|
176
|
+
log_system_info "WebSocket #{transport_str} server listening on #{IP_TYPE[ip_type]} #{uri_ip}:#{port} provides '#{::OverSIP::WebSocket::WS_SIP_PROTOCOL}' WS subprotocol"
|
177
|
+
end
|
178
|
+
|
179
|
+
end # def self.run
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class Connection < ::EM::Connection
|
4
|
+
|
5
|
+
include ::OverSIP::Logger
|
6
|
+
include ::OverSIP::SIP::MessageProcessor
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :ip_type, :ip, :port, :transport,
|
10
|
+
:via_core,
|
11
|
+
:record_route,
|
12
|
+
:outbound_record_route_fragment, :outbound_path_fragment,
|
13
|
+
:connections,
|
14
|
+
:invite_server_transactions, :non_invite_server_transactions,
|
15
|
+
:invite_client_transactions, :non_invite_client_transactions
|
16
|
+
|
17
|
+
def reliable_transport_listener?
|
18
|
+
@is_reliable_transport_listener
|
19
|
+
end
|
20
|
+
|
21
|
+
def outbound_listener?
|
22
|
+
@is_outbound_listener
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
attr_reader :cvars
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@buffer = ::IO::Buffer.new
|
31
|
+
@state = :init
|
32
|
+
@cvars = {}
|
33
|
+
end
|
34
|
+
|
35
|
+
def open?
|
36
|
+
! error?
|
37
|
+
end
|
38
|
+
|
39
|
+
def close status=nil, reason=nil
|
40
|
+
# When in WebSocket protocol send a close control frame before closing
|
41
|
+
# the connection.
|
42
|
+
if @state == :websocket
|
43
|
+
@ws_framing.send_close_frame status, reason
|
44
|
+
end
|
45
|
+
|
46
|
+
close_connection_after_writing
|
47
|
+
@state = :ignore
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv4WsServer < WsServer
|
4
|
+
|
5
|
+
@ip_type = :ipv4
|
6
|
+
@transport = :ws
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WS IPv4 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv4WssServer < WssServer
|
4
|
+
|
5
|
+
@ip_type = :ipv4
|
6
|
+
@transport = :wss
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WSS IPv4 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv4WssTunnelServer < WssTunnelServer
|
4
|
+
|
5
|
+
@ip_type = :ipv4
|
6
|
+
@transport = :wss
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WSS-Tunnel IPv4 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv6WsServer < WsServer
|
4
|
+
|
5
|
+
@ip_type = :ipv6
|
6
|
+
@transport = :ws
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WS IPv6 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv6WssServer < WssServer
|
4
|
+
|
5
|
+
@ip_type = :ipv6
|
6
|
+
@transport = :wss
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WSS IPv6 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module OverSIP::WebSocket
|
2
|
+
|
3
|
+
class IPv6WssTunnelServer < WssTunnelServer
|
4
|
+
|
5
|
+
@ip_type = :ipv6
|
6
|
+
@transport = :wss
|
7
|
+
@connections = {}
|
8
|
+
@invite_server_transactions = {}
|
9
|
+
@non_invite_server_transactions = {}
|
10
|
+
@invite_client_transactions = {}
|
11
|
+
@non_invite_client_transactions = {}
|
12
|
+
@is_reliable_transport_listener = true
|
13
|
+
@is_outbound_listener = true
|
14
|
+
|
15
|
+
LOG_ID = "SIP WSS-Tunnel IPv6 server"
|
16
|
+
def log_id
|
17
|
+
LOG_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|