First created account is set as default outbound account. Will start making GUI stuff to be able to select between accounts.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16346 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita
2010-01-17 23:10:57 +00:00
parent 116826880b
commit 2f9ae630c5
6 changed files with 28 additions and 11 deletions

View File

@@ -24,7 +24,8 @@ void PrefAccounts::addAccountBtnClicked()
return;
}
_accDlg = new AccountDialog(uuid);
connect(_accDlg, SIGNAL(gwAdded()), this, SLOT(readConfig()));
connect(_accDlg, SIGNAL(gwAdded(QString)), this, SLOT(readConfig()));
connect(_accDlg, SIGNAL(gwAdded(QString)), this, SLOT(applyNewGw(QString)));
}
else
{
@@ -43,6 +44,26 @@ void PrefAccounts::addAccountBtnClicked()
_accDlg->activateWindow();
}
void PrefAccounts::applyNewGw(QString accId)
{
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;
}
if (_ui->accountsTable->rowCount() == 1)
{
_settings->beginGroup("FreeSWITCH/conf/globals");
_settings->setValue("default_gateway",_settings->value("/attrs/name"));
_settings->endGroup();
_settings->beginGroup(QString("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/%1/gateway").arg(accId));
switch_core_set_variable("default_gateway",_settings->value("/attrs/name").toByteArray().data());
_settings->endGroup();
}
}
void PrefAccounts::editAccountBtnClicked()
{
QList<QTableWidgetSelectionRange> selList = _ui->accountsTable->selectedRanges();
@@ -56,7 +77,7 @@ void PrefAccounts::editAccountBtnClicked()
if (!_accDlg)
{
_accDlg = new AccountDialog(uuid);
connect(_accDlg, SIGNAL(gwAdded()), this, SLOT(readConfig()));
connect(_accDlg, SIGNAL(gwAdded(QString)), this, SLOT(readConfig()));
}
else
{