Commit 0fc72ba7 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

advancedSIPSetting: add additional Connectivity settings

Change-Id: I34156625e5ab3676ddff3b598515630f91940ba3
parent 05966ae3
......@@ -82,8 +82,20 @@ AdvancedSIPSettingsWidget::AdvancedSIPSettingsWidget(QWidget* parent)
connect(ui->lineEditTurnAddressSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNAddress);
connect(ui->lineEditTurnUsernameSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNUsername);
connect(ui->lineEditTurnPsswdSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNPsswd);
connect(ui->lineEditTurnRealmSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNRealm);
connect(ui->lineEditSTUNAddressSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setSTUNAddress);
connect(ui->checkBoxTurnEnableSIP, &QAbstractButton::clicked, [this](int state) {
ui->lineEditTurnAddressSIP->setEnabled((bool)state);
ui->lineEditTurnUsernameSIP->setEnabled((bool)state);
ui->lineEditTurnPsswdSIP->setEnabled((bool)state);
ui->lineEditTurnRealmSIP->setEnabled((bool)state);
});
connect(ui->checkBoxSTUNEnableSIP, &QAbstractButton::clicked, [this](int state) {
ui->lineEditSTUNAddressSIP->setEnabled((bool)state);
});
// codecs
connect(ui->audioListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::audioCodecsStateChange);
connect(ui->videoListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::videoCodecsStateChange);
......@@ -167,8 +179,20 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->lineEditTurnAddressSIP->setText(QString::fromStdString(config.TURN.server));
ui->lineEditTurnUsernameSIP->setText(QString::fromStdString(config.TURN.username));
ui->lineEditTurnPsswdSIP->setText(QString::fromStdString(config.TURN.password));
ui->lineEditTurnRealmSIP->setText(QString::fromStdString(config.TURN.realm));
ui->lineEditTurnAddressSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnUsernameSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnPsswdSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnRealmSIP->setEnabled(config.TURN.enable);
ui->checkBoxSTUNEnableSIP->setChecked(config.STUN.enable);
ui->lineEditSTUNAddressSIP->setText(QString::fromStdString(config.STUN.server));
ui->lineEditSTUNAddressSIP->setEnabled(config.STUN.enable);
ui->registrationExpireTimeoutSpinBox->setValue(config.Registration.expire);
connect(ui->registrationExpireTimeoutSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged);
ui->networkInterfaceSpinBox->setValue(config.localPort);
connect(ui->networkInterfaceSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged);
// codecs
ui->videoCheckBoxSIP->setChecked(config.Video.videoEnabled);
......@@ -244,18 +268,29 @@ void AdvancedSIPSettingsWidget::setTURNAddress()
confProps.TURN.server = ui->lineEditTurnAddressSIP->text().toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setTURNUsername()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = ui->lineEditTurnUsernameSIP->text().toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setTURNPsswd()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = ui->lineEditTurnPsswdSIP->text().toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::setTURNRealm()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.realm = ui->lineEditTurnRealmSIP->text().toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setSTUNAddress()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
......@@ -527,3 +562,19 @@ AdvancedSIPSettingsWidget::openButtonFilePath(const std::string& accConfigFilePa
}
return fileUrl.toStdString();
}
void
AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged(const int& value)
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Registration.expire = value;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged(const int& value)
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.localPort = value;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -77,9 +77,12 @@ private slots:
void setUseTURN(bool state);
void setUseSTUN(bool state);
void registrationTimeoutSpinBoxValueChanged(const int& value);
void networkInterfaceSpinBoxValueChanged(const int& value);
void setTURNAddress();
void setTURNUsername();
void setTURNPsswd();
void setTURNRealm();
void setSTUNAddress();
// codecs
......
<
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>731</width>
<height>1286</height>
<height>1424</height>
</rect>
</property>
<property name="windowTitle">
......@@ -218,95 +218,20 @@
<property name="leftMargin">
<number>0</number>
</property>
<item row="11" column="2">
<widget class="QComboBox" name="tlsProtocolComboBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="insertPolicy">
<enum>QComboBox::InsertAtBottom</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="ToggleSwitch" name="verifyIncomingCertificatesServerToogle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Verify Certificates (Server Side)</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_11">
<item row="12" column="0">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>TLS Protocol Method</string>
<string>Outgoing TLS Server Name</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="btnSIPCACert">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/icons/round-folder-24px.svg</normaloff>images/icons/round-folder-24px.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="1">
<spacer name="horizontalSpacer_15">
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -321,22 +246,10 @@
</property>
</spacer>
</item>
<item row="10" column="0">
<widget class="ToggleSwitch" name="requireCeritificateForTLSIncomingToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>TLS Connections Require Certificate</string>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_22">
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_25">
<item>
<spacer name="horizontalSpacer_16">
<spacer name="horizontalSpacer_21">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -352,23 +265,35 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_18">
<widget class="QLabel" name="label_21">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>CA Certificate</string>
<string>Private Key Password</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_23">
<item row="1" column="0">
<widget class="ToggleSwitch" name="enableSDESToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Enable SDES (Key Exchange)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<spacer name="horizontalSpacer_19">
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -384,43 +309,59 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_19">
<widget class="QLabel" name="label_20">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>User Certificate</string>
<string>Private Key</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_10">
<item row="9" column="0">
<widget class="ToggleSwitch" name="verifyIncomingCertificatesClientToogle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Outgoing TLS Server Name</string>
<property name="text" stdset="0">
<string>Verify Certificates (Client Side)</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_12">
<item row="11" column="0">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Negotitation Timeout (seconds)</string>
<string>TLS Protocol Method</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
......@@ -450,33 +391,36 @@
</item>
</layout>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<widget class="QPushButton" name="btnSIPCACert">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
<width>250</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_20">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Private Key</string>
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/icons/round-folder-24px.svg</normaloff>images/icons/round-folder-24px.svg</iconset>
</property>
</widget>
</item>
......@@ -498,124 +442,75 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="ToggleSwitch" name="fallbackRTPToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Can Fallback on RTP</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="ToggleSwitch" name="enableSDESToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
<item row="3" column="1">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text" stdset="0">
<string>Enable SDES (Key Exchange)</string>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QSpinBox" name="negotiationTimeoutSpinBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_25">
<item row="6" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_21">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QPushButton" name="btnSIPPrivateKey">
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
<width>250</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Private Key Password</string>
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/icons/round-folder-24px.svg</normaloff>images/icons/round-folder-24px.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="ToggleSwitch" name="encryptMediaStreamsToggle" native="true">
<item row="3" column="0">
<widget class="ToggleSwitch" name="encryptNegotitationToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Encrypt Media Streams (SRTP)</string>
<string>Encrypt Negotiation (TLS)</string>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QLineEdit" name="outgoingTLSServerNameLineEdit">
<item row="8" column="0">
<widget class="ToggleSwitch" name="verifyIncomingCertificatesServerToogle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
<property name="text" stdset="0">
<string>Verify Certificates (Server Side)</string>
</property>
</widget>
</item>
<item row="6" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="btnSIPPrivateKey">
<property name="minimumSize">
<size>
<width>250</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/icons/round-folder-24px.svg</normaloff>images/icons/round-folder-24px.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="1">
<spacer name="horizontalSpacer_14">
<property name="orientation">
......@@ -632,20 +527,20 @@
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="ToggleSwitch" name="verifyIncomingCertificatesClientToogle" native="true">
<item row="10" column="0">
<widget class="ToggleSwitch" name="requireCeritificateForTLSIncomingToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Verify Certificates (Client Side)</string>
<string>TLS Connections Require Certificate</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_17">
<item row="1" column="1">
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -660,36 +555,108 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="ToggleSwitch" name="encryptNegotitationToggle" native="true">
<item row="0" column="0">
<widget class="ToggleSwitch" name="encryptMediaStreamsToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Encrypt Negotiation (TLS)</string>
<string>Encrypt Media Streams (SRTP)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="13" column="2">
<widget class="QSpinBox" name="negotiationTimeoutSpinBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<property name="maximum">
<number>3000</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_22">
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_18">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>CA Certificate</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="ToggleSwitch" name="fallbackRTPToggle" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</spacer>
<property name="text" stdset="0">
<string>Can Fallback on RTP</string>
</property>
</widget>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_23">
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>User Certificate</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<item row="10" column="1">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -731,6 +698,42 @@
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Negotitation Timeout (seconds)</string>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QComboBox" name="tlsProtocolComboBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="insertPolicy">
<enum>QComboBox::InsertAtBottom</enum>