1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 23:05:48 +02:00

misc: fix call hold

GitLab: https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/769

Change-Id: I209215e0f81fe0e810a5cf243f122db9bb7065b6
This commit is contained in:
Aline Gondim Santos 2022-09-29 18:49:37 -03:00
parent 7fb102ed45
commit 3250c0298b
6 changed files with 46 additions and 35 deletions

View file

@ -111,9 +111,9 @@ LRCInstance::isConnected()
} }
VectorString VectorString
LRCInstance::getActiveCalls() LRCInstance::getActiveCalls(const QString& accountId)
{ {
return lrc_->activeCalls(); return lrc_->activeCalls(accountId);
} }
int int

View file

@ -83,7 +83,7 @@ public:
void subscribeToDebugReceived(); void subscribeToDebugReceived();
bool isConnected(); bool isConnected();
void connectivityChanged(); void connectivityChanged();
VectorString getActiveCalls(); VectorString getActiveCalls(const QString& accountId = "");
int notificationsCount() const; int notificationsCount() const;
const account::Info& getAccountInfo(const QString& accountId); const account::Info& getAccountInfo(const QString& accountId);

View file

@ -194,7 +194,7 @@ UtilsAdapter::getAccountListSize()
bool bool
UtilsAdapter::hasCall(const QString& accountId) UtilsAdapter::hasCall(const QString& accountId)
{ {
auto activeCalls = lrcInstance_->getActiveCalls(); auto activeCalls = lrcInstance_->getActiveCalls(accountId);
for (const auto& callId : activeCalls) { for (const auto& callId : activeCalls) {
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(accountId); auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
if (accountInfo.callModel->hasCall(callId)) { if (accountInfo.callModel->hasCall(callId)) {
@ -208,7 +208,7 @@ const QString
UtilsAdapter::getCallConvForAccount(const QString& accountId) UtilsAdapter::getCallConvForAccount(const QString& accountId)
{ {
// TODO: Currently returning first call, establish priority according to state? // TODO: Currently returning first call, establish priority according to state?
for (const auto& callId : lrcInstance_->getActiveCalls()) { for (const auto& callId : lrcInstance_->getActiveCalls(accountId)) {
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(accountId); auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
if (accountInfo.callModel->hasCall(callId)) { if (accountInfo.callModel->hasCall(callId)) {
return lrcInstance_->getConversationFromCallId(callId, accountId).uid; return lrcInstance_->getConversationFromCallId(callId, accountId).uid;

View file

@ -92,7 +92,7 @@ public:
/** /**
* Helper: get active call list from daemon * Helper: get active call list from daemon
*/ */
static VectorString activeCalls(); static VectorString activeCalls(const QString& accountId = "");
/** /**
* Close all active calls and conferences * Close all active calls and conferences

View file

@ -1060,36 +1060,44 @@ CallModel::setCurrentCall(const QString& callId) const
} }
} }
VectorString filterCalls; QStringList accountList = pimpl_->lrc.getAccountModel().getAccountList();
QStringList conferences = CallManager::instance().getConferenceList(owner.id); // If we are setting a current call in the UI, we want to hold all other calls,
for (const auto& confId : conferences) { // across accounts, to avoid sending our local media streams while another call
QStringList callList = CallManager::instance().getParticipantList(owner.id, confId); // is in focus.
Q_FOREACH (const auto& cid, callList) { for (const auto& acc : accountList) {
filterCalls.push_back(cid); VectorString filterCalls;
// For each account, we should not hold calls linked to a conference
QStringList conferences = CallManager::instance().getConferenceList(acc);
for (const auto& confId : conferences) {
QStringList callList = CallManager::instance().getParticipantList(acc, confId);
Q_FOREACH (const auto& cid, callList) {
filterCalls.push_back(cid);
}
} }
}
for (const auto& cid : Lrc::activeCalls()) { for (const auto& cid : Lrc::activeCalls(acc)) {
auto filtered = std::find(filterCalls.begin(), filterCalls.end(), cid) != filterCalls.end(); auto filtered = std::find(filterCalls.begin(), filterCalls.end(), cid) != filterCalls.end();
if (cid != callId && !filtered) { if (cid != callId && !filtered) {
// Only hold calls for a non rendez-vous point // Only hold calls for a non rendez-vous point
MapStringString callDetails = CallManager::instance().getCallDetails(owner.id, callId); CallManager::instance().hold(acc, cid);
auto accountId = callDetails["ACCOUNTID"]; }
CallManager::instance().hold(owner.id, cid);
} }
}
if (!lrc::api::Lrc::holdConferences) { if (!lrc::api::Lrc::holdConferences) {
return; return;
} }
for (const auto& confId : conferences) { // If the account is the host and it is attached to the conference,
if (callId != confId) { // then we should hold it.
MapStringString confDetails = CallManager::instance().getConferenceDetails(owner.id, for (const auto& confId : conferences) {
confId); if (callId != confId) {
// Only hold conference if attached MapStringString confDetails = CallManager::instance().getConferenceDetails(acc, confId);
if (confDetails["CALL_STATE"] == "ACTIVE_DETACHED") // Only hold conference if attached
continue; if (confDetails["CALL_STATE"] == "ACTIVE_DETACHED")
QStringList callList = CallManager::instance().getParticipantList(owner.id, confId); continue;
if (callList.indexOf(callId) == -1) QStringList callList = CallManager::instance().getParticipantList(acc, confId);
CallManager::instance().holdConference(owner.id, confId); if (callList.indexOf(callId) == -1)
CallManager::instance().holdConference(acc, confId);
}
} }
} }
} }
@ -1372,6 +1380,7 @@ CallModelPimpl::slotCallStateChanged(const QString& accountId,
|| previousStatus == call::Status::OUTGOING_RINGING) { || previousStatus == call::Status::OUTGOING_RINGING) {
if (previousStatus == call::Status::INCOMING_RINGING if (previousStatus == call::Status::INCOMING_RINGING
&& linked.owner.profileInfo.type != profile::Type::SIP && linked.owner.profileInfo.type != profile::Type::SIP
&& !linked.owner.confProperties.autoAnswer
&& !linked.owner.confProperties.isRendezVous) { // TODO remove this when we want to && !linked.owner.confProperties.isRendezVous) { // TODO remove this when we want to
// not show calls in rendez-vous // not show calls in rendez-vous
linked.setCurrentCall(callId); linked.setCurrentCall(callId);

View file

@ -148,11 +148,13 @@ Lrc::subscribeToDebugReceived()
} }
VectorString VectorString
Lrc::activeCalls() Lrc::activeCalls(const QString& accountId)
{ {
VectorString result; VectorString result;
const QStringList accountIds = ConfigurationManager::instance().getAccountList(); const QStringList accountIds = ConfigurationManager::instance().getAccountList();
for (const auto& accId : accountIds) { for (const auto& accId : accountIds) {
if (!accountId.isEmpty() && accountId != accId)
continue;
QStringList callLists = CallManager::instance().getCallList(accId); QStringList callLists = CallManager::instance().getCallList(accId);
for (const auto& call : callLists) { for (const auto& call : callLists) {
MapStringString callDetails = CallManager::instance().getCallDetails(accId, call); MapStringString callDetails = CallManager::instance().getCallDetails(accId, call);