Hi Everyone,
We're running Kamailio 5.2.5 with XHTTP, Websocket and TLS extensions - for
the purpose of being able to provide WebRTC capability. The settings for
the HTTP request are quite default as set out below.
The SIP client we're using is SIP5ML in different web browsers. After a
successful start of Kamailio, it is possible to use SIP5ML and its features
- i.e. it REGISTER's properly, calls can be made, etc. After about a few
hours of running, Kamailio refuses to interact and abruptly closes the TCP
connection. The only solution (discovered so far) is to restart Kamailio,
which is not feasible on a server that is serving production needs. (On our
development server, where the load is only a fraction - this problem does
not occur).
When the problems does start to occur, in Wireshark I see:
1) Normal TLS negotiation and certificate exchange; followed by
2) SIP5ML initiating the initial HTTP GET
3) Kamailio responds to the upgrade with a 101/Switch Protocols.
(4- SIP5ML outputs a SIP REGISTER on a defunct socket as its was closed)
Immediately after the 101/Switching Protocol message is received, Kamailio
closes down the TCP connection with a FIN message. Nothing in the message
or Kamailio log files help to identify what module is responsible for this.
Would anyone have any advise where to look further? BTW, I don't see the
TCP connection being Reset in the exchanges - so any advise will be
appreciated.
Tom
event_route[xhttp:request] {
set_reply_close();
set_reply_no_connect();
if ($Rp != 8089) {
xlogl("L_CRIT", "HTTP request received on $Rp\n");
xhttp_reply("403", "Forbidden - 0x24", "", "");
exit;
}
xlogl("L_CRIT", "HTTP Request Received\n");
if ($hdr(Upgrade)=~"websocket"
&& $hdr(Connection)=~"Upgrade"
&& $rm=~"GET") {
# Validate Host - make sure the client is using the correct
# alias for WebSockets
if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {
xlogl("L_CRIT", "Bad host $hdr(Host)\n");
xhttp_reply("403", "Forbidden - 0x25", "", "");
exit;
}
# ws_handle_handshake() exits (no further configuration file
# processing of the request) when complete.
if (ws_handle_handshake())
{
# Optional... cache some information about the
# successful connection
exit;
}
}
xhttp_reply("404", "Resource Not Found - 0x27", "",
"");
}
event_route[websocket:closed] {
xlogl("L_CRIT", "WebSocket connection from $si:$sp has closed\n");
}