WebRTC timeout disconnects every 32 seconds - even with keepalive

We are currently making calls through WebRTC successfully with Asterisk 15.2.2.

However, for every client connected, we receive a timeout error every 32 seconds.
The call is NOT dropped.
The client reconnects immediately afterwards.

We have verified and the client, sipjs 0.10.0, sends a keep-alive every 15 seconds.
The content is \r\n\r\n.

We have experimented with values of keep_alive_interval in the Asterisk settings of 0, 15, 30 and 90 seconds, with no difference in behavior.

How to get rid of these constant disconnections?

Here is an excerpt of our logs

[2019-03-12 09:37:00] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Contact XXXX/sip:klje1b08@YYY.YYY.YYY.YYY:7645;transport=ws has been created
[2019-03-12 09:37:00] VERBOSE[1260] res_pjsip_registrar.c: Added contact 'sip:klje1b08@YYY.YYY.YYY.YYY:7645;transport=ws' to AOR 'XXXX' with expiration of 600 seconds
[2019-03-12 09:37:00] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Endpoint XXXX is now Reachable
[2019-03-12 09:37:00] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Contact XXXX/sip:klje1b08@YYY.YYY.YYY.YYY:7645;transport=ws is now Reachable.  RTT: 284.737 msec
[2019-03-12 09:37:31] NOTICE[1276] res_pjsip_transport_management.c: Shutting down transport 'WSS to YYY.YYY.YYY.YYY:7645' since no request was received in 32 seconds
[2019-03-12 09:37:31] VERBOSE[1276] res_pjsip_registrar.c: Removed contact 'sip:klje1b08@YYY.YYY.YYY.YYY:7645;transport=ws' from AOR 'XXXX' due to transport shutdown
[2019-03-12 09:37:31] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Contact XXXX/sip:klje1b08@YYY.YYY.YYY.YYY:7645;transport=ws has been deleted
[2019-03-12 09:37:31] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Endpoint XXXX is now Unreachable
[2019-03-12 09:37:31] WARNING[5691] res_http_websocket.c: Web socket closed abruptly
[2019-03-12 09:37:31] ERROR[5691] iostream.c: SSL_shutdown() failed: error:00000005:lib(0):func(0):DH lib, Underlying BIO error: Broken pipe
[2019-03-12 09:37:31] VERBOSE[5691] res_http_websocket.c: WebSocket connection from 'YYY.YYY.YYY.YYY:7645' closed
[2019-03-12 09:37:34] VERBOSE[5767] res_http_websocket.c: WebSocket connection from 'YYY.YYY.YYY.YYY:7747' for protocol 'sip' accepted using version '13'
[2019-03-12 09:37:35] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Contact XXXX/sip:klje1b08@YYY.YYY.YYY.YYY:7747;transport=ws has been created
[2019-03-12 09:37:35] VERBOSE[1260] res_pjsip_registrar.c: Added contact 'sip:klje1b08@YYY.YYY.YYY.YYY:7747;transport=ws' to AOR 'XXXX' with expiration of 600 seconds
[2019-03-12 09:37:35] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Endpoint XXXX is now Reachable
[2019-03-12 09:37:35] VERBOSE[1267] res_pjsip/pjsip_configuration.c: Contact XXXX/sip:klje1b08@YYY.YYY.YYY.YYY:7747;transport=ws is now Reachable.  RTT: 234.215 msec

Long shot here, but do you have the dtls_rekey (pjsip.conf) or dtlsrekey (sip.conf) set in your configuration? If a value > 0 then it will try to renegotiate the TLS session at that interval. Failing renegotiation I’m guessing it’d disconnect.

Hi kharwell,

I appreciate you taking the time to respond.

We have experimented with latest Asterisk 16.2 and it seems that it is now accepting keep-alives.

We will run more tests with the values you recommend and get back to you.

I confirm that 16.2.2 solves this problem.
It accepts our keep-alives and there are no more disconnections.

Hello, I have the same issue. Asterisk version is 16.10. Tried to change dtls_rekey to another value, but that’s not help. How did you fix that? What’s options was changed at the pjsip.conf?