Fix SIP settings :

- Deletion of account where registration has not been enabled.
- Crash on new account.
- Route error message on creation.
This commit is contained in:
Julien Wadel 2022-02-16 14:00:31 +01:00
parent 4682ace15d
commit 479369bab0
4 changed files with 30 additions and 24 deletions

View file

@ -231,8 +231,10 @@ void AccountSettingsModel::removeProxyConfig (const shared_ptr<linphone::ProxyCo
if (proxyConfig->done() == -1) {
qWarning() << QStringLiteral("Unable to reset message-expiry property before removing proxy config: `%1`.")
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
}else { // Wait for update
}else if(proxyConfig->registerEnabled()) { // Wait for update
mRemovingProxies.push_back(proxyConfig);
}else{// Registration is not enabled : Removing without wait.
CoreManager::getInstance()->getCore()->removeProxyConfig(proxyConfig);
}
emit accountSettingsUpdated();
@ -504,8 +506,9 @@ void AccountSettingsModel::handleRegistrationStateChanged (
coreManager->getSettingsModel()->configureRlsUri();
}else if(mRemovingProxies.contains(proxy)){
mRemovingProxies.removeAll(proxy);
QTimer::singleShot(100, [proxy](){// removeProxyConfig cannot be called from callback
QTimer::singleShot(100, [proxy, this](){// removeProxyConfig cannot be called from callback
CoreManager::getInstance()->getCore()->removeProxyConfig(proxy);
emit accountSettingsUpdated();
});
}
if(defaultProxyConfig == proxy)

View file

@ -76,25 +76,28 @@ function formIsValid () {
// -----------------------------------------------------------------------------
function validProxyConfig () {
if (Linphone.AccountSettingsModel.addOrUpdateProxyConfig(proxyConfig, {
sipAddress: sipAddress.text,
serverAddress: serverAddress.text,
registrationDuration: registrationDuration.text,
transport: transport.currentText,
route: route.text,
conferenceUri: conferenceUri.text,
contactParams: contactParams.text,
avpfInterval: avpfInterval.text,
registerEnabled: registerEnabled.checked,
publishPresence: publishPresence.checked,
avpfEnabled: avpfEnabled.checked,
iceEnabled: iceEnabled.checked,
turnEnabled: turnEnabled.checked,
stunServer: stunServer.text,
turnUser: turnUser.text,
turnPassword: turnPassword.text
})) {
function validProxyConfig (proxyConfig) {
var data = {
sipAddress: sipAddress.text,
serverAddress: serverAddress.text,
registrationDuration: registrationDuration.text,
transport: transport.currentText,
route: route.text,
conferenceUri: conferenceUri.text,
contactParams: contactParams.text,
avpfInterval: avpfInterval.text,
registerEnabled: registerEnabled.checked,
publishPresence: publishPresence.checked,
avpfEnabled: avpfEnabled.checked,
iceEnabled: iceEnabled.checked,
turnEnabled: turnEnabled.checked,
stunServer: stunServer.text,
turnUser: turnUser.text,
turnPassword: turnPassword.text
}
if (proxyConfig && Linphone.AccountSettingsModel.addOrUpdateProxyConfig(proxyConfig, data)
|| !proxyConfig && Linphone.AccountSettingsModel.addOrUpdateProxyConfig(data)) {
dialog.exit(1)
} else {
// TODO: Display errors on the form (if necessary).

View file

@ -15,7 +15,7 @@ DialogPlus {
property bool _sipAddressOk: false
property bool _serverAddressOk: false
property bool _routeOk: false
property bool _routeOk: true
property bool _conferenceUriOk: true
buttons: [
@ -28,7 +28,7 @@ DialogPlus {
enabled: Logic.formIsValid()
text: qsTr('confirm')
onClicked: Logic.validProxyConfig()
onClicked: Logic.validProxyConfig(dialog.account ? dialog.account.proxyConfig : null)
}
]

View file

@ -132,7 +132,7 @@ TabContainer {
TextButtonB {
text: qsTr('addAccount')
onClicked: Logic.editAccount()
onClicked: Logic.editAccount(null)
}
}