mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-04 02:03:59 +00:00
Quite a big commit that might break a lot of things. Will fix tomorrow if it does. There is now the possibility of adding accounts. Make sure to remove your configs before trying this.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16297 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
#include <QtGui>
|
||||
#include "accountdialog.h"
|
||||
#include "ui_accountdialog.h"
|
||||
#include "fshost.h"
|
||||
|
||||
AccountDialog::AccountDialog(QWidget *parent) :
|
||||
AccountDialog::AccountDialog(int accId, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_accId(accId),
|
||||
ui(new Ui::AccountDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -57,9 +59,16 @@ void AccountDialog::addExtraParam()
|
||||
|
||||
void AccountDialog::writeConfig()
|
||||
{
|
||||
_settings->beginGroup("FreeSWITCH/conf/accounts");
|
||||
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
|
||||
|
||||
_settings->beginGroup(ui->sofiaGwNameEdit->text());
|
||||
_settings->beginGroup(QString::number(_accId));
|
||||
|
||||
_settings->beginGroup("gateway/attrs");
|
||||
_settings->setValue("name", ui->sofiaGwNameEdit->text());
|
||||
_settings->endGroup();
|
||||
|
||||
|
||||
_settings->beginGroup("gateway/params");
|
||||
_settings->setValue("username", ui->sofiaGwUsernameEdit->text());
|
||||
_settings->setValue("realm", ui->sofiaGwRealmEdit->text());
|
||||
_settings->setValue("password", ui->sofiaGwPasswordEdit->text());
|
||||
@@ -67,9 +76,7 @@ void AccountDialog::writeConfig()
|
||||
_settings->setValue("expire-seconds", ui->sofiaGwExpireSecondsSpin->value());
|
||||
_settings->setValue("register", ui->sofiaGwRegisterCombo->currentText());
|
||||
_settings->setValue("register-transport", ui->sofiaGwRegisterTransportCombo->currentText());
|
||||
_settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());
|
||||
|
||||
_settings->beginGroup("customParams");
|
||||
_settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());
|
||||
for (int i = 0; i< ui->sofiaExtraParamTable->rowCount(); i++)
|
||||
{
|
||||
_settings->setValue(ui->sofiaExtraParamTable->item(i, 0)->text(),
|
||||
@@ -80,6 +87,14 @@ void AccountDialog::writeConfig()
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->endGroup();
|
||||
|
||||
QString res;
|
||||
if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
|
||||
return;
|
||||
}
|
||||
emit gwAdded();
|
||||
}
|
||||
|
||||
void AccountDialog::changeEvent(QEvent *e)
|
||||
|
||||
@@ -12,9 +12,12 @@ class QSettings;
|
||||
class AccountDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AccountDialog(QWidget *parent = 0);
|
||||
AccountDialog(int accId, QWidget *parent = 0);
|
||||
~AccountDialog();
|
||||
|
||||
signals:
|
||||
void gwAdded();
|
||||
|
||||
private slots:
|
||||
void writeConfig();
|
||||
void addExtraParam();
|
||||
@@ -24,6 +27,7 @@ protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
int _accId;
|
||||
Ui::AccountDialog *ui;
|
||||
QSettings *_settings;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
#include <QtGui>
|
||||
#include "prefaccounts.h"
|
||||
#include "accountdialog.h"
|
||||
|
||||
PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
|
||||
_ui(ui)
|
||||
{
|
||||
_settings = new QSettings();
|
||||
_accDlg = NULL;
|
||||
connect(_ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
|
||||
}
|
||||
|
||||
void PrefAccounts::addAccountBtnClicked()
|
||||
{
|
||||
if (!_accDlg)
|
||||
{
|
||||
_accDlg = new AccountDialog(_ui->accountsTable->rowCount());
|
||||
connect(_accDlg, SIGNAL(gwAdded()), this, SLOT(readConfig()));
|
||||
}
|
||||
|
||||
_accDlg->show();
|
||||
_accDlg->raise();
|
||||
_accDlg->activateWindow();
|
||||
}
|
||||
|
||||
void PrefAccounts::writeConfig()
|
||||
@@ -14,13 +30,22 @@ void PrefAccounts::writeConfig()
|
||||
|
||||
void PrefAccounts::readConfig()
|
||||
{
|
||||
_settings->beginGroup("FreeSWITCH/conf/accounts");
|
||||
foreach(QString accountName, _settings->childGroups())
|
||||
|
||||
_ui->accountsTable->clearContents();
|
||||
_ui->accountsTable->setRowCount(0);
|
||||
|
||||
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
|
||||
|
||||
foreach(QString accId, _settings->childGroups())
|
||||
{
|
||||
_settings->beginGroup(accountName);
|
||||
QTableWidgetItem *item0 = new QTableWidgetItem(accountName);
|
||||
_settings->beginGroup(accId);
|
||||
_settings->beginGroup("gateway/attrs");
|
||||
QTableWidgetItem *item0 = new QTableWidgetItem(_settings->value("name").toString());
|
||||
_settings->endGroup();
|
||||
_settings->beginGroup("gateway/params");
|
||||
QTableWidgetItem *item1 = new QTableWidgetItem(_settings->value("username").toString());
|
||||
_settings->endGroup();
|
||||
_settings->endGroup();
|
||||
_ui->accountsTable->setRowCount(_ui->accountsTable->rowCount()+1);
|
||||
_ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 0, item0);
|
||||
_ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 1, item1);
|
||||
|
||||
@@ -5,16 +5,23 @@
|
||||
#include "ui_prefdialog.h"
|
||||
|
||||
class QSettings;
|
||||
class AccountDialog;
|
||||
|
||||
class PrefAccounts
|
||||
{
|
||||
class PrefAccounts : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PrefAccounts(Ui::PrefDialog *ui);
|
||||
void readConfig();
|
||||
void writeConfig();
|
||||
|
||||
public slots:
|
||||
void readConfig();
|
||||
|
||||
private slots:
|
||||
void addAccountBtnClicked();
|
||||
|
||||
private:
|
||||
Ui::PrefDialog *_ui;
|
||||
AccountDialog *_accDlg;
|
||||
QSettings *_settings;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "ui_prefdialog.h"
|
||||
#include "prefportaudio.h"
|
||||
#include "prefsofia.h"
|
||||
#include "accountdialog.h"
|
||||
#include "prefaccounts.h"
|
||||
|
||||
PrefDialog::PrefDialog(QWidget *parent) :
|
||||
@@ -13,12 +12,10 @@ PrefDialog::PrefDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
_settings = new QSettings();
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
|
||||
connect(ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
|
||||
|
||||
_accDlg = NULL;
|
||||
/*_pref_accounts = new PrefAccounts(ui);*/
|
||||
_pref_accounts = new PrefAccounts(ui);
|
||||
_mod_portaudio = new PrefPortaudio(ui, this);
|
||||
/*_mod_sofia = new PrefSofia(ui, this);*/
|
||||
_mod_sofia = new PrefSofia(ui, this);
|
||||
readConfig();
|
||||
}
|
||||
|
||||
@@ -27,20 +24,10 @@ PrefDialog::~PrefDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PrefDialog::addAccountBtnClicked()
|
||||
{
|
||||
if (!_accDlg)
|
||||
_accDlg = new AccountDialog();
|
||||
|
||||
_accDlg->show();
|
||||
_accDlg->raise();
|
||||
_accDlg->activateWindow();
|
||||
}
|
||||
|
||||
void PrefDialog::writeConfig()
|
||||
{
|
||||
_mod_portaudio->writeConfig();
|
||||
/*_mod_sofia->writeConfig();*/
|
||||
_mod_sofia->writeConfig();
|
||||
}
|
||||
|
||||
void PrefDialog::changeEvent(QEvent *e)
|
||||
@@ -57,7 +44,7 @@ void PrefDialog::changeEvent(QEvent *e)
|
||||
|
||||
void PrefDialog::readConfig()
|
||||
{
|
||||
/*_pref_accounts->readConfig();*/
|
||||
_pref_accounts->readConfig();
|
||||
_mod_portaudio->readConfig();
|
||||
/*_mod_sofia->readConfig();*/
|
||||
_mod_sofia->readConfig();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
class PrefPortaudio;
|
||||
class PrefSofia;
|
||||
class PrefAccounts;
|
||||
class AccountDialog;
|
||||
|
||||
namespace Ui {
|
||||
class PrefDialog;
|
||||
@@ -25,17 +24,15 @@ protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
void addAccountBtnClicked();
|
||||
void writeConfig();
|
||||
|
||||
private:
|
||||
void readConfig();
|
||||
QSettings *_settings;
|
||||
AccountDialog *_accDlg;
|
||||
/* PrefAccounts *_pref_accounts;*/
|
||||
PrefAccounts *_pref_accounts;
|
||||
Ui::PrefDialog *ui;
|
||||
PrefPortaudio *_mod_portaudio;
|
||||
/* PrefSofia *_mod_sofia;*/
|
||||
PrefSofia *_mod_sofia;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -72,9 +72,6 @@
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/images/pref_accounts.jpg</normaloff>:/images/pref_accounts.jpg</iconset>
|
||||
</property>
|
||||
<property name="flags">
|
||||
<set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -84,9 +81,6 @@
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
|
||||
</property>
|
||||
<property name="flags">
|
||||
<set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
|
||||
@@ -72,7 +72,7 @@ void PrefPortaudio::ringFileChoose()
|
||||
void PrefPortaudio::writeConfig()
|
||||
{
|
||||
_settings->beginGroup("FreeSWITCH/conf");
|
||||
_settings->beginGroup("portaudio.conf");
|
||||
_settings->beginGroup("portaudio.conf/settings/params");
|
||||
|
||||
QString cid_name = _settings->value("cid-name").toString();
|
||||
QString ncid_name = _ui->PaCallerIdNameEdit->text();
|
||||
@@ -155,7 +155,7 @@ void PrefPortaudio::readConfig()
|
||||
getPaDevlist();
|
||||
_settings->beginGroup("FreeSWITCH/conf");
|
||||
|
||||
_settings->beginGroup("portaudio.conf");
|
||||
_settings->beginGroup("portaudio.conf/settings/params");
|
||||
_ui->PaCallerIdNameEdit->setText(_settings->value("cid-name").toString());
|
||||
_ui->PaCallerIdNumEdit->setText(_settings->value("cid-num").toString());
|
||||
_ui->PaHoldFileEdit->setText(_settings->value("hold-file").toString());
|
||||
|
||||
@@ -24,12 +24,22 @@ void PrefSofia::writeConfig()
|
||||
_settings->beginGroup("sofia.conf");
|
||||
|
||||
/* General Settings */
|
||||
_settings->beginGroup("global_settings/params");
|
||||
_settings->setValue("log-level", _ui->sofiaLogLevelSpin->value());
|
||||
_settings->setValue("auto-restart", _ui->sofiaAutoRestartCombo->currentText());
|
||||
_settings->setValue("debug-presence", _ui->sofiaDebugPresenceSpin->value());
|
||||
_settings->setValue("rewrite-multicasted-fs-path", _ui->sofiaRewriteMulticastedFsPathCombo->currentText());
|
||||
_settings->endGroup();
|
||||
|
||||
/* Profile settings */
|
||||
_settings->beginGroup("profiles");
|
||||
_settings->beginGroup("profile");
|
||||
|
||||
_settings->beginGroup("attrs");
|
||||
_settings->setValue("name", "softphone");
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->beginGroup("settings/params");
|
||||
_settings->setValue("user-agent-string", _ui->sofiaUserAgentStringEdit->text());
|
||||
_settings->setValue("debug", _ui->sofiaDebugSpin->value());
|
||||
_settings->setValue("sip-trace", _ui->sofiaSipTraceCombo->currentText());
|
||||
@@ -57,7 +67,7 @@ void PrefSofia::writeConfig()
|
||||
_settings->setValue("rtp-hold-timeout-sec", _ui->sofiaRtpHoldTimeoutSecSpin->value());
|
||||
_settings->setValue("disable-register", _ui->sofiaDisableRegisterCombo->currentText());
|
||||
_settings->setValue("challenge-realm", _ui->sofiaChallengeRealmCombo->currentText());
|
||||
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->endGroup();
|
||||
_settings->endGroup();
|
||||
|
||||
Reference in New Issue
Block a user