# With the chan\_websocket support, is there a frequency or ping setting to detect when the connection is not working

**URL:** <https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913>\
**Category:** Asterisk APIs\
**Created:** [May 13, 2026, 7:45pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913 "2026-05-13T19:45:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanCropp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/dancropp/32/9196_2.png) [@DanCropp](https://community.asterisk.org/u/DanCropp)\
**Post date:** [May 13, 2026, 7:45pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/1 "2026-05-13T19:45:17Z")

</div>

We perform the Dial websocket and the connection is established. Audio is flowing in both directions.

For reliability, we are now testing what happens when the connection between Asterisk and other end of the WebSocket drops. In SIP the SIP OPTIONS and frequency settings come into play. Are there any similar settings for the chan\_websocket support?

I’m checking to see if our QA person plugged the cable back in after 5 minutes and 2 seconds and the other side closed the connection?  
Or if that’s when Asterisk detected the error and closed it?

[05/13 17:48:50.836] DEBUG[1302][C-00000001] iostream.c: TLS transport or SSL error writing data: error:00000005:lib(0)::reason(5), Underlying BIO error: Connection reset by peer  
[05/13 17:48:50.836] DEBUG[1302][C-00000001] res\_http\_websocket.c: Closing WS with 1011 because we can’t fulfill a write request  
[05/13 17:48:50.836] DEBUG[1302][C-00000001] iostream.c: TLS transport or SSL error writing data: error:00000001:lib(0)::reason(1), Internal SSL error  
[05/13 17:48:50.836] DEBUG[1301] chan\_websocket.c: WebSocket/IS\_\_1/0x7f7134025800: HANGUP by websocket close/error

[IS\_\_1]  
type = websocket\_client  
uri = wss://staging.amtelcoservices.com/mediaSessions/asterisk-audio  
protocols = media  
username = ourusername  
password = ourpassword  
connection\_type = per\_call\_config  
tls\_enabled = yes  
connection\_timeout = 500  
reconnect\_attempts = 4  
reconnect\_interval = 500  
verify\_server\_cert = no  
verify\_server\_hostname = no

Dan

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 13, 2026, 10:00pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/2 "2026-05-13T22:00:24Z")

</div>

That’s something that the OS can do for you, as such a mechanism is built into TCP, although you may find the defaults are too large, but you can adjust them, in the OS configuration.

However, I don’t think that Asterisk will terminate a normal SIP session just because a qualify, to the same address fails, it will rely on either timing out the arrival of media, which is on a connectionless transport, or use session timers. With normal SIP, over TCP, or TLS, a new connection can be established from either side and will form part of the same session.

---

<div class="post-metadata">

**Author:** ![gjoseph](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/gjoseph/32/1690_2.png) [@gjoseph](https://community.asterisk.org/u/gjoseph)\
**Post date:** [May 14, 2026, 3:35pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/3 "2026-05-14T15:35:02Z")

</div>

This topic is timely. I’m working on the websocket client now to add support for forward proxies and have also added support for sending TCP keepalives. A pull request should be up in the next few days.

---

<div class="post-metadata">

**Author:** ![seanbright](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/seanbright/32/9799_2.png) [@seanbright](https://community.asterisk.org/u/seanbright)\
**Post date:** [May 14, 2026, 4:20pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/4 "2026-05-14T16:20:25Z")

</div>

The WebSocket protocol specifies a ping/pong mechanism. I presume that is what you’re implementing?

---

<div class="post-metadata">

**Author:** ![gjoseph](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/gjoseph/32/1690_2.png) [@gjoseph](https://community.asterisk.org/u/gjoseph)\
**Post date:** [May 14, 2026, 4:21pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/5 "2026-05-14T16:21:28Z")

</div>

I’m implementing both PING/PONG and socket-level TCP keepalives.

---

<div class="post-metadata">

**Author:** ![DanCropp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/dancropp/32/9196_2.png) [@DanCropp](https://community.asterisk.org/u/DanCropp)\
**Post date:** [May 14, 2026, 7:35pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/6 "2026-05-14T19:35:42Z")

</div>

Thanks George.

---

<div class="post-metadata">

**Author:** ![gjoseph](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/gjoseph/32/1690_2.png) [@gjoseph](https://community.asterisk.org/u/gjoseph)\
**Post date:** [May 18, 2026, 7:31pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/7 "2026-05-18T19:31:18Z")

</div>

@DanCropp PR [#1934](https://github.com/asterisk/asterisk/pull/1934) that provides support for keepalives is up on github. Please take a look and test if you can. Use the PR for feedback or questions to keep things consolidated.

---

<div class="post-metadata">

**Author:** ![gjoseph](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/gjoseph/32/1690_2.png) [@gjoseph](https://community.asterisk.org/u/gjoseph)\
**Post date:** [May 19, 2026, 8:40pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/8 "2026-05-19T20:40:05Z")

</div>

PR #1934 has been replaced with PR [#1937](https://github.com/asterisk/asterisk/pull/1937) which doesn’t have a dependency on curl.

---

<div class="post-metadata">

**Author:** ![DanCropp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/dancropp/32/9196_2.png) [@DanCropp](https://community.asterisk.org/u/DanCropp)\
**Post date:** [May 27, 2026, 5:00pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/9 "2026-05-27T17:00:27Z")

</div>

Thanks @gjoseph . I built a version with the pull request. Sent it to our testers with instructions. I will let you know what they find.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [June 26, 2026, 5:00pm UTC](https://community.asterisk.org/t/with-the-chan-websocket-support-is-there-a-frequency-or-ping-setting-to-detect-when-the-connection-is-not-working/112913/10 "2026-06-26T17:00:33Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
