forked from Mirrors/freeswitch
Add all the new stuff to persist accounts and sofia configs. Still not working, but a lot work as been done and panes not working are disabled.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16235 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
72d143d0da
commit
fb79c1bfe4
|
@ -29,7 +29,8 @@ SOURCES += main.cpp \
|
|||
preferences/prefdialog.cpp \
|
||||
preferences/prefportaudio.cpp \
|
||||
preferences/prefsofia.cpp \
|
||||
preferences/accountdialog.cpp
|
||||
preferences/accountdialog.cpp \
|
||||
preferences/prefaccounts.cpp
|
||||
HEADERS += mainwindow.h \
|
||||
fshost.h \
|
||||
call.h \
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
</global_settings>
|
||||
<profiles>
|
||||
<profile name="softphone">
|
||||
<gateways>
|
||||
</gateways>
|
||||
<settings>
|
||||
<param name="user-agent-string" value="${user-agent-string)"/>
|
||||
<param name="debug" value="${debug}"/>
|
||||
|
|
|
@ -47,15 +47,10 @@ FSHost::FSHost(QObject *parent) :
|
|||
|
||||
}
|
||||
|
||||
void FSHost::run(void)
|
||||
void FSHost::createFolders()
|
||||
{
|
||||
switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
|
||||
const char *err = NULL;
|
||||
switch_bool_t console = SWITCH_FALSE;
|
||||
switch_status_t destroy_status;
|
||||
|
||||
/* Create directory structure for softphone with default configs */
|
||||
QDir conf_dir = QDir(QDir::home());
|
||||
QDir conf_dir = QDir::home();
|
||||
if (!conf_dir.exists(".fscomm"))
|
||||
{
|
||||
conf_dir.mkpath(".fscomm/conf/accounts");
|
||||
|
@ -66,8 +61,8 @@ void FSHost::run(void)
|
|||
QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
|
||||
rootXML.copy(dest);
|
||||
|
||||
QFile defaultAccount(":/confs/example.xml");
|
||||
dest = QString("%1/.fscomm/conf/accounts/example.xml").arg(conf_dir.absolutePath());
|
||||
QFile defaultAccount(":/confs/template.xml");
|
||||
dest = QString("%1/.fscomm/conf/accounts/template.xml").arg(conf_dir.absolutePath());
|
||||
defaultAccount.copy(dest);
|
||||
}
|
||||
|
||||
|
@ -110,6 +105,16 @@ void FSHost::run(void)
|
|||
}
|
||||
strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData());
|
||||
}
|
||||
}
|
||||
|
||||
void FSHost::run(void)
|
||||
{
|
||||
switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
|
||||
const char *err = NULL;
|
||||
switch_bool_t console = SWITCH_FALSE;
|
||||
switch_status_t destroy_status;
|
||||
|
||||
createFolders();
|
||||
|
||||
/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
|
||||
printf("Initializing core...\n");
|
||||
|
|
|
@ -45,6 +45,7 @@ class Call;
|
|||
#define FSCOMM_GW_STATE_EXPIRED 7
|
||||
#define FSCOMM_GW_STATE_NOREG 8
|
||||
|
||||
|
||||
static const char *fscomm_gw_state_names[] = {
|
||||
"TRYING",
|
||||
"REGISTER",
|
||||
|
@ -83,6 +84,7 @@ signals:
|
|||
private:
|
||||
switch_status_t processBlegEvent(switch_event_t *, QString);
|
||||
switch_status_t processAlegEvent(switch_event_t *, QString);
|
||||
void createFolders();
|
||||
void printEventHeaders(switch_event_t *event);
|
||||
QHash<QString, Call*> _active_calls;
|
||||
QHash<QString, QString> _bleg_uuids;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <QString>
|
||||
#include <QtGui>
|
||||
#include <QDir>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNodeList>
|
||||
#include "mod_qsettings/mod_qsettings.h"
|
||||
|
||||
switch_xml_t XMLBinding::getConfigXML(QString tmpl)
|
||||
|
@ -79,9 +81,82 @@ switch_xml_t XMLBinding::getConfigXML(QString tmpl)
|
|||
char *res = switch_event_expand_headers(e, tmplContents.data());
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res);
|
||||
switch_safe_free(e);
|
||||
if (tmpl == "sofia.conf")
|
||||
{
|
||||
return proccessAccounts(tmpl, res);
|
||||
}
|
||||
return switch_xml_parse_str(res, strlen(res));
|
||||
}
|
||||
|
||||
switch_xml_t XMLBinding::proccessAccounts(QString tmpl, QByteArray xml)
|
||||
{
|
||||
char *res = NULL;
|
||||
|
||||
QDomDocument xmlDom;
|
||||
|
||||
/* Process sofia accounts */
|
||||
if (tmpl == "sofia.conf")
|
||||
{
|
||||
int errorLine, errorColumn;
|
||||
QString errorMsg;
|
||||
|
||||
if (!xmlDom.setContent(xml, &errorMsg, &errorLine, &errorColumn))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not parse the xml template from sofia.conf.xml to add the accounts!\n");
|
||||
}
|
||||
QDomNodeList gatewaysNodeList = xmlDom.elementsByTagName("gateways");
|
||||
if (gatewaysNodeList.isEmpty() || gatewaysNodeList.count() > 1)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Where is my gateways tag? Or do we have more then one match?\n");
|
||||
}
|
||||
|
||||
QDomNode gatewaysNode = gatewaysNodeList.at(0);
|
||||
|
||||
_settings->beginGroup("FreeSWITCH/conf/accounts");
|
||||
foreach (QString account, _settings->childGroups())
|
||||
{
|
||||
switch_event_t *e;
|
||||
switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
|
||||
switch_assert(e);
|
||||
|
||||
_settings->beginGroup(account);
|
||||
switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, "name", account.toAscii().data());
|
||||
foreach (QString k, _settings->childKeys())
|
||||
{
|
||||
switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
|
||||
}
|
||||
_settings->endGroup();
|
||||
|
||||
/* Open template file and expand all strings based on QSettings */
|
||||
QFile tmplFile(QString("%1/.fscomm/templates/account.conf.xml").arg(QDir::homePath()));
|
||||
if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template for accounts could not be read!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QByteArray tmplContents(tmplFile.readAll());
|
||||
tmplFile.close();
|
||||
|
||||
res = switch_event_expand_headers(e, tmplContents.data());
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template of account %s as follows:\n%s", account.toAscii().data(), res);
|
||||
|
||||
QDomDocument gatewayXML;
|
||||
if (!gatewayXML.setContent(QByteArray(res), &errorMsg, &errorLine, &errorColumn))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We could not parse the XML for the account!\n");
|
||||
}
|
||||
|
||||
gatewaysNode.appendChild(gatewayXML);
|
||||
switch_safe_free(e);
|
||||
}
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
return switch_xml_parse_str(xmlDom.toByteArray().data(), strlen(xmlDom.toByteArray().data()));
|
||||
}
|
||||
|
||||
static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
|
||||
void *user_data)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
QString getBinding(void) { return _binding; }
|
||||
switch_xml_t getConfigXML(QString);
|
||||
private:
|
||||
switch_xml_t proccessAccounts(QString, QByteArray);
|
||||
QString _binding;
|
||||
QSettings* _settings;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <QSettings>
|
||||
#include <QtGui>
|
||||
#include "accountdialog.h"
|
||||
#include "ui_accountdialog.h"
|
||||
|
||||
|
@ -9,6 +10,8 @@ AccountDialog::AccountDialog(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
_settings = new QSettings;
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
|
||||
connect(ui->sofiaExtraParamAddBtn, SIGNAL(clicked()), this, SLOT(addExtraParam()));
|
||||
connect(ui->sofiaExtraParamRemBtn, SIGNAL(clicked()), this, SLOT(remExtraParam()));
|
||||
}
|
||||
|
||||
AccountDialog::~AccountDialog()
|
||||
|
@ -16,6 +19,42 @@ AccountDialog::~AccountDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void AccountDialog::remExtraParam()
|
||||
{
|
||||
QList<QTableWidgetSelectionRange> sel = ui->sofiaExtraParamTable->selectedRanges();
|
||||
|
||||
foreach(QTableWidgetSelectionRange range, sel)
|
||||
{
|
||||
int offset =0;
|
||||
for(int row = range.topRow(); row<=range.bottomRow(); row++)
|
||||
{
|
||||
ui->sofiaExtraParamTable->removeRow(row-offset);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AccountDialog::addExtraParam()
|
||||
{
|
||||
bool ok;
|
||||
QString paramName = QInputDialog::getText(this, tr("Add parameter."),
|
||||
tr("New parameter name:"), QLineEdit::Normal,
|
||||
NULL, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
QString paramVal = QInputDialog::getText(this, tr("Add parameter."),
|
||||
tr("New parameter value:"), QLineEdit::Normal,
|
||||
NULL, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
QTableWidgetItem* paramNameItem = new QTableWidgetItem(paramName);
|
||||
QTableWidgetItem* paramValItem = new QTableWidgetItem(paramVal);
|
||||
ui->sofiaExtraParamTable->setRowCount(ui->sofiaExtraParamTable->rowCount()+1);
|
||||
ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,0,paramNameItem);
|
||||
ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,1,paramValItem);
|
||||
}
|
||||
|
||||
void AccountDialog::writeConfig()
|
||||
{
|
||||
_settings->beginGroup("FreeSWITCH/conf/accounts");
|
||||
|
@ -23,19 +62,21 @@ void AccountDialog::writeConfig()
|
|||
_settings->beginGroup(ui->sofiaGwNameEdit->text());
|
||||
_settings->setValue("username", ui->sofiaGwUsernameEdit->text());
|
||||
_settings->setValue("realm", ui->sofiaGwRealmEdit->text());
|
||||
_settings->setValue("from-user", ui->sofiaGwFromUserEdit->text());
|
||||
_settings->setValue("from-domain", ui->sofiaGwFromDomainEdit->text());
|
||||
_settings->setValue("password", ui->sofiaGwPasswordEdit->text());
|
||||
_settings->setValue("extension", ui->sofiaGwExtensionEdit->text());
|
||||
_settings->setValue("proxy", ui->sofiaGwProxyEdit->text());
|
||||
_settings->setValue("register-proxy", ui->sofiaGwRegisterProxyEdit->text());
|
||||
_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->setValue("caller-id-in-from", ui->sofiaGwCallerIdInFromCombo->currentText());
|
||||
_settings->setValue("contact-params", ui->sofiaGwContactParamsEdit->text());
|
||||
_settings->setValue("ping", ui->sofiaGwPingSpin->value());
|
||||
|
||||
_settings->beginGroup("customParams");
|
||||
for (int i = 0; i< ui->sofiaExtraParamTable->rowCount(); i++)
|
||||
{
|
||||
_settings->setValue(ui->sofiaExtraParamTable->item(i, 0)->text(),
|
||||
ui->sofiaExtraParamTable->item(i, 1)->text());
|
||||
}
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->endGroup();
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
|
||||
private slots:
|
||||
void writeConfig();
|
||||
void addExtraParam();
|
||||
void remExtraParam();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
|
|
@ -9,206 +9,204 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>495</width>
|
||||
<height>573</height>
|
||||
<width>389</width>
|
||||
<height>394</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Account</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>name</string>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Basic</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwNameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>realm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwRealmEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwPasswordEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>extension</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwExtensionEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>expire-seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
|
||||
<property name="value">
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>register</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="sofiaGwRegisterCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>true</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>false</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>register-transport</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>udp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>tcp</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>retry-seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Advanced</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="sofiaExtraParamTable">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Param Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Param Value</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="sofiaExtraParamAddBtn">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sofiaExtraParamRemBtn">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwNameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>realm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwRealmEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>from-user</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwFromUserEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>from-domain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwFromDomainEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwPasswordEdit"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>extension</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwExtensionEdit"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwProxyEdit"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>register-proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwRegisterProxyEdit"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>expire-seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
|
||||
<property name="value">
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>register</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="sofiaGwRegisterCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>true</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>false</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>register-transport</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>udp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>tcp</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>retry-seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>contact-params</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLineEdit" name="sofiaGwContactParamsEdit"/>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>caller-id-in-from</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>ping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QSpinBox" name="sofiaGwPingSpin">
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -218,20 +216,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QComboBox" name="sofiaGwCallerIdInFromCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>false</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>true</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -243,8 +227,8 @@
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>563</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
|
@ -259,8 +243,8 @@
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>563</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#include <QtGui>
|
||||
#include "prefaccounts.h"
|
||||
|
||||
PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
|
||||
_ui(ui)
|
||||
{
|
||||
_settings = new QSettings();
|
||||
}
|
||||
|
||||
void PrefAccounts::writeConfig()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void PrefAccounts::readConfig()
|
||||
{
|
||||
_settings->beginGroup("FreeSWITCH/conf/accounts");
|
||||
foreach(QString accountName, _settings->childGroups())
|
||||
{
|
||||
_settings->beginGroup(accountName);
|
||||
QTableWidgetItem *item0 = new QTableWidgetItem(accountName);
|
||||
QTableWidgetItem *item1 = new QTableWidgetItem(_settings->value("username").toString());
|
||||
_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);
|
||||
}
|
||||
|
||||
_settings->endGroup();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef PREFACCOUNTS_H
|
||||
#define PREFACCOUNTS_H
|
||||
|
||||
#include <QObject>
|
||||
#include "ui_prefdialog.h"
|
||||
|
||||
class QSettings;
|
||||
|
||||
class PrefAccounts
|
||||
{
|
||||
public:
|
||||
explicit PrefAccounts(Ui::PrefDialog *ui);
|
||||
void readConfig();
|
||||
void writeConfig();
|
||||
|
||||
private:
|
||||
Ui::PrefDialog *_ui;
|
||||
QSettings *_settings;
|
||||
};
|
||||
|
||||
#endif // PREFACCOUNTS_H
|
|
@ -4,6 +4,7 @@
|
|||
#include "prefportaudio.h"
|
||||
#include "prefsofia.h"
|
||||
#include "accountdialog.h"
|
||||
#include "prefaccounts.h"
|
||||
|
||||
PrefDialog::PrefDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -15,8 +16,9 @@ PrefDialog::PrefDialog(QWidget *parent) :
|
|||
connect(ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
|
||||
|
||||
_accDlg = NULL;
|
||||
/*_pref_accounts = new PrefAccounts(ui);*/
|
||||
_mod_portaudio = new PrefPortaudio(ui, this);
|
||||
_mod_sofia = new PrefSofia(ui, this);
|
||||
/*_mod_sofia = new PrefSofia(ui, this);*/
|
||||
readConfig();
|
||||
}
|
||||
|
||||
|
@ -55,6 +57,7 @@ void PrefDialog::changeEvent(QEvent *e)
|
|||
|
||||
void PrefDialog::readConfig()
|
||||
{
|
||||
/*_pref_accounts->readConfig();*/
|
||||
_mod_portaudio->readConfig();
|
||||
/*_mod_sofia->readConfig();*/
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
class PrefPortaudio;
|
||||
class PrefSofia;
|
||||
class PrefAccounts;
|
||||
class AccountDialog;
|
||||
|
||||
namespace Ui {
|
||||
|
@ -31,9 +32,10 @@ private:
|
|||
void readConfig();
|
||||
QSettings *_settings;
|
||||
AccountDialog *_accDlg;
|
||||
/* PrefAccounts *_pref_accounts;*/
|
||||
Ui::PrefDialog *ui;
|
||||
PrefPortaudio *_mod_portaudio;
|
||||
PrefSofia *_mod_sofia;
|
||||
/* PrefSofia *_mod_sofia;*/
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
<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">
|
||||
|
@ -81,6 +84,9 @@
|
|||
<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">
|
||||
|
@ -134,15 +140,10 @@
|
|||
<widget class="QWidget" name="accountsPage">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="sofiaGwListWidget">
|
||||
<widget class="QTableWidget" name="accountsTable">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Enabled</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
|
|
Loading…
Reference in New Issue