From c7c2cffbbf94e7be1c0ce5ec69de136750ffe322 Mon Sep 17 00:00:00 2001 From: aforge Date: Mon, 27 Jun 2022 18:26:21 +0300 Subject: [PATCH] Reject new incoming calls when a call is in progress. --- src/views/tinode-web.jsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/views/tinode-web.jsx b/src/views/tinode-web.jsx index 9bd5ebe5..6dda91a8 100644 --- a/src/views/tinode-web.jsx +++ b/src/views/tinode-web.jsx @@ -1783,12 +1783,18 @@ class TinodeWeb extends React.Component { switch (info.event) { case 'invite': if (info.from != this.state.myUserId) { - // Incoming call. - this.setState({ - callTopic: info.src, - callState: CALL_STATE_INCOMING_RECEIVED, - callSeq: info.seq - }); + if (this.state.callState == CALL_STATE_NONE) { + // Incoming call. + this.setState({ + callTopic: info.src, + callState: CALL_STATE_INCOMING_RECEIVED, + callSeq: info.seq + }); + } else { + // Another call is either in progress or being established. + // Reject the incoming call. + this.handleCallHangup(info.src, info.seq); + } } break; case 'accept':