fix local group call
This commit is contained in:
parent
21ee3a5414
commit
3a080ea801
6 changed files with 90 additions and 33 deletions
|
|
@ -166,9 +166,8 @@ bool ToolModel::createCall(const QString &sipAddress,
|
||||||
bool isConference = !!core->findConferenceInformationFromUri(address);
|
bool isConference = !!core->findConferenceInformationFromUri(address);
|
||||||
if (isConference) mediaEncryption = linphone::MediaEncryption::ZRTP;
|
if (isConference) mediaEncryption = linphone::MediaEncryption::ZRTP;
|
||||||
|
|
||||||
if (SettingsModel::dndEnabled(
|
if (SettingsModel::dndEnabled(core->getConfig())) { // Force tones for outgoing calls when in DND mode (ringback,
|
||||||
core->getConfig())) { // Force tones for outgoing calls when in DND mode (ringback, dtmf, etc … ) disabled
|
// dtmf, etc … ) disabled again when no more calls are running.
|
||||||
// again when no more calls are running.
|
|
||||||
SettingsModel::getInstance()->setCallToneIndicationsEnabled(true);
|
SettingsModel::getInstance()->setCallToneIndicationsEnabled(true);
|
||||||
}
|
}
|
||||||
std::shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
|
std::shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
|
||||||
|
|
@ -225,6 +224,47 @@ bool ToolModel::createCall(const QString &sipAddress,
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ToolModel::createGroupCall(QString subject, const std::list<QString> &participantAddresses, QString *message) {
|
||||||
|
auto core = CoreModel::getInstance()->getCore();
|
||||||
|
auto conferenceParams = core->createConferenceParams(nullptr);
|
||||||
|
conferenceParams->enableVideo(true);
|
||||||
|
auto account = core->getDefaultAccount();
|
||||||
|
if (!account) {
|
||||||
|
qWarning() << "No default account found, can't create group call";
|
||||||
|
*message = tr("group_call_error_no_account");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
conferenceParams->setAccount(account);
|
||||||
|
conferenceParams->setSubject(Utils::appStringToCoreString(subject));
|
||||||
|
|
||||||
|
auto createEndToEnd = SettingsModel::getInstance()->getCreateEndToEndEncryptedMeetingsAndGroupCalls();
|
||||||
|
conferenceParams->setSecurityLevel(createEndToEnd ? linphone::Conference::SecurityLevel::EndToEnd
|
||||||
|
: linphone::Conference::SecurityLevel::PointToPoint);
|
||||||
|
|
||||||
|
conferenceParams->enableChat(true);
|
||||||
|
|
||||||
|
auto conference = core->createConferenceWithParams(conferenceParams);
|
||||||
|
if (conference) {
|
||||||
|
auto callParams = core->createCallParams(nullptr);
|
||||||
|
callParams->enableVideo(true);
|
||||||
|
callParams->setVideoDirection(linphone::MediaDirection::RecvOnly);
|
||||||
|
std::list<std::shared_ptr<linphone::Address>> participants;
|
||||||
|
for (auto &address : participantAddresses) {
|
||||||
|
auto linAddr = ToolModel::interpretUrl(address);
|
||||||
|
participants.push_back(linAddr);
|
||||||
|
}
|
||||||
|
auto status = conference->inviteParticipants(participants, callParams);
|
||||||
|
if (status != 0) {
|
||||||
|
qWarning() << "Failed to invite participants into group call";
|
||||||
|
*message = tr("group_call_error_participants_invite");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "Could not create group call";
|
||||||
|
*message = tr("group_call_error_creation");
|
||||||
|
}
|
||||||
|
return conference != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<linphone::Account> ToolModel::findAccount(const std::shared_ptr<const linphone::Address> &address) {
|
std::shared_ptr<linphone::Account> ToolModel::findAccount(const std::shared_ptr<const linphone::Address> &address) {
|
||||||
std::shared_ptr<linphone::Account> account;
|
std::shared_ptr<linphone::Account> account;
|
||||||
for (auto item : CoreModel::getInstance()->getCore()->getAccountList()) {
|
for (auto item : CoreModel::getInstance()->getCore()->getAccountList()) {
|
||||||
|
|
@ -301,11 +341,10 @@ std::shared_ptr<linphone::FriendList> ToolModel::getLdapFriendList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToolModel::friendIsInFriendList(const std::shared_ptr<linphone::FriendList> &friendList,
|
bool ToolModel::friendIsInFriendList(const std::shared_ptr<linphone::FriendList> &friendList,
|
||||||
const std::shared_ptr<linphone::Friend> &f) {
|
const std::shared_ptr<linphone::Friend> &f) {
|
||||||
auto friends = friendList->getFriends();
|
auto friends = friendList->getFriends();
|
||||||
auto it = std::find_if(friends.begin(), friends.end(), [f] (std::shared_ptr<linphone::Friend> linFriend) {
|
auto it = std::find_if(friends.begin(), friends.end(),
|
||||||
return linFriend == f;
|
[f](std::shared_ptr<linphone::Friend> linFriend) { return linFriend == f; });
|
||||||
});
|
|
||||||
return (it != friends.end());
|
return (it != friends.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,8 +400,8 @@ QVariantMap ToolModel::createVariant(const std::shared_ptr<const linphone::Audio
|
||||||
map.insert("id", device ? Utils::coreStringToAppString(device->getId()) : "");
|
map.insert("id", device ? Utils::coreStringToAppString(device->getId()) : "");
|
||||||
map.insert("display_name",
|
map.insert("display_name",
|
||||||
device ? Utils::coreStringToAppString(device->getDriverName() + ": " + device->getDeviceName())
|
device ? Utils::coreStringToAppString(device->getDriverName() + ": " + device->getDeviceName())
|
||||||
//: "Unknown device"
|
//: "Unknown device"
|
||||||
: tr("unknown_audio_device_name"));
|
: tr("unknown_audio_device_name"));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ public:
|
||||||
static std::shared_ptr<linphone::Friend> findFriendByAddress(const QString &address);
|
static std::shared_ptr<linphone::Friend> findFriendByAddress(const QString &address);
|
||||||
static std::shared_ptr<linphone::Friend> findFriendByAddress(std::shared_ptr<linphone::Address> linphoneAddr);
|
static std::shared_ptr<linphone::Friend> findFriendByAddress(std::shared_ptr<linphone::Address> linphoneAddr);
|
||||||
|
|
||||||
|
|
||||||
static bool createCall(const QString &sipAddress,
|
static bool createCall(const QString &sipAddress,
|
||||||
const QVariantMap &options = {},
|
const QVariantMap &options = {},
|
||||||
const QString &prepareTransfertAddress = "",
|
const QString &prepareTransfertAddress = "",
|
||||||
|
|
@ -61,6 +60,9 @@ public:
|
||||||
linphone::MediaEncryption = linphone::MediaEncryption::None,
|
linphone::MediaEncryption = linphone::MediaEncryption::None,
|
||||||
QString *errorMessage = nullptr);
|
QString *errorMessage = nullptr);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
createGroupCall(QString subject, const std::list<QString> &participantAddresses, QString *message = nullptr);
|
||||||
|
|
||||||
static std::shared_ptr<linphone::FriendList> getFriendList(const std::string &listName);
|
static std::shared_ptr<linphone::FriendList> getFriendList(const std::string &listName);
|
||||||
static std::shared_ptr<linphone::FriendList> getAppFriendList();
|
static std::shared_ptr<linphone::FriendList> getAppFriendList();
|
||||||
static std::shared_ptr<linphone::FriendList> getLdapFriendList();
|
static std::shared_ptr<linphone::FriendList> getLdapFriendList();
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,17 @@ void Utils::createCall(const QString &sipAddress,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Utils::createGroupCall(QString subject, const std::list<QString> &participantAddresses) {
|
||||||
|
App::postModelAsync([subject, participantAddresses]() {
|
||||||
|
QString errorMessage;
|
||||||
|
bool success = ToolModel::createGroupCall(subject, participantAddresses, &errorMessage);
|
||||||
|
if (!success) {
|
||||||
|
if (errorMessage.isEmpty()) errorMessage = tr("information_popup_group_call_not_created_message");
|
||||||
|
showInformationPopup(tr("information_popup_error_title"), errorMessage, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// TODO : change conf info only from qml
|
// TODO : change conf info only from qml
|
||||||
// (bug si on est déjà en appel et qu'on lance une conf)
|
// (bug si on est déjà en appel et qu'on lance une conf)
|
||||||
// demander à jonhatan pour le design : quand on est déjà en appel
|
// demander à jonhatan pour le design : quand on est déjà en appel
|
||||||
|
|
@ -304,9 +315,9 @@ QString Utils::formatDate(const QDateTime &date, bool includeTime, QString forma
|
||||||
//: "Hier
|
//: "Hier
|
||||||
else if (date.date() == QDate::currentDate().addDays(-1)) dateDay = tr("yesterday");
|
else if (date.date() == QDate::currentDate().addDays(-1)) dateDay = tr("yesterday");
|
||||||
else {
|
else {
|
||||||
if(format.isEmpty()) format = date.date().year() == QDateTime::currentDateTime(date.timeZone()).date().year()
|
if (format.isEmpty())
|
||||||
? "dd MMMM"
|
format = date.date().year() == QDateTime::currentDateTime(date.timeZone()).date().year() ? "dd MMMM"
|
||||||
: "dd MMMM yyyy";
|
: "dd MMMM yyyy";
|
||||||
dateDay = App::getInstance()->getLocale().toString(date.date(), format);
|
dateDay = App::getInstance()->getLocale().toString(date.date(), format);
|
||||||
}
|
}
|
||||||
if (!includeTime) return dateDay;
|
if (!includeTime) return dateDay;
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ public:
|
||||||
LinphoneEnums::MediaEncryption mediaEncryption = LinphoneEnums::MediaEncryption::None,
|
LinphoneEnums::MediaEncryption mediaEncryption = LinphoneEnums::MediaEncryption::None,
|
||||||
const QString &prepareTransfertAddress = "",
|
const QString &prepareTransfertAddress = "",
|
||||||
const QHash<QString, QString> &headers = {});
|
const QHash<QString, QString> &headers = {});
|
||||||
|
Q_INVOKABLE static void createGroupCall(QString subject, const std::list<QString> &participantAddresses);
|
||||||
Q_INVOKABLE static void setupConference(ConferenceInfoGui *confGui);
|
Q_INVOKABLE static void setupConference(ConferenceInfoGui *confGui);
|
||||||
Q_INVOKABLE static QQuickWindow *getMainWindow();
|
Q_INVOKABLE static QQuickWindow *getMainWindow();
|
||||||
Q_INVOKABLE static void openCallsWindow(CallGui *call);
|
Q_INVOKABLE static void openCallsWindow(CallGui *call);
|
||||||
|
|
@ -87,7 +88,8 @@ public:
|
||||||
Q_INVOKABLE static QString createAvatar(const QUrl &fileUrl); // Return the avatar path
|
Q_INVOKABLE static QString createAvatar(const QUrl &fileUrl); // Return the avatar path
|
||||||
Q_INVOKABLE static QString formatElapsedTime(int seconds,
|
Q_INVOKABLE static QString formatElapsedTime(int seconds,
|
||||||
bool dotsSeparator = true); // Return the elapsed time formated
|
bool dotsSeparator = true); // Return the elapsed time formated
|
||||||
Q_INVOKABLE static QString formatDate(const QDateTime &date, bool includeTime = true, QString format = ""); // Return the date formated
|
Q_INVOKABLE static QString
|
||||||
|
formatDate(const QDateTime &date, bool includeTime = true, QString format = ""); // Return the date formated
|
||||||
Q_INVOKABLE static QString formatDateElapsedTime(const QDateTime &date);
|
Q_INVOKABLE static QString formatDateElapsedTime(const QDateTime &date);
|
||||||
Q_INVOKABLE static QString formatTime(const QDateTime &date); // Return the time formated
|
Q_INVOKABLE static QString formatTime(const QDateTime &date); // Return the time formated
|
||||||
Q_INVOKABLE static QStringList generateSecurityLettersArray(int arraySize, int correctIndex, QString correctCode);
|
Q_INVOKABLE static QStringList generateSecurityLettersArray(int arraySize, int correctIndex, QString correctCode);
|
||||||
|
|
@ -137,7 +139,7 @@ public:
|
||||||
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
|
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
|
||||||
Q_INVOKABLE QList<QVariant> append(const QList<QVariant> a, const QList<QVariant> b);
|
Q_INVOKABLE QList<QVariant> append(const QList<QVariant> a, const QList<QVariant> b);
|
||||||
|
|
||||||
// QDir findDirectoryByName(QString startPath, QString name);
|
// QDir findDirectoryByName(QString startPath, QString name);
|
||||||
|
|
||||||
static QString getApplicationProduct();
|
static QString getApplicationProduct();
|
||||||
static QString getOsProduct();
|
static QString getOsProduct();
|
||||||
|
|
|
||||||
|
|
@ -448,8 +448,7 @@ AbstractMainPage {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.topMargin: Math.round(15 * DefaultStyle.dp)
|
Layout.topMargin: Math.round(15 * DefaultStyle.dp)
|
||||||
onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount
|
onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount
|
||||||
= selectedParticipantsCount
|
|
||||||
focus: true
|
focus: true
|
||||||
Connections {
|
Connections {
|
||||||
target: mainItem
|
target: mainItem
|
||||||
|
|
@ -457,24 +456,20 @@ AbstractMainPage {
|
||||||
if (groupCallName.text.length === 0) {
|
if (groupCallName.text.length === 0) {
|
||||||
UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"),
|
UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"),
|
||||||
//: "Un nom doit être donné à l'appel de groupe
|
//: "Un nom doit être donné à l'appel de groupe
|
||||||
qsTr("group_call_error_must_have_name"),
|
qsTr("group_call_error_must_have_name"), false)
|
||||||
false)
|
|
||||||
} else if (!mainItem.isRegistered) {
|
} else if (!mainItem.isRegistered) {
|
||||||
UtilsCpp.showInformationPopup(
|
UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"),
|
||||||
qsTr("information_popup_error_title"),
|
|
||||||
//: "Vous n'etes pas connecté"
|
//: "Vous n'etes pas connecté"
|
||||||
qsTr("group_call_error_not_connected"),
|
qsTr("group_call_error_not_connected"), false)
|
||||||
false)
|
|
||||||
} else {
|
} else {
|
||||||
mainItem.confInfoGui = Qt.createQmlObject(
|
// mainItem.confInfoGui = Qt.createQmlObject(
|
||||||
'import Linphone
|
// "import Linphone
|
||||||
ConferenceInfoGui{
|
// ConferenceInfoGui{}", mainItem)
|
||||||
}', mainItem)
|
// mainItem.confInfoGui.core.subject = groupCallName.text
|
||||||
mainItem.confInfoGui.core.subject = groupCallName.text
|
// mainItem.confInfoGui.core.isScheduled = false
|
||||||
mainItem.confInfoGui.core.isScheduled = false
|
// mainItem.confInfoGui.core.addParticipants(addParticipantsLayout.selectedParticipants)
|
||||||
mainItem.confInfoGui.core.addParticipants(
|
// mainItem.confInfoGui.core.save()
|
||||||
addParticipantsLayout.selectedParticipants)
|
UtilsCpp.createGroupCall(groupCallName.text, addParticipantsLayout.selectedParticipants)
|
||||||
mainItem.confInfoGui.core.save()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,15 @@ AbstractWindow {
|
||||||
EffectImage {
|
EffectImage {
|
||||||
Layout.preferredWidth: Math.round(15 * DefaultStyle.dp)
|
Layout.preferredWidth: Math.round(15 * DefaultStyle.dp)
|
||||||
Layout.preferredHeight: Math.round(15 * DefaultStyle.dp)
|
Layout.preferredHeight: Math.round(15 * DefaultStyle.dp)
|
||||||
colorizationColor: mainWindow.call ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp ? DefaultStyle.info_500_main : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified ? DefaultStyle.warning_600 : DefaultStyle.info_500_main : DefaultStyle.grey_0 : "transparent"
|
colorizationColor: mainWindow.call
|
||||||
|
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
|
||||||
|
? DefaultStyle.info_500_main
|
||||||
|
: mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp
|
||||||
|
? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified
|
||||||
|
? DefaultStyle.warning_600
|
||||||
|
: DefaultStyle.info_500_main
|
||||||
|
: DefaultStyle.grey_0
|
||||||
|
: "transparent"
|
||||||
visible: mainWindow.call
|
visible: mainWindow.call
|
||||||
imageSource: mainWindow.call
|
imageSource: mainWindow.call
|
||||||
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
|
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue