I am seeking a solution to address the issue of Twilio calls ending when the browser is closed. I want to implement a mechanism to prevent call termination upon browser closure.
I am currently developing a Twilio calling feature based on the reference provided: https://github.com/TwilioDevEd/voice-javascript-sdk-quickstart-node. The calling functionality works well, but I encounter an issue when closing the browser or terminating the Progressive Web Application (PWA); my calls are being disconnected.
I have implemented notifications for call status changes using webhooks, and they work until the call is disconnected. Now, I am looking for a solution to manage the calling session in Node.js. Is it possible to handle this type of situation, and if so, how can it be achieved?
Unfortunately, you can't as the browser is required to keep the websocket open. This is a browser issue and not a Twilio issue. Your option is to find a way to get the browser to ask the person not to close the tab or window. This post offers some suggestions on "Confirmation Before Closing Of Tab Browser".
What we do instead is use an SIP hardphone (like a Polycom) or a SIP softphone. The browser is used to control the phone but the connection is maintained within the SIP hardphone/software.
There is likely a way to use a Conference to keep a call active even if the agent's browser client session ends and then re-join that Conference but the caller would just sit there waiting for the agent to return which is a not great customer service experience.