diff --git a/Linphone/core/account/AccountCore.cpp b/Linphone/core/account/AccountCore.cpp index c16034dc..1c8dc5d2 100644 --- a/Linphone/core/account/AccountCore.cpp +++ b/Linphone/core/account/AccountCore.cpp @@ -95,6 +95,8 @@ AccountCore::AccountCore(const std::shared_ptr &account) : QO mDialPlan = mAccountModel->dialPlanAsString(dialPlan); } } + mVoicemailAddress = + params->getVoicemailAddress() ? Utils::coreStringToAppString(params->getVoicemailAddress()->asString()) : ""; INIT_CORE_MEMBER(VoicemailCount, mAccountModel) INIT_CORE_MEMBER(ShowMwi, mAccountModel) @@ -270,6 +272,8 @@ void AccountCore::setSelf(QSharedPointer me) { DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, voicemailCount, VoicemailCount) DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, showMwi, ShowMwi) + DEFINE_CORE_GETSET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, QString, + voicemailAddress, VoicemailAddress) } const std::shared_ptr &AccountCore::getModel() const { diff --git a/Linphone/core/account/AccountCore.hpp b/Linphone/core/account/AccountCore.hpp index f830fcdc..48bd85f5 100644 --- a/Linphone/core/account/AccountCore.hpp +++ b/Linphone/core/account/AccountCore.hpp @@ -73,6 +73,7 @@ class AccountCore : public QObject, public AbstractObject { Q_PROPERTY(QString limeServerUrl READ getLimeServerUrl WRITE lSetLimeServerUrl NOTIFY limeServerUrlChanged) DECLARE_CORE_GET(int, voicemailCount, VoicemailCount) DECLARE_CORE_GET(bool, showMwi, ShowMwi) + DECLARE_CORE_GETSET_MEMBER(QString, voicemailAddress, VoicemailAddress) public: static QSharedPointer create(const std::shared_ptr &account); diff --git a/Linphone/model/account/AccountModel.cpp b/Linphone/model/account/AccountModel.cpp index e4e78fd0..dcb48f01 100644 --- a/Linphone/model/account/AccountModel.cpp +++ b/Linphone/model/account/AccountModel.cpp @@ -319,6 +319,17 @@ bool AccountModel::getShowMwi() { else return false; } +void AccountModel::setVoicemailAddress(QString value) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + auto params = mMonitor->getParams()->clone(); + auto address = linphone::Factory::get()->createAddress(Utils::appStringToCoreString(value)); + if (address) { + params->setVoicemailAddress(address); + mMonitor->setParams(params); + emit voicemailAddressChanged(value); + } else qWarning() << "Unable to set VoicemailAddress, failed creating address from" << value; +} + // UserData (see hpp for explanations) static QMap, std::shared_ptr> userDataMap; diff --git a/Linphone/model/account/AccountModel.hpp b/Linphone/model/account/AccountModel.hpp index 7fa6e42d..ca78b4f2 100644 --- a/Linphone/model/account/AccountModel.hpp +++ b/Linphone/model/account/AccountModel.hpp @@ -68,6 +68,7 @@ public: QString dialPlanAsString(const std::shared_ptr &dialPlan); int getVoicemailCount(); bool getShowMwi(); + void setVoicemailAddress(QString value); signals: void registrationStateChanged(const std::shared_ptr &account, @@ -96,6 +97,7 @@ signals: void removed(); void voicemailCountChanged(int count); void showMwiChanged(bool show); + void voicemailAddressChanged(QString value); private: /**Linphone **/ diff --git a/Linphone/view/Control/Display/Contact/Contact.qml b/Linphone/view/Control/Display/Contact/Contact.qml index 5d57281b..fcb5f1b3 100644 --- a/Linphone/view/Control/Display/Contact/Contact.qml +++ b/Linphone/view/Control/Display/Contact/Contact.qml @@ -151,10 +151,10 @@ Control.Control{ visible: mainItem.account.core.showMwi voicemailCount: mainItem.account.core.voicemailCount >= 100 ? '99+' : mainItem.account.core.voicemailCount onClicked: { - if (mainItem.account.core.mwiServerAddress.length > 0) - UtilsCpp.createCall(mainItem.account.core.mwiServerAddress) + if (mainItem.account.core.voicemailAddress.length > 0) + UtilsCpp.createCall(mainItem.account.core.voicemailAddress) else - UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'adresse de la messagerie vocale n'est pas définie."), false) + UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'URI de messagerie vocale n'est pas définie."), false) } } Item{Layout.fillWidth: true} diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index 8433db89..5ba9c270 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -425,10 +425,10 @@ Item { if (accountProxy.count > 1) { avatarButton.popup.open() } else { - if (accountProxy.defaultAccount.core.mwiServerAddress.length > 0) - UtilsCpp.createCall(accountProxy.defaultAccount.core.mwiServerAddress) + if (accountProxy.defaultAccount.core.voicemailAddress.length > 0) + UtilsCpp.createCall(accountProxy.defaultAccount.core.voicemailAddress) else - UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'adresse de la messagerie vocale n'est pas définie."), false) + UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'URI de messagerie vocale n'est pas définie."), false) } } } diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml index 65dfb9a1..2150a8f3 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml @@ -53,6 +53,13 @@ AbstractSettingsLayout { isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); } toValidate: true } + DecoratedTextField { + propertyName: "voicemailAddress" + propertyOwner: account.core + title: qsTr("URI de messagerie vocale") + isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); } + toValidate: true + } Item { Layout.fillHeight: true Layout.fillWidth: true