mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 08:49:19 +00:00
fix(Conference): better code
This commit is contained in:
parent
646f0fe3b9
commit
d4e89205a0
18 changed files with 48 additions and 58 deletions
|
|
@ -143,52 +143,43 @@ void CallsListModel::terminateAllCalls () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline void joinConference (const shared_ptr<linphone::Call> &call) {
|
||||
if (call->getToHeader("method") != "join-conference")
|
||||
return;
|
||||
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
if (!core->getConference()) {
|
||||
qWarning() << QStringLiteral("Not in a conference. => Responding to `join-conference` as a simple call...");
|
||||
return;
|
||||
}
|
||||
|
||||
shared_ptr<linphone::Conference> conference = core->getConference();
|
||||
const QString conferenceId = ::Utils::coreStringToAppString(call->getToHeader("conference-id"));
|
||||
|
||||
if (conference->getId() != ::Utils::appStringToCoreString(conferenceId)) {
|
||||
qWarning() << QStringLiteral("Trying to join conference with an invalid conference id: `%1`. Responding as a simple call...")
|
||||
.arg(conferenceId);
|
||||
return;
|
||||
}
|
||||
qInfo() << QStringLiteral("Join conference: `%1`.").arg(conferenceId);
|
||||
|
||||
ConferenceHelperModel helperModel;
|
||||
ConferenceHelperModel::ConferenceAddModel *addModel = helperModel.getConferenceAddModel();
|
||||
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
callModel->accept();
|
||||
addModel->addToConference(call->getRemoteAddress());
|
||||
addModel->update();
|
||||
}
|
||||
|
||||
void CallsListModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call, linphone::CallState state) {
|
||||
switch (state) {
|
||||
case linphone::CallStateIncomingReceived: {
|
||||
// _______________________________________________________________________________________________________________________________________
|
||||
// _______________________________________________________________________________________________________________________________________
|
||||
case linphone::CallStateIncomingReceived:
|
||||
addCall(call);
|
||||
if (!call->getToHeader("method").empty()) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
qInfo() << QStringLiteral("----Header method----") << Utils::coreStringToAppString(call->getToHeader("method"));
|
||||
if (call->getToHeader("method") == "join-conference") {
|
||||
if (core->getConference() == NULL) { // TODO change this condition, use isInConference() (need to be initiate)
|
||||
qWarning() << QStringLiteral("Not in a conference,responding to join-conference as a call.");
|
||||
break;
|
||||
}
|
||||
shared_ptr<linphone::Conference> currentConference = core->getConference();
|
||||
|
||||
QString conferenceIdHeader = Utils::coreStringToAppString(call->getToHeader("conference-id"));
|
||||
|
||||
qInfo() << QStringLiteral("conference id asked: '%1'").arg(conferenceIdHeader);
|
||||
qWarning() << QStringLiteral("current conference id: '%1'").arg(Utils::coreStringToAppString(currentConference->getId()));
|
||||
if (currentConference->getId().empty() || currentConference->getId() != Utils::appStringToCoreString(conferenceIdHeader)) {
|
||||
qWarning() << QStringLiteral("trying to join conference with invalid conference-id, `%1`").arg(conferenceIdHeader);
|
||||
qWarning() << QStringLiteral("join-conference managed as a call ");
|
||||
break;
|
||||
}
|
||||
qInfo() << QStringLiteral("join conference: `%1`").arg(Utils::coreStringToAppString(currentConference->getId()));
|
||||
|
||||
ConferenceHelperModel helperModel;
|
||||
ConferenceHelperModel::ConferenceAddModel *addModel = helperModel.getAddModel();
|
||||
|
||||
CallModel *callModel = &call->getData<CallModel>("call-model");
|
||||
callModel->accept();
|
||||
addModel->addToConference(call->getRemoteAddress());
|
||||
addModel->update();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
::joinConference(call);
|
||||
break;
|
||||
}
|
||||
// _______________________________________________________________________________________________________________________________________
|
||||
// _______________________________________________________________________________________________________________________________________
|
||||
case linphone::CallStateOutgoingInit:
|
||||
if (!call->getToAddress()->getHeader("method").empty())
|
||||
qInfo() << QStringLiteral("----Header method----") << Utils::coreStringToAppString(call->getToAddress()->getHeader("method"));
|
||||
|
||||
case linphone::CallStateOutgoingInit:
|
||||
addCall(call);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "../../utils/Utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
#include "../sip-addresses/SipAddressesProxyModel.hpp"
|
||||
#include "ConferenceAddModel.hpp"
|
||||
|
||||
#include "ConferenceHelperModel.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "ConferenceHelperModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
// Sip addresses not in conference.
|
||||
// Can filter the sip addresses with a pattern.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit fdd4b15cd773ecdd01c4aeb65a8ec2cbde65637e
|
||||
Subproject commit 9ada79d7ff53815e85432e7442810a2fd49dbd0e
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit ac155e025efbcb13778cb436babb80e0f4fd6e72
|
||||
Subproject commit 46f30179fcc9d00f35f7d0ef8eacce0a204e4d07
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit a11248a2211a32cb74743e51a2f45af36688e154
|
||||
Subproject commit 99472e6e08368ff843c7905f785c98f4f038a29d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit cf1aaa36c5738c25e59c8fafbade388a0081cd53
|
||||
Subproject commit d8d2f4b40209e06b400f893cce58e4c6ba73341d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit a19b7e3e833dc121f91452e40658dd80f8f0c145
|
||||
Subproject commit 894c814f8da11e1db7a3f9cde34e36aca6e21eb6
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5ec8154074cbc8ed63dd077dbdfa30567ad37105
|
||||
Subproject commit ca236319cab58c1c9ff18426420d31c4ac42ac7d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 659a481fbad8ea37b1d43668e148f9c5b4e05ab3
|
||||
Subproject commit 7b1af7eb960cc40a944f6ec25cb596d9cbbedc73
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit d74adb5e356b5cde0a715ea88f8fbfe219817e94
|
||||
Subproject commit 94652b98171478f80a3fd734c4e9a949a4ec530b
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 54b6bab5d82bf78bc8345d2d2bad904361131282
|
||||
Subproject commit 49e8e5a9af7781043fd5ee6c9bb9219f05ef7432
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5544086f478c13150eda5df683d914ecbf13ea89
|
||||
Subproject commit c2f3a2c619682bacab6307186154989fa4780a0c
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit d52bf6c4d64de840c0efe7a45c595f7745f97ff9
|
||||
Subproject commit b9324a8e3dd3953ec13677c7ea70c87f9c383d25
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 55679b23ef130eab190b4f0dc0267761a712dc33
|
||||
Subproject commit 0fd04f29dcc3eb2d60f4053cb75cca7d14691d5d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit f776bf6548dfb455ad054bcd846a9c39a6c57f1b
|
||||
Subproject commit 9c8f7fe88cf3f083253ee5320955f1e6e038dc8d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 1898b96a946c61b866c09c63e60622cf32dd2d2e
|
||||
Subproject commit a565b81167438a851b53bdbab3ce5e2f1eddabe6
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit af1f042a522c5b425278140a49a5b7197240c767
|
||||
Subproject commit d19b29380d1a2394a44bc7ae0ade8fd25c0bca90
|
||||
Loading…
Add table
Reference in a new issue