From bc7b12cd73617b52c3dae041d265ccbeb76dedb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 26 Jan 2023 15:03:09 -0500 Subject: [PATCH] manager: fix double call at the same time GitLab: #743 Change-Id: I5a0313f21aa2044bf9e20c96ed4f597cc9ca2859 --- src/manager.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/manager.cpp b/src/manager.cpp index db984b454c..b6a43b60c6 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -2543,13 +2543,12 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i [this, incomCall = incomCall.shared_from_this()] { base_.answerCall(*incomCall); }); } else if (currentCall && currentCall->getCallId() != incomCallId) { // Test if already calling this person + auto peerNumber = incomCall.getPeerNumber(); + auto currentPeerNumber = currentCall->getPeerNumber(); + string_replace(peerNumber, "@ring.dht", ""); + string_replace(currentPeerNumber, "@ring.dht", ""); if (currentCall->getAccountId() == account->getAccountID() - && currentCall->getPeerNumber() == incomCall.getPeerNumber()) { - auto device_uid = account->getUsername(); - if (device_uid.find("ring:") == 0) { - // NOTE: in case of a SIP call it's already ready to compare - device_uid = device_uid.substr(5); // after ring: - } + && currentPeerNumber == peerNumber) { auto answerToCall = false; auto downgradeToAudioOnly = currentCall->isAudioOnly() != incomCall.isAudioOnly(); if (downgradeToAudioOnly) @@ -2557,7 +2556,7 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i answerToCall = incomCall.isAudioOnly(); else // Accept the incoming call from the higher id number - answerToCall = (device_uid.compare(incomCall.getPeerNumber()) < 0); + answerToCall = (account->getUsername().compare(peerNumber) < 0); if (answerToCall) { runOnMainThread([accountId = currentCall->getAccountId(), -- GitLab