From 6c4a257200bd73b4381151a7c8073373e4a77200 Mon Sep 17 00:00:00 2001
From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com>
Date: Fri, 11 Aug 2023 15:06:25 +0200
Subject: [PATCH] A remote conference can trasfer a call from a participant to
 a focus if the remote contact address if not null when the call state is
 StreamRunning or Paused and the conference is in state Created or
 CreationPending

Add "LeaksMemory" to "Core restarts as soon as chat room is created"
---
 coreapi/remote_conference.cpp          | 4 ++--
 tester/audio_video_conference_tester.c | 3 +++
 tester/group_chat_tester.c             | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/coreapi/remote_conference.cpp b/coreapi/remote_conference.cpp
index 175e8c4067..09d5f72f21 100644
--- a/coreapi/remote_conference.cpp
+++ b/coreapi/remote_conference.cpp
@@ -1040,11 +1040,11 @@ void RemoteConference::onPendingCallStateChanged(std::shared_ptr<LinphonePrivate
 				if (((focusCallState == CallSession::State::StreamsRunning) ||
 				     (focusCallState == CallSession::State::Connected) ||
 				     (focusCallState == CallSession::State::UpdatedByRemote)) &&
-				    ((getState() == ConferenceInterface::State::CreationPending) ||
+				    ((state == ConferenceInterface::State::CreationPending) ||
 				     (state == ConferenceInterface::State::Created))) {
 					// Transfer call only if focus call remote contact address is available (i.e. the call has been
 					// correctly established and passed through state StreamsRunning)
-					if (!session->getRemoteContactAddress()) {
+					if (session->getRemoteContactAddress()) {
 						m_pendingCalls.remove(call);
 						transferToFocus(call);
 					}
diff --git a/tester/audio_video_conference_tester.c b/tester/audio_video_conference_tester.c
index d024c33517..9ae4d22297 100644
--- a/tester/audio_video_conference_tester.c
+++ b/tester/audio_video_conference_tester.c
@@ -945,6 +945,9 @@ static void simple_conference_notify_speaking_device(void) {
 	                             initial_laure_stat.number_of_LinphoneCallStreamsRunning + 1, 2000));
 	BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning,
 	                             initial_marie_stat.number_of_LinphoneCallStreamsRunning + 2, 3000));
+	BC_ASSERT_FALSE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallPausedByRemote,
+	                              initial_laure_stat.number_of_LinphoneCallPausedByRemote + 1, 2000));
+	BC_ASSERT_EQUAL(laure->stat.number_of_LinphoneCallPausedByRemote, 0, int, "%d");
 
 	// Set Laure is_speaking callback for all participants to check that pauline is speaking
 	LinphoneConference *laure_conf = linphone_call_get_conference(linphone_core_get_current_call(laure->lc));
diff --git a/tester/group_chat_tester.c b/tester/group_chat_tester.c
index 9ffd387d2f..2b75aa91e5 100644
--- a/tester/group_chat_tester.c
+++ b/tester/group_chat_tester.c
@@ -8977,7 +8977,7 @@ static void group_chat_room_message_sync_between_devices_with_same_identity(void
 
 test_t group_chat_tests[] = {
     TEST_NO_TAG("Chat room params", group_chat_room_params),
-    TEST_NO_TAG("Core restarts as soon as chat room is created", group_chat_room_creation_core_restart),
+    TEST_ONE_TAG("Core restarts as soon as chat room is created", group_chat_room_creation_core_restart, "LeaksMemory"),
     TEST_NO_TAG("Chat room with forced local identity", group_chat_room_creation_with_given_identity),
     TEST_NO_TAG("Group chat room creation server", group_chat_room_creation_server),
     TEST_NO_TAG("Network down while creating group chat room", group_chat_room_creation_server_network_down),
-- 
GitLab