Using the embeddable framework, I have edited the framework.js file to add an event listener on the End Call button. For example:
endCallButton.addEventListener('click', confirmEndCall);
function confirmEndCall(event) {
if(confirm("Do you really want to end the call?")) {
return true;
} else {
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
return false;
}
}
I know the event listener is working because I receive the confirmation prompt. But the call still ends, regardless of what I choose in the confirmation, or even if I don't answer the confirmation, the call will end in the background. I have tried the following code in my confirmEndCall function, to try and simply make the End Call button do nothing:
function confirmEndCall(event) {
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
return false;
}
There is an event available in the embeddable framework for when the call ends, which I can subscribe to, but by the time that event fires, it's too late and the call has already ended. Is there an event such as beforeEndCall? Or any other creative solutions anyone has to stop the call ending immediately when the button is clicked.