fix third party connection with registrar uri

This commit is contained in:
Gaelle Braud 2025-12-15 16:55:56 +01:00
parent ac2bcc4629
commit a6832576d3
4 changed files with 68 additions and 39 deletions

View file

@ -104,49 +104,55 @@
<context>
<name>AccountManager</name>
<message>
<location filename="../../model/account/AccountManager.cpp" line="93"/>
<location filename="../../model/account/AccountManager.cpp" line="94"/>
<source>assistant_account_login_already_connected_error</source>
<extracomment>&quot;The account is already connected&quot;</extracomment>
<translation>Das Konto ist bereits verbunden</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<location filename="../../model/account/AccountManager.cpp" line="144"/>
<source>assistant_account_login_outbound_proxy_uri_error</source>
<extracomment>Outbound proxy uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="121"/>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<source>assistant_account_login_proxy_address_error</source>
<extracomment>&quot;Unable to create proxy address. Please check the domain name.&quot;</extracomment>
<translation>Proxy-Adresse konnte nicht erstellt werden. Bitte überprüfen Sie den Domänenname.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="134"/>
<location filename="../../model/account/AccountManager.cpp" line="122"/>
<source>assistant_account_login_address_configuration_error</source>
<extracomment>&quot;Unable to configure address: `%1`.&quot;</extracomment>
<translation>Folgende Adresse konnte nicht konfiguriert werden: `%1`.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="141"/>
<location filename="../../model/account/AccountManager.cpp" line="133"/>
<source>assistant_account_login_registrar_uri_error</source>
<extracomment>Registrar uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="151"/>
<source>assistant_account_login_params_configuration_error</source>
<extracomment>&quot;Unable to configure account settings.&quot;</extracomment>
<translation>Kontoeinstellungen konnten nicht konfiguriert werden.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="165"/>
<location filename="../../model/account/AccountManager.cpp" line="175"/>
<source>assistant_account_login_forbidden_error</source>
<extracomment>&quot;Username and password do not match&quot;</extracomment>
<translation>Benutzername und Passwort stimmen nicht überein</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="167"/>
<location filename="../../model/account/AccountManager.cpp" line="177"/>
<source>assistant_account_login_error</source>
<extracomment>&quot;Error during connection, please verify your parameters&quot;</extracomment>
<translation>Fehler bei der Verbindung</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="181"/>
<location filename="../../model/account/AccountManager.cpp" line="192"/>
<source>assistant_account_add_error</source>
<extracomment>&quot;Unable to add account.&quot;</extracomment>
<translation>Konto konnte nicht hinzugefügt werden.</translation>

View file

@ -104,49 +104,55 @@
<context>
<name>AccountManager</name>
<message>
<location filename="../../model/account/AccountManager.cpp" line="93"/>
<location filename="../../model/account/AccountManager.cpp" line="94"/>
<source>assistant_account_login_already_connected_error</source>
<extracomment>&quot;The account is already connected&quot;</extracomment>
<translation>The account is already connected</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<location filename="../../model/account/AccountManager.cpp" line="144"/>
<source>assistant_account_login_outbound_proxy_uri_error</source>
<extracomment>Outbound proxy uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation>Outbound proxy uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="121"/>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<source>assistant_account_login_proxy_address_error</source>
<extracomment>&quot;Unable to create proxy address. Please check the domain name.&quot;</extracomment>
<translation>Unable to create proxy address. Please check the domain name.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="134"/>
<location filename="../../model/account/AccountManager.cpp" line="122"/>
<source>assistant_account_login_address_configuration_error</source>
<extracomment>&quot;Unable to configure address: `%1`.&quot;</extracomment>
<translation>Unable to configure address: `%1`.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="141"/>
<location filename="../../model/account/AccountManager.cpp" line="133"/>
<source>assistant_account_login_registrar_uri_error</source>
<extracomment>Registrar uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation>Registrar uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="151"/>
<source>assistant_account_login_params_configuration_error</source>
<extracomment>&quot;Unable to configure account settings.&quot;</extracomment>
<translation>Unable to configure account settings.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="165"/>
<location filename="../../model/account/AccountManager.cpp" line="175"/>
<source>assistant_account_login_forbidden_error</source>
<extracomment>&quot;Username and password do not match&quot;</extracomment>
<translation>Username and password do not match</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="167"/>
<location filename="../../model/account/AccountManager.cpp" line="177"/>
<source>assistant_account_login_error</source>
<extracomment>&quot;Error during connection, please verify your parameters&quot;</extracomment>
<translation>Error during connection</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="181"/>
<location filename="../../model/account/AccountManager.cpp" line="192"/>
<source>assistant_account_add_error</source>
<extracomment>&quot;Unable to add account.&quot;</extracomment>
<translation>Unable to add account.</translation>

View file

