Broken SIP message standard
Sip messages not recognizing a double-CRLF sequence
in order to work properly and keep socket live state ( for Opensips )
you should send OPTION message . without that socket will close as not getting response from proxy server possible solution
Before /** * Send a keep-alive (a double-CRLF sequence). / sendKeepAlive() { if (this.keepAliveDebounceTimeout) { // We already have an outstanding keep alive, do not send another. return Promise.resolve(); } this.keepAliveDebounceTimeout = setTimeout(() => { this.clearKeepAliveTimeout(); }, this.configuration.keepAliveDebounce * 1000); return this.send("\r\n\r\n"); } /* * Start sending keep-alives. */
After
sendKeepAlive() {
if (this.keepAliveDebounceTimeout) {
return Promise.resolve();
}
this.keepAliveDebounceTimeout = setTimeout(() => {
this.clearKeepAliveTimeout();
}, this.configuration.keepAliveDebounce * 1e3);
const randomString = Math.random().toString(36).substring(7);
const prox = "xxxxxxx"
const toFrom = "xxxxx"
const optionsRequest = `OPTIONS sip:${prox} SIP/2.0\r\n` +
`Via: SIP/2.0/WSS xxxxx;branch=z9hG4bK` + randomString + `\r\n` +
`From: <sip:${toFrom}@${prox}>\r\n` +
`To: <sip:${toFrom}@${prox}>\r\n` +
`Call-ID: `+ randomString +`\r\n` +
`CSeq: 1 OPTIONS\r\n`;
return this.send(optionsRequest.toString());
}
https://opensips.org/html/docs/modules/devel/proto_tls.html#param_tls_crlf_pingpong
if you using proto_wss ? I don't think it will work
If it doesn't work then OpenSIPS should add support for it.
Edit: https://www.rfc-editor.org/rfc/rfc7118#section-6 and https://www.rfc-editor.org/rfc/rfc5626#section-4.4.1