From 32320905956ef44bfa27fa740f92a28cd117e2b0 Mon Sep 17 00:00:00 2001 From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com> Date: Fri, 10 Jan 2025 11:39:20 +0100 Subject: [PATCH] Do not add parameter admin=1 to the contact parameters of the conference organizer --- coreapi/local_conference.cpp | 16 ++++++++++++---- src/conference/session/call-session.cpp | 6 ------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/coreapi/local_conference.cpp b/coreapi/local_conference.cpp index 50377bd042..1127d0163d 100644 --- a/coreapi/local_conference.cpp +++ b/coreapi/local_conference.cpp @@ -1265,7 +1265,7 @@ bool LocalConference::addParticipant(std::shared_ptr<LinphonePrivate::Call> call const_cast<LinphonePrivate::MediaSessionParams *>(call->getParams())->enableVideo(false); } - Conference::addParticipant(call); + bool success = Conference::addParticipant(call); const auto &participant = findParticipant(session->getRemoteAddress()); LinphoneMediaDirection audioDirection = LinphoneMediaDirectionInactive; @@ -1286,6 +1286,17 @@ bool LocalConference::addParticipant(std::shared_ptr<LinphonePrivate::Call> call videoDirection = LinphoneMediaDirectionInactive; break; } + + auto &mainDb = getCore()->getPrivate()->mainDb; + if (success && conferenceAddress && mainDb) { + auto conferenceInfo = mainDb->getConferenceInfoFromURI(conferenceAddress); + if (conferenceInfo) { + const auto &organizerAddress = conferenceInfo->getOrganizerAddress(); + if (organizerAddress && organizerAddress->weakEqual(*participant->getAddress())) { + setParticipantAdminStatus(participant, true); + } + } + } } const_cast<LinphonePrivate::MediaSessionParams *>(call->getParams())->setAudioDirection(audioDirection); @@ -2030,9 +2041,6 @@ void LocalConference::callStateChangedCb(LinphoneCore *lc, } } } - bool admin = remoteContactAddress->hasParam("admin") && - Utils::stob(remoteContactAddress->getParamValue("admin")); - setParticipantAdminStatus(participant, admin); } else { lError() << "Unable to update admin status and device address as no participant with address " << *remoteAddress << " has been found in conference " << *getConferenceAddress(); diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index 8155a55294..427d397f87 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -2086,12 +2086,6 @@ void CallSession::updateContactAddress(Address &contactAddress) const { } } #endif - - if (organizer) { - const auto localAddress = getLocalAddress(); - isAdmin = (organizer->weakEqual(*localAddress)); - contactAddress.setParam("admin", Utils::toString(isAdmin)); - } } } -- GitLab