@ -104,49 +104,55 @@
<context>
<name>AccountManager</name>
<message>
<location filename="../../model/account/AccountManager.cpp" line="93"/>
<location filename="../../model/account/AccountManager.cpp" line="94"/>
<source>assistant_account_login_already_connected_error</source>
<extracomment>&quot;The account is already connected&quot;</extracomment>
<translation>Le compte est déjà connecté</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<location filename="../../model/account/AccountManager.cpp" line="144"/>
<source>assistant_account_login_outbound_proxy_uri_error</source>
<extracomment>Outbound proxy uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation>L&apos;uri du proxy SIP sortant est invalide. Assurez-vous qu&apos;elle corresponde format suivant : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; est optionnel)</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="121"/>
<location filename="../../model/account/AccountManager.cpp" line="109"/>
<source>assistant_account_login_proxy_address_error</source>
<extracomment>&quot;Unable to create proxy address. Please check the domain name.&quot;</extracomment>
<translation>Impossible de créer l&apos;adresse proxy. Merci de vérifier le nom de domaine.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="134"/>
<location filename="../../model/account/AccountManager.cpp" line="122"/>
<source>assistant_account_login_address_configuration_error</source>
<extracomment>&quot;Unable to configure address: `%1`.&quot;</extracomment>
<translation>Impossible de configurer l&apos;adresse : `%1`.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="141"/>
<location filename="../../model/account/AccountManager.cpp" line="133"/>
<source>assistant_account_login_registrar_uri_error</source>
<extracomment>Registrar uri is invalid. Please make sure it matches the following format : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; is optional)</extracomment>
<translation>La registrar uri est invalide. Assurez-vous qu&apos;elle corresponde format suivant : sip:host&gt;:&lt;port&gt;;transport=&lt;transport&gt; (:&lt;port&gt; est optionnel)</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="151"/>
<source>assistant_account_login_params_configuration_error</source>
<extracomment>&quot;Unable to configure account settings.&quot;</extracomment>
<translation>Impossible de configurer les paramètres du compte.</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="165"/>
<location filename="../../model/account/AccountManager.cpp" line="175"/>
<source>assistant_account_login_forbidden_error</source>
<extracomment>&quot;Username and password do not match&quot;</extracomment>
<translation>Le couple identifiant mot de passe ne correspond pas</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="167"/>
<location filename="../../model/account/AccountManager.cpp" line="177"/>
<source>assistant_account_login_error</source>
<extracomment>&quot;Error during connection, please verify your parameters&quot;</extracomment>
<translation>Erreur durant la connexion, veuillez vérifier vos paramètres</translation>
</message>
<message>
<location filename="../../model/account/AccountManager.cpp" line="181"/>
<location filename="../../model/account/AccountManager.cpp" line="192"/>
<source>assistant_account_add_error</source>
<extracomment>&quot;Unable to add account.&quot;</extracomment>
<translation>Impossible d&apos;ajouter le compte.</translation>

View file

@ -31,6 +31,7 @@
#include "core/path/Paths.hpp"
#include "model/core/CoreModel.hpp"
#include "model/setting/SettingsModel.hpp"
#include "model/tool/ToolModel.hpp"
#include "tool/Utils.hpp"
@ -96,23 +97,10 @@ bool AccountManager::login(QString username,
}
if (!displayName.isEmpty()) identity->setDisplayName(Utils::appStringToCoreString(displayName));
if (!registrarUri.isEmpty()) {
auto linRegistrarUri = ToolModel::interpretUrl(registrarUri);
params->setServerAddress(linRegistrarUri);
}
if (!outboundProxyAddress.isEmpty()) {
auto linOutboundProxyAddress = factory->createAddress(Utils::appStringToCoreString(outboundProxyAddress));
if (linOutboundProxyAddress) params->setRoutesAddresses({linOutboundProxyAddress});
else {
//: Outbound proxy uri is invalid. Please make sure it matches the following format :
//: sip:host>:<port>;transport=<transport> (:<port> is optional)
*errorMessage = tr("assistant_account_login_outbound_proxy_uri_error");
return false;
}
}
if (!domain.isEmpty()) {
identity->setDomain(Utils::appStringToCoreString(domain));
if (QString::compare(domain, "sip.linphone.org")) {
if (QString::compare(domain, SettingsModel::getInstance()->getDefaultDomain())) {
params->setLimeServerUrl("");
auto computedServerAddress =
factory->createAddress(Utils::appStringToCoreString(QStringLiteral("sip:%1").arg(domain)));
@ -136,6 +124,28 @@ bool AccountManager::login(QString username,
return false;
}
if (!registrarUri.isEmpty()) {
auto linRegistrarUri = factory->createAddress(Utils::appStringToCoreString(registrarUri));
if (linRegistrarUri) params->setServerAddress(linRegistrarUri);
else {
//: Registrar uri is invalid. Please make sure it matches the following format :
//: sip:host>:<port>;transport=<transport> (:<port> is optional)
*errorMessage = tr("assistant_account_login_registrar_uri_error");
return false;
}
}
if (!outboundProxyAddress.isEmpty()) {
auto linOutboundProxyAddress = factory->createAddress(Utils::appStringToCoreString(outboundProxyAddress));
if (linOutboundProxyAddress) params->setRoutesAddresses({linOutboundProxyAddress});
else {
//: Outbound proxy uri is invalid. Please make sure it matches the following format :
//: sip:host>:<port>;transport=<transport> (:<port> is optional)
*errorMessage = tr("assistant_account_login_outbound_proxy_uri_error");
return false;
}
}
if (account->setParams(params)) {
//: "Unable to configure account settings."
*errorMessage = tr("assistant_account_login_params_configuration_error");
@ -175,6 +185,7 @@ bool AccountManager::login(QString username,
}
emit registrationStateChanged(state, account->getError(), errorMessage);
});
auto status = core->addAccount(account);
if (status == -1) {
//: "Unable to add account."