From c3e21b688ce76f1b29d3b15ed1e0b0a114c7622c Mon Sep 17 00:00:00 2001 From: ShiKhu Date: Mon, 12 Jul 2021 17:35:33 +0300 Subject: [PATCH] fix (tracker-assist): not allowing second call simultaneously --- tracker/tracker-assist/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tracker/tracker-assist/src/index.ts b/tracker/tracker-assist/src/index.ts index 21d78684f..8d17a9911 100644 --- a/tracker/tracker-assist/src/index.ts +++ b/tracker/tracker-assist/src/index.ts @@ -31,6 +31,8 @@ export default function(opts: Partial = {}) { let callingPeerDataConn app.attachStartCallback(function() { +// new CallWindow(()=>{console.log('endcall')}); + // @ts-ignore const peerID = `${app.projectKey}-${app.getSessionID()}` const peer = new Peer(peerID, { @@ -83,11 +85,13 @@ export default function(opts: Partial = {}) { dataConn?.send("call_error"); return; } + calling = true; window.addEventListener("beforeunload", () => { dataConn.open && dataConn.send("call_end"); }); dataConn.on('data', (data) => { // if call closed be a caller before confirm if (data === "call_end") { + calling = false; confirm.remove(); } }); @@ -97,10 +101,10 @@ export default function(opts: Partial = {}) { if (!conf || !dataConn.open) { call.close(); dataConn.open && dataConn.send("call_end"); + calling = false; return; } - calling = true; const mouse = new Mouse(); let callUI;