When we exit the web browser (click x button on browser).
The call channel is NOT disconnected in Asterisk.
We are looking for a way to drop the call immediately when Web Browser is exited.
We intent to send a BYE from Browserphone, but the problem is that, when Web browser is exited, we can’t catch any events for triggering a BYE
We tried to monitor the WSS connection from Kamailio but it seems that Kamailio is a Proxy which just forward the message, we could not send a BYE from Kamailio
Is there any way to catch the WSS connection from Asterisk ?
I meant, when WSS connection is disconnected, is there any event like AMI… which we can catch from AMI or dialplan interface and then trigger a script to send a BYE to disconnect the call ?
You can get it to eventually drop using an RTP timeout. I don’t know if session timers work with WebRTC, but if they do, you could set a short timeout.
Actually we already proposed this solution to our Customer but they did not agree.
They want the call to be terminated immediately when the web browser is exited.
A WebSocket server is really quite a separate thing from a Web server–different port, different protocol, different behaviour.
I assume you have control over the pages being served through the Web server? So you can include the necessary scripting to manage the WebSocket connection? I don’t think you need to do any more than periodically ping it to confirm the application is still live–as soon as that stops, you know the page has been closed.
Please give us the info you got. We are also facing the same problem. Calls need to be terminated immediately after a web socket connection breaks within a user agent.
Here is a very simple example Python script, using ASGI, to demonstrate how to have a Web page that keeps a WebSocket connection alive as long as it is open in the browser. Soon as the page is closed, the WebSocket disconnects, and you can take whatever action you like–here it just logs an informational message.