From 8a15f18d1c6a1fd9a293bafeb976cbbb12f10edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Fri, 24 Feb 2023 16:25:29 -0500 Subject: [PATCH] conversationmodel: handle double call at the same time If both sides are calling at the same time, the daemon will chose one of the call. We must use this one. https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/743 Change-Id: I09c991c0facf34cf7ed83d8782b7646b3075eed8 --- daemon | 2 +- src/libclient/conversationmodel.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/daemon b/daemon index b256d649..59d063c9 160000 --- a/daemon +++ b/daemon @@ -1 +1 @@ -Subproject commit b256d6495954f929005231139cbb7aa8f8d66f92 +Subproject commit 59d063c94b00f511c331a18c073d8f145924a9fb diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index 06d54f82..43a6d2fe 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -3484,7 +3484,15 @@ ConversationModelPimpl::slotCallStatusChanged(const QString& callId, int code) if (peers.size() != 1) { continue; } - if (peers.front() == call.peerUri) { + if (peers.front() == call.peerUri.remove("ring:")) { + if (!conversation.callId.isEmpty()) { + // If outgoing and incoming happen at the same time, choose the current one. + auto call = linked.owner.callModel->getCall(conversation.callId); + qWarning() << "Double call detected" << call::to_string(call.status) << " - " << conversation.callId; + // Ignore new call in favor of existing one + if (call.status == call::Status::IN_PROGRESS) + return; + } conversation.callId = callId; // Update interaction status invalidateModel(); @@ -3569,7 +3577,8 @@ ConversationModelPimpl::addOrUpdateCallMessage(const QString& callId, } try { auto& conv = getConversationForPeerUri(from).get(); - conv.callId = callId; + if (conv.callId.isEmpty()) + conv.callId = callId; } catch (...) { return; }