mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
feat(SettingsSipAccountsEdit): give access to nat policy settings for one proxy config
This commit is contained in:
parent
c2cde508e1
commit
986f5d9902
8 changed files with 344 additions and 111 deletions
|
|
@ -1386,6 +1386,34 @@ your friend's SIP address or username.</translation>
|
|||
<source>invalidRoute</source>
|
||||
<translation>Invalid route.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableIceLabel</source>
|
||||
<translation>Enable ICE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>stunServerLabel</source>
|
||||
<translation>STUN/TURN server</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableTurnLabel</source>
|
||||
<translation>Enable TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnUserLabel</source>
|
||||
<translation>TURN user</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnPasswordLabel</source>
|
||||
<translation>TURN password</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>natAndFirewallTitle</source>
|
||||
<translation>NAT and Firewall</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSipAccountSettingsTitle</source>
|
||||
<translation>Main SIP account settings</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsUi</name>
|
||||
|
|
|
|||
|
|
@ -1384,6 +1384,34 @@ Cliquez ici : <a href="%1">%1</a>
|
|||
<source>invalidRoute</source>
|
||||
<translation>Route invalide.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableIceLabel</source>
|
||||
<translation>Activer ICE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>stunServerLabel</source>
|
||||
<translation>Serveur STUN/TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableTurnLabel</source>
|
||||
<translation>Activer TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnUserLabel</source>
|
||||
<translation>Utilisateur TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnPasswordLabel</source>
|
||||
<translation>Mot de passe TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>natAndFirewallTitle</source>
|
||||
<translation>NAT et Pare-feu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSipAccountSettingsTitle</source>
|
||||
<translation>Paramètres principaux du compte SIP</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsUi</name>
|
||||
|
|
|
|||
|
|
@ -1384,6 +1384,34 @@
|
|||
<source>invalidRoute</source>
|
||||
<translation>Неверный маршрут.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableIceLabel</source>
|
||||
<translation>Включить ICE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>stunServerLabel</source>
|
||||
<translation>Сервер STUN/TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableTurnLabel</source>
|
||||
<translation>Включить TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnUserLabel</source>
|
||||
<translation>Пользователь TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnPasswordLabel</source>
|
||||
<translation>Пароль TURN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>natAndFirewallTitle</source>
|
||||
<translation>NAT и межсетевой экран</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSipAccountSettingsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsUi</name>
|
||||
|
|
|
|||
|
|
@ -1386,6 +1386,34 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.</translation>
|
|||
<source>invalidRoute</source>
|
||||
<translation>Geçersiz rota.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableIceLabel</source>
|
||||
<translation>ICE'yi etkinleştir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>stunServerLabel</source>
|
||||
<translation>STUN/TURN sunucusu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>enableTurnLabel</source>
|
||||
<translation>TURN'u etkinleştir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnUserLabel</source>
|
||||
<translation>TURN kullanıcısı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turnPasswordLabel</source>
|
||||
<translation>TURN parolası</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>natAndFirewallTitle</source>
|
||||
<translation>NAT ve Güvenlik Duvarı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSipAccountSettingsTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsUi</name>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr<li
|
|||
? ::Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asString())
|
||||
: QString("");
|
||||
}
|
||||
|
||||
map["serverAddress"] = ::Utils::coreStringToAppString(proxyConfig->getServerAddr());
|
||||
map["registrationDuration"] = proxyConfig->getPublishExpires();
|
||||
map["transport"] = ::Utils::coreStringToAppString(proxyConfig->getTransport());
|
||||
|
|
@ -108,6 +107,14 @@ QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr<li
|
|||
map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::AVPFModeEnabled;
|
||||
map["registrationState"] = ::mapLinphoneRegistrationStateToUi(proxyConfig->getState());
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
map["iceEnabled"] = natPolicy->iceEnabled();
|
||||
map["turnEnabled"] = natPolicy->turnEnabled();
|
||||
map["stunServer"] = ::Utils::coreStringToAppString(natPolicy->getStunServer());
|
||||
map["turnUser"] = ::Utils::coreStringToAppString(natPolicy->getStunServerUsername());
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = proxyConfig->findAuthInfo();
|
||||
map["turnPassword"] = authInfo ? ::Utils::coreStringToAppString(authInfo->getPasswd()) : QString("");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +179,33 @@ bool AccountSettingsModel::addOrUpdateProxyConfig (
|
|||
: linphone::AVPFMode::AVPFModeDefault
|
||||
);
|
||||
|
||||
shared_ptr<linphone::NatPolicy> natPolicy = proxyConfig->getNatPolicy();
|
||||
natPolicy->enableIce(data["iceEnabled"].toBool());
|
||||
natPolicy->enableStun(data["iceEnabled"].toBool());
|
||||
natPolicy->enableTurn(data["turnEnabled"].toBool());
|
||||
natPolicy->setStunServer(::Utils::appStringToCoreString(data["stunServer"].toString()));
|
||||
natPolicy->setStunServerUsername(::Utils::appStringToCoreString(data["turnUser"].toString()));
|
||||
|
||||
shared_ptr<const linphone::AuthInfo> authInfo = proxyConfig->findAuthInfo();
|
||||
shared_ptr<linphone::Core> core = proxyConfig->getCore();
|
||||
if (authInfo) {
|
||||
shared_ptr<linphone::AuthInfo> clonedAuthInfo = authInfo->clone();
|
||||
clonedAuthInfo->setPasswd(::Utils::appStringToCoreString(data["turnPassword"].toString()));
|
||||
|
||||
core->removeAuthInfo(authInfo);
|
||||
core->addAuthInfo(clonedAuthInfo);
|
||||
} else {
|
||||
authInfo = linphone::Factory::get()->createAuthInfo(
|
||||
::Utils::appStringToCoreString(data["turnUser"].toString()),
|
||||
::Utils::appStringToCoreString(data["turnUser"].toString()),
|
||||
::Utils::appStringToCoreString(data["turnPassword"].toString()),
|
||||
"",
|
||||
"",
|
||||
""
|
||||
);
|
||||
core->addAuthInfo(authInfo);
|
||||
}
|
||||
|
||||
return addOrUpdateProxyConfig(proxyConfig);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ function initForm (account) {
|
|||
registerEnabled.checked = config.registerEnabled
|
||||
publishPresence.checked = config.publishPresence
|
||||
avpfEnabled.checked = config.avpfEnabled
|
||||
iceEnabled.checked = config.iceEnabled
|
||||
turnEnabled.checked = config.turnEnabled
|
||||
stunServer.text = config.stunServer
|
||||
turnPassword.text = config.turnPassword
|
||||
turnUser.text = config.turnUser
|
||||
|
||||
if (account) {
|
||||
dialog._sipAddressOk = true
|
||||
|
|
@ -62,7 +67,12 @@ function validProxyConfig () {
|
|||
avpfInterval: avpfInterval.text,
|
||||
registerEnabled: registerEnabled.checked,
|
||||
publishPresence: publishPresence.checked,
|
||||
avpfEnabled: avpfEnabled.checked
|
||||
avpfEnabled: avpfEnabled.checked,
|
||||
iceEnabled: iceEnabled.checked,
|
||||
turnEnabled: turnEnabled.checked,
|
||||
stunServer: stunServer.text,
|
||||
turnUser: turnUser.text,
|
||||
turnPassword: turnPassword.text
|
||||
})) {
|
||||
dialog.exit(1)
|
||||
} else {
|
||||
|
|
@ -108,3 +118,5 @@ function handleTransportChanged (transport) {
|
|||
dialog._serverAddressOk = false
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -42,131 +42,206 @@ DialogPlus {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Form {
|
||||
anchors.fill: parent
|
||||
TabContainer {
|
||||
Column {
|
||||
width: parent.width
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('sipAddressLabel') + '*'
|
||||
Form {
|
||||
title: qsTr('mainSipAccountSettingsTitle')
|
||||
width: parent.width
|
||||
|
||||
TextField {
|
||||
id: sipAddress
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('sipAddressLabel') + '*'
|
||||
|
||||
error: dialog._sipAddressOk ? '' : qsTr('invalidSipAddress')
|
||||
TextField {
|
||||
id: sipAddress
|
||||
|
||||
onTextChanged: Logic.handleSipAddressChanged(text)
|
||||
error: dialog._sipAddressOk ? '' : qsTr('invalidSipAddress')
|
||||
|
||||
onTextChanged: Logic.handleSipAddressChanged(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('serverAddressLabel') + '*'
|
||||
|
||||
TextField {
|
||||
id: serverAddress
|
||||
|
||||
error: dialog._serverAddressOk ? '' : qsTr('invalidServerAddress')
|
||||
|
||||
onTextChanged: Logic.handleServerAddressChanged(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('registrationDurationLabel')
|
||||
|
||||
NumericField {
|
||||
id: registrationDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('transportLabel')
|
||||
|
||||
ComboBox {
|
||||
id: transport
|
||||
|
||||
enabled: dialog._serverAddressOk
|
||||
model: [ 'UDP', 'TCP', 'TLS', 'DTLS' ]
|
||||
|
||||
onActivated: Logic.handleTransportChanged(model[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('routeLabel')
|
||||
|
||||
TextField {
|
||||
id: route
|
||||
|
||||
error: dialog._routeOk ? '' : qsTr('invalidRoute')
|
||||
|
||||
onTextChanged: Logic.handleRouteChanged(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('contactParamsLabel')
|
||||
|
||||
TextField {
|
||||
id: contactParams
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('avpfIntervalLabel')
|
||||
|
||||
NumericField {
|
||||
id: avpfInterval
|
||||
|
||||
maxValue: 5
|
||||
minValue: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('registerEnabledLabel')
|
||||
|
||||
Switch {
|
||||
id: registerEnabled
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('publishPresenceLabel')
|
||||
|
||||
Switch {
|
||||
id: publishPresence
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('avpfEnabledLabel')
|
||||
|
||||
Switch {
|
||||
id: avpfEnabled
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('serverAddressLabel') + '*'
|
||||
// -----------------------------------------------------------------------
|
||||
// NAT and Firewall.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
TextField {
|
||||
id: serverAddress
|
||||
Form {
|
||||
title: qsTr('natAndFirewallTitle')
|
||||
width: parent.width
|
||||
|
||||
error: dialog._serverAddressOk ? '' : qsTr('invalidServerAddress')
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('enableIceLabel')
|
||||
|
||||
onTextChanged: Logic.handleServerAddressChanged(text)
|
||||
Switch {
|
||||
id: iceEnabled
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
|
||||
FormGroup {
|
||||
label: qsTr('stunServerLabel')
|
||||
|
||||
TextField {
|
||||
id: stunServer
|
||||
|
||||
readOnly: !iceEnabled.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('registrationDurationLabel')
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('enableTurnLabel')
|
||||
|
||||
NumericField {
|
||||
id: registrationDuration
|
||||
Switch {
|
||||
id: turnEnabled
|
||||
|
||||
enabled: iceEnabled.checked
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
|
||||
FormGroup {
|
||||
label: qsTr('turnUserLabel')
|
||||
|
||||
TextField {
|
||||
id: turnUser
|
||||
|
||||
readOnly: !turnEnabled.checked || !turnEnabled.enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('transportLabel')
|
||||
FormLine {
|
||||
FormGroup {}
|
||||
|
||||
ComboBox {
|
||||
id: transport
|
||||
FormGroup {
|
||||
label: qsTr('turnPasswordLabel')
|
||||
|
||||
enabled: dialog._serverAddressOk
|
||||
model: [ 'UDP', 'TCP', 'TLS', 'DTLS' ]
|
||||
|
||||
onActivated: Logic.handleTransportChanged(model[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('routeLabel')
|
||||
|
||||
TextField {
|
||||
id: route
|
||||
|
||||
error: dialog._routeOk ? '' : qsTr('invalidRoute')
|
||||
|
||||
onTextChanged: Logic.handleRouteChanged(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('contactParamsLabel')
|
||||
|
||||
TextField {
|
||||
id: contactParams
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('avpfIntervalLabel')
|
||||
|
||||
NumericField {
|
||||
id: avpfInterval
|
||||
|
||||
maxValue: 5
|
||||
minValue: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('registerEnabledLabel')
|
||||
|
||||
Switch {
|
||||
id: registerEnabled
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('publishPresenceLabel')
|
||||
|
||||
Switch {
|
||||
id: publishPresence
|
||||
|
||||
onClicked: checked = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('avpfEnabledLabel')
|
||||
|
||||
Switch {
|
||||
id: avpfEnabled
|
||||
|
||||
onClicked: checked = !checked
|
||||
TextField {
|
||||
id: turnPassword
|
||||
readOnly: !turnEnabled.checked || !turnEnabled.enabled || !turnUser.text.length
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ import QtQml 2.2
|
|||
|
||||
QtObject {
|
||||
property int height: 550
|
||||
property int width: 600
|
||||
property int width: 934
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue