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:
parent
116826880b
commit
2f9ae630c5
|
@ -7,7 +7,6 @@
|
|||
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
|
||||
<X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>
|
||||
<X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>
|
||||
<X-PRE-PROCESS cmd="set" data="default_gateway=default"/>
|
||||
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
|
||||
|
@ -255,6 +254,7 @@
|
|||
</extension>
|
||||
<extension name="number">
|
||||
<condition field="destination_number" expression="^(.*)$">
|
||||
<!-- Default gateway is set by FSComm when default account is selected -->
|
||||
<action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
|
|
@ -130,13 +130,7 @@ void AccountDialog::writeConfig()
|
|||
|
||||
_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();
|
||||
emit gwAdded(_accId);
|
||||
}
|
||||
|
||||
void AccountDialog::clear()
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
void readConfig();
|
||||
|
||||
signals:
|
||||
void gwAdded();
|
||||
void gwAdded(QString);
|
||||
|
||||
private slots:
|
||||
void writeConfig();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ private slots:
|
|||
void addAccountBtnClicked();
|
||||
void editAccountBtnClicked();
|
||||
void remAccountBtnClicked();
|
||||
void applyNewGw(QString);
|
||||
|
||||
private:
|
||||
Ui::PrefDialog *_ui;
|
||||
|
|
|
@ -28,6 +28,7 @@ void PrefDialog::writeConfig()
|
|||
{
|
||||
_mod_portaudio->writeConfig();
|
||||
_mod_sofia->writeConfig();
|
||||
|
||||
}
|
||||
|
||||
void PrefDialog::changeEvent(QEvent *e)
|
||||
|
|
Loading…
Reference in New Issue