mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 14:55:43 +02:00
misc: fix call hold
GitLab: https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/769 Change-Id: I209215e0f81fe0e810a5cf243f122db9bb7065b6
This commit is contained in:
parent
7fb102ed45
commit
3250c0298b
6 changed files with 46 additions and 35 deletions
|
@ -111,9 +111,9 @@ LRCInstance::isConnected()
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorString
|
VectorString
|
||||||
LRCInstance::getActiveCalls()
|
LRCInstance::getActiveCalls(const QString& accountId)
|
||||||
{
|
{
|
||||||
return lrc_->activeCalls();
|
return lrc_->activeCalls(accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1060,36 +1060,44 @@ CallModel::setCurrentCall(const QString& callId) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList accountList = pimpl_->lrc.getAccountModel().getAccountList();
|
||||||
|
// If we are setting a current call in the UI, we want to hold all other calls,
|
||||||
|
// across accounts, to avoid sending our local media streams while another call
|
||||||
|
// is in focus.
|
||||||
|
for (const auto& acc : accountList) {
|
||||||
VectorString filterCalls;
|
VectorString filterCalls;
|
||||||
QStringList conferences = CallManager::instance().getConferenceList(owner.id);
|
// For each account, we should not hold calls linked to a conference
|
||||||
|
QStringList conferences = CallManager::instance().getConferenceList(acc);
|
||||||
for (const auto& confId : conferences) {
|
for (const auto& confId : conferences) {
|
||||||
QStringList callList = CallManager::instance().getParticipantList(owner.id, confId);
|
QStringList callList = CallManager::instance().getParticipantList(acc, confId);
|
||||||
Q_FOREACH (const auto& cid, callList) {
|
Q_FOREACH (const auto& cid, callList) {
|
||||||
filterCalls.push_back(cid);
|
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;
|
||||||
}
|
}
|
||||||
|
// If the account is the host and it is attached to the conference,
|
||||||
|
// then we should hold it.
|
||||||
for (const auto& confId : conferences) {
|
for (const auto& confId : conferences) {
|
||||||
if (callId != confId) {
|
if (callId != confId) {
|
||||||
MapStringString confDetails = CallManager::instance().getConferenceDetails(owner.id,
|
MapStringString confDetails = CallManager::instance().getConferenceDetails(acc, confId);
|
||||||
confId);
|
|
||||||
// Only hold conference if attached
|
// Only hold conference if attached
|
||||||
if (confDetails["CALL_STATE"] == "ACTIVE_DETACHED")
|
if (confDetails["CALL_STATE"] == "ACTIVE_DETACHED")
|
||||||
continue;
|
continue;
|
||||||
QStringList callList = CallManager::instance().getParticipantList(owner.id, confId);
|
QStringList callList = CallManager::instance().getParticipantList(acc, confId);
|
||||||
if (callList.indexOf(callId) == -1)
|
if (callList.indexOf(callId) == -1)
|
||||||
CallManager::instance().holdConference(owner.id, confId);
|
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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue