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:
parent
4997568289
commit
0b4a7b63a5
|
@ -1,7 +1,7 @@
|
|||
# #####################################
|
||||
# version check qt
|
||||
# #####################################
|
||||
contains(QT_VERSION, ^4\.[0-4]\..*) {
|
||||
contains(QT_VERSION, ^4\.[0-4]\..*) {
|
||||
message("Cannot build FsGui with Qt version $$QT_VERSION.")
|
||||
error("Use at least Qt 4.5.")
|
||||
}
|
||||
|
@ -38,13 +38,10 @@ HEADERS += mainwindow.h \
|
|||
preferences/prefdialog.h \
|
||||
preferences/prefportaudio.h \
|
||||
preferences/prefsofia.h \
|
||||
preferences/accountdialog.h
|
||||
preferences/accountdialog.h \
|
||||
preferences/prefaccounts.h
|
||||
FORMS += mainwindow.ui \
|
||||
preferences/prefdialog.ui \
|
||||
preferences/accountdialog.ui
|
||||
RESOURCES += resources.qrc
|
||||
OTHER_FILES += conf/portaudio.conf.xml \
|
||||
conf/event_socket.conf.xml \
|
||||
conf/freeswitch.xml \
|
||||
conf/sofia.conf.xml \
|
||||
conf/account.conf.xml
|
||||
OTHER_FILES += conf/freeswitch.xml
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<gateway name="${name}">
|
||||
<param name="username" value="${username}"/>
|
||||
<param name="realm" value="${realm}"/>
|
||||
<param name="from-user" value="${from-user}"/>
|
||||
<param name="from-domain" value="${from-domain}"/>
|
||||
<param name="password" value="${password}"/>
|
||||
<param name="extension" value="${extension}"/>
|
||||
<param name="proxy" value="${proxy}"/>
|
||||
<param name="register-proxy" value="${register-proxy}"/>
|
||||
<param name="expire-seconds" value="${expire-seconds}"/>
|
||||
<param name="register" value="${register}"/>
|
||||
<param name="register-transport" value="${register-transport}"/>
|
||||
<param name="retry-seconds" value="${retry-seconds}"/>
|
||||
<param name="caller-id-in-from" value="${caller-id-in-from}"/>
|
||||
<param name="contact-params" value="${contact-params}"/>
|
||||
<param name="ping" value="${ping}"/>
|
||||
</gateway>
|
|
@ -1,12 +0,0 @@
|
|||
<document type="freeswitch/xml">
|
||||
<section name="configuration">
|
||||
<configuration name="event_socket.conf" description="Socket Client">
|
||||
<settings>
|
||||
<param name="nat-map" value="false"/>
|
||||
<param name="listen-ip" value="127.0.0.1"/>
|
||||
<param name="listen-port" value="8021"/>
|
||||
<param name="password" value="ClueCon"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
</section>
|
||||
</document>
|
|
@ -99,6 +99,33 @@
|
|||
</modules>
|
||||
</configuration>
|
||||
|
||||
<configuration name="portaudio.conf" description="Soundcard Endpoint">
|
||||
<settings>
|
||||
<param name="indev" value=""/>
|
||||
<!-- device to use for output -->
|
||||
<param name="outdev" value=""/>
|
||||
<!--<param name="ringdev" value=""/>-->
|
||||
<param name="ring-file" value="tone_stream://%(2000,4000,440.0,480.0);loops=20"/>
|
||||
<param name="ring-interval" value="5"/>
|
||||
<param name="hold-file" value="$${hold_music}"/>
|
||||
<!--<param name="timer-name" value="soft"/>-->
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="cid-name" value="$${outbound_caller_name}"/>
|
||||
<param name="cid-num" value="$${outbound_caller_number}"/>
|
||||
<param name="sample-rate" value="48000"/>
|
||||
<param name="codec-ms" value="10"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
||||
<configuration name="event_socket.conf" description="Socket Client">
|
||||
<settings>
|
||||
<param name="nat-map" value="false"/>
|
||||
<param name="listen-ip" value="127.0.0.1"/>
|
||||
<param name="listen-port" value="8022"/>
|
||||
<param name="password" value="ClueCon"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
||||
<configuration name="post_load_modules.conf" description="Modules">
|
||||
<modules>
|
||||
</modules>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<document type="freeswitch/xml">
|
||||
<section name="configuration">
|
||||
<configuration name="portaudio.conf" description="Soundcard Endpoint">
|
||||
<settings>
|
||||
<!-- DO NOT take the # off the devices config -->
|
||||
<param name="indev" value="#${indev}"/>
|
||||
<!-- device to use for output -->
|
||||
<param name="outdev" value="#${outdev}"/>
|
||||
<param name="ringdev" value="#${ringdev}"/>
|
||||
<param name="ring-file" value="${ring-file}"/>
|
||||
<param name="ring-interval" value="${ring-interval}"/>
|
||||
<param name="hold-file" value="${hold-file}"/>
|
||||
<!--<param name="timer-name" value="soft"/>-->
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="cid-name" value="${cid-name}"/>
|
||||
<param name="cid-num" value="${cid-num}"/>
|
||||
<param name="sample-rate" value="48000"/>
|
||||
<param name="codec-ms" value="10"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
</section>
|
||||
</document>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<document type="freeswitch/xml">
|
||||
<section name="configuration">
|
||||
<configuration name="sofia.conf" description="sofia Endpoint">
|
||||
<global_settings>
|
||||
<param name="log-level" value="${log-level}"/>
|
||||
<param name="auto-restart" value="${auto-restart}"/>
|
||||
<param name="debug-presence" value="${debug-presence}"/>
|
||||
<param name="rewrite-multicasted-fs-path" value="${rewrite-multicasted-fs-path}"/>
|
||||
</global_settings>
|
||||
<profiles>
|
||||
<profile name="softphone">
|
||||
<gateways>
|
||||
</gateways>
|
||||
<settings>
|
||||
<param name="user-agent-string" value="${user-agent-string)"/>
|
||||
<param name="debug" value="${debug}"/>
|
||||
<param name="sip-trace" value="${sip-trace}"/>
|
||||
<param name="context" value="${context}"/>
|
||||
<param name="rfc2833-pt" value="${rfc2833-pt}"/>
|
||||
<param name="sip-port" value="${sip-port}"/>
|
||||
<param name="dialplan" value="${dialplan}"/>
|
||||
<param name="dtmf-duration" value="${dtmf-duration}"/>
|
||||
<param name="codec-prefs" value="${codec_prefs}"/>
|
||||
<param name="use-rtp-timer" value="${use-rtp-timer}"/>
|
||||
<param name="rtp-timer-name" value="${rtp-timer-name}"/>
|
||||
<param name="rtp-ip" value="${rtp-ip}"/>
|
||||
<param name="sip-ip" value="${sip-ip}"/>
|
||||
<param name="hold-music" value="${hold-music}"/>
|
||||
<param name="apply-nat-acl" value="${apply-nat-acl}"/>
|
||||
<param name="manage-presence" value="${manage-presence}"/>
|
||||
<param name="max-proceeding" value="${max-proceeding}"/>
|
||||
<param name="inbound-codec-negotiation" value="${inbound-codec-negotiation}"/>
|
||||
<param name="nonce-ttl" value="${nonce-ttl}"/>
|
||||
<param name="auth-calls" value="${auth-calls}"/>
|
||||
<param name="auth-all-packets" value="${auth-all-packets}"/>
|
||||
<param name="ext-rtp-ip" value="${ext-rtp-ip}"/>
|
||||
<param name="ext-sip-ip" value="${ext-sip-ip}"/>
|
||||
<param name="rtp-timeout-sec" value="${rtp-timeout-sec}"/>
|
||||
<param name="rtp-hold-timeout-sec" value="${rtp-hold-timeout-sec}"/>
|
||||
<param name="disable-register" value="${disable-register}"/>
|
||||
<param name="challenge-realm" value="${challenge-realm}"/>
|
||||
</settings>
|
||||
</profile>
|
||||
</profiles>
|
||||
</configuration>
|
||||
</section>
|
||||
</document>
|
|
@ -56,7 +56,6 @@ void FSHost::createFolders()
|
|||
conf_dir.mkpath(".fscomm/conf/accounts");
|
||||
conf_dir.mkpath(".fscomm/sounds");
|
||||
QFile::copy(":/sounds/test.wav", QString("%1/.fscomm/sounds/test.wav").arg(QDir::homePath()));
|
||||
conf_dir.mkpath(".fscomm/templates");
|
||||
QFile rootXML(":/confs/freeswitch.xml");
|
||||
QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
|
||||
rootXML.copy(dest);
|
||||
|
|
|
@ -33,128 +33,106 @@
|
|||
#include <QString>
|
||||
#include <QtGui>
|
||||
#include <QDir>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNodeList>
|
||||
#include <QXmlStreamWriter>
|
||||
#include "mod_qsettings/mod_qsettings.h"
|
||||
|
||||
switch_xml_t XMLBinding::getConfigXML(QString tmpl)
|
||||
{
|
||||
switch_event_t *e;
|
||||
switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
|
||||
switch_assert(e);
|
||||
|
||||
if (QFile::exists(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
|
||||
"Using template %s.xml on .fscomm/.\n",
|
||||
tmpl.toAscii().constData());
|
||||
}
|
||||
else if(QFile::exists(QString(":/confs/%1.xml").arg(tmpl)))
|
||||
_settings->beginGroup("FreeSWITCH/conf");
|
||||
if (!_settings->childGroups().contains(tmpl))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
|
||||
"Template %s.xml, doesn't exist on directory, copying embedded template.\n",
|
||||
tmpl.toAscii().constData());
|
||||
QString dest = QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl);
|
||||
QString orig = QString(":/confs/%1.xml").arg(tmpl);
|
||||
QFile::copy(orig, dest);
|
||||
}
|
||||
|
||||
QFile tmplFile(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl));
|
||||
if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template %s could not be read!\n", tmpl.toAscii().constData());
|
||||
_settings->endGroup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Open template file and expand all strings based on QSettings */
|
||||
QByteArray tmplContents(tmplFile.readAll());
|
||||
tmplFile.close();
|
||||
|
||||
_settings->beginGroup("FreeSWITCH/conf");
|
||||
_settings->beginGroup(tmpl);
|
||||
foreach(QString k, _settings->childKeys())
|
||||
|
||||
QByteArray *finalXML = new QByteArray();
|
||||
QXmlStreamWriter streamWriter(finalXML);
|
||||
|
||||
streamWriter.setAutoFormatting(true);
|
||||
streamWriter.writeStartElement("document");
|
||||
streamWriter.writeAttribute("type", "freeswitch/xml");
|
||||
|
||||
streamWriter.writeStartElement("section");
|
||||
streamWriter.writeAttribute("name", "configuration");
|
||||
|
||||
streamWriter.writeStartElement("configuration");
|
||||
streamWriter.writeAttribute("name", tmpl);
|
||||
streamWriter.writeAttribute("description", "Configuration generated by QSettings");
|
||||
|
||||
foreach (QString group, _settings->childGroups())
|
||||
{
|
||||
switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
|
||||
parseGroup(&streamWriter, group);
|
||||
}
|
||||
|
||||
streamWriter.writeEndElement();
|
||||
streamWriter.writeEndElement();
|
||||
streamWriter.writeEndElement();
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config for %s requested. Providing the following XML:\n%s\n",
|
||||
tmpl.toAscii().constData(), finalXML->data());
|
||||
|
||||
_settings->endGroup();
|
||||
_settings->endGroup();
|
||||
|
||||
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));
|
||||
return switch_xml_parse_str(finalXML->data(), strlen(finalXML->data()));
|
||||
}
|
||||
|
||||
switch_xml_t XMLBinding::proccessAccounts(QString tmpl, QByteArray xml)
|
||||
void XMLBinding::parseGroup(QXmlStreamWriter *streamWriter, QString group)
|
||||
{
|
||||
char *res = NULL;
|
||||
|
||||
QDomDocument xmlDom;
|
||||
|
||||
/* Process sofia accounts */
|
||||
if (tmpl == "sofia.conf")
|
||||
if (group == "attrs")
|
||||
{
|
||||
int errorLine, errorColumn;
|
||||
QString errorMsg;
|
||||
|
||||
if (!xmlDom.setContent(xml, &errorMsg, &errorLine, &errorColumn))
|
||||
_settings->beginGroup(group);
|
||||
foreach (QString k, _settings->childKeys())
|
||||
{
|
||||
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);
|
||||
streamWriter->writeAttribute(k, _settings->value(k).toString());
|
||||
}
|
||||
_settings->endGroup();
|
||||
return;
|
||||
}
|
||||
|
||||
return switch_xml_parse_str(xmlDom.toByteArray().data(), strlen(xmlDom.toByteArray().data()));
|
||||
if (group == "params")
|
||||
{
|
||||
_settings->beginGroup(group);
|
||||
foreach(QString param, _settings->childKeys())
|
||||
{
|
||||
streamWriter->writeStartElement("param");
|
||||
streamWriter->writeAttribute("name", param);
|
||||
streamWriter->writeAttribute("value", _settings->value(param).toString());
|
||||
streamWriter->writeEndElement();
|
||||
}
|
||||
_settings->endGroup();
|
||||
return;
|
||||
}
|
||||
|
||||
if (group == "gateways")
|
||||
{
|
||||
streamWriter->writeStartElement(group);
|
||||
_settings->beginGroup(group);
|
||||
foreach (QString gw, _settings->childGroups())
|
||||
{
|
||||
_settings->beginGroup(gw);
|
||||
foreach(QString g, _settings->childGroups())
|
||||
{
|
||||
parseGroup(streamWriter, g);
|
||||
}
|
||||
_settings->endGroup();
|
||||
}
|
||||
_settings->endGroup();
|
||||
streamWriter->writeEndElement();
|
||||
return;
|
||||
}
|
||||
|
||||
_settings->beginGroup(group);
|
||||
streamWriter->writeStartElement(group);
|
||||
|
||||
foreach (QString group2, _settings->childGroups())
|
||||
{
|
||||
parseGroup(streamWriter, group2);
|
||||
}
|
||||
|
||||
streamWriter->writeEndElement();
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
QString getBinding(void) { return _binding; }
|
||||
switch_xml_t getConfigXML(QString);
|
||||
private:
|
||||
switch_xml_t proccessAccounts(QString, QByteArray);
|
||||
void parseGroup(QXmlStreamWriter *,QString);
|
||||
QString _binding;
|
||||
QSettings* _settings;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
</qresource>
|
||||
<qresource prefix="/confs">
|
||||
<file alias="freeswitch.xml">conf/freeswitch.xml</file>
|
||||
<file alias="example.xml">conf/accounts/example.xml</file>
|
||||
<file alias="event_socket.conf.xml">conf/event_socket.conf.xml</file>
|
||||
<file alias="portaudio.conf.xml">conf/portaudio.conf.xml</file>
|
||||
<file alias="sofia.conf.xml">conf/sofia.conf.xml</file>
|
||||
<file alias="account.conf.xml">conf/account.conf.xml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/sounds">
|
||||
<file alias="test.wav">resources/test.wav</file>
|
||||
|
|
Loading…
Reference in New Issue