Fix editing accounts and add more descriptive information of why it fails.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16504 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
62341a9526
commit
e3ea7c61bb
|
@ -4,6 +4,9 @@
|
||||||
Account::Account(QString name) :
|
Account::Account(QString name) :
|
||||||
_name(name)
|
_name(name)
|
||||||
{
|
{
|
||||||
|
_statusCode = QString();
|
||||||
|
_statusPhrase = QString();
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
|
settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
|
||||||
foreach(QString g, settings.childGroups())
|
foreach(QString g, settings.childGroups())
|
||||||
|
@ -12,7 +15,17 @@ Account::Account(QString name) :
|
||||||
if(settings.value("gateway/attrs/name").toString() == name)
|
if(settings.value("gateway/attrs/name").toString() == name)
|
||||||
{
|
{
|
||||||
_uuid = g;
|
_uuid = g;
|
||||||
|
settings.endGroup();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Account::getStateName()
|
||||||
|
{
|
||||||
|
if (_statusPhrase.isEmpty())
|
||||||
|
return fscomm_gw_state_names[_state];
|
||||||
|
|
||||||
|
return QString("%1 - %2").arg(fscomm_gw_state_names[_state], _statusPhrase);
|
||||||
|
}
|
||||||
|
|
|
@ -35,13 +35,17 @@ public:
|
||||||
QString getName() { return _name; }
|
QString getName() { return _name; }
|
||||||
void setState(int state) { _state = state; }
|
void setState(int state) { _state = state; }
|
||||||
int getState() { return _state; }
|
int getState() { return _state; }
|
||||||
QString getStateName() { return fscomm_gw_state_names[_state]; }
|
QString getStateName();
|
||||||
QString getUUID() { return _uuid; }
|
QString getUUID() { return _uuid; }
|
||||||
|
void setStausCode(QString code) { _statusCode = code; }
|
||||||
|
void setStatusPhrase(QString phrase) { _statusPhrase = phrase; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _name;
|
QString _name;
|
||||||
int _state;
|
int _state;
|
||||||
QString _uuid;
|
QString _uuid;
|
||||||
|
QString _statusCode;
|
||||||
|
QString _statusPhrase;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ACCOUNT_H
|
#endif // ACCOUNT_H
|
||||||
|
|
|
@ -49,7 +49,6 @@ class Call {
|
||||||
public:
|
public:
|
||||||
Call();
|
Call();
|
||||||
Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
|
Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
|
||||||
/*~Call() { qDebug() << "I am being freed uuid: " << _uuid; }*/
|
|
||||||
QString getCidName(void) { return _cid_name; }
|
QString getCidName(void) { return _cid_name; }
|
||||||
QString getCidNumber(void) { return _cid_number; }
|
QString getCidNumber(void) { return _cid_number; }
|
||||||
int getCallID(void) { return _call_id; }
|
int getCallID(void) { return _call_id; }
|
||||||
|
|
|
@ -346,30 +346,38 @@ void FSHost::generalEventHandler(switch_event_t *event)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (state == "TRYING") {
|
if (state == "TRYING") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_TRYING);
|
acc.data()->setState(FSCOMM_GW_STATE_TRYING);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "REGISTER") {
|
} else if (state == "REGISTER") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_REGISTER);
|
acc.data()->setState(FSCOMM_GW_STATE_REGISTER);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "REGED") {
|
} else if (state == "REGED") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_REGED);
|
acc.data()->setState(FSCOMM_GW_STATE_REGED);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "UNREGED") {
|
} else if (state == "UNREGED") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_UNREGED);
|
acc.data()->setState(FSCOMM_GW_STATE_UNREGED);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "UNREGISTER") {
|
} else if (state == "UNREGISTER") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_UNREGISTER);
|
acc.data()->setState(FSCOMM_GW_STATE_UNREGISTER);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state =="FAILED") {
|
} else if (state =="FAILED") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_FAILED);
|
acc.data()->setState(FSCOMM_GW_STATE_FAILED);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "FAIL_WAIT") {
|
} else if (state == "FAIL_WAIT") {
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_FAIL_WAIT);
|
acc.data()->setState(FSCOMM_GW_STATE_FAIL_WAIT);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "EXPIRED") {
|
} else if (state == "EXPIRED") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_EXPIRED);
|
acc.data()->setState(FSCOMM_GW_STATE_EXPIRED);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
} else if (state == "NOREG") {
|
} else if (state == "NOREG") {
|
||||||
|
acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
|
||||||
acc.data()->setState(FSCOMM_GW_STATE_NOREG);
|
acc.data()->setState(FSCOMM_GW_STATE_NOREG);
|
||||||
emit accountStateChange(acc);
|
emit accountStateChange(acc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ void MainWindow::coreLoadingError(QString err)
|
||||||
|
|
||||||
void MainWindow::accountAdd(QSharedPointer<Account> acc)
|
void MainWindow::accountAdd(QSharedPointer<Account> acc)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Adding: " << acc.data()->getName();
|
||||||
ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()+1);
|
ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()+1);
|
||||||
QTableWidgetItem *gwField = new QTableWidgetItem(acc.data()->getName());
|
QTableWidgetItem *gwField = new QTableWidgetItem(acc.data()->getName());
|
||||||
QTableWidgetItem *stField = new QTableWidgetItem(acc.data()->getStateName());
|
QTableWidgetItem *stField = new QTableWidgetItem(acc.data()->getStateName());
|
||||||
|
@ -180,16 +181,17 @@ void MainWindow::accountAdd(QSharedPointer<Account> acc)
|
||||||
|
|
||||||
void MainWindow::accountDel(QSharedPointer<Account> acc)
|
void MainWindow::accountDel(QSharedPointer<Account> acc)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Deleting: " << acc.data()->getName();
|
||||||
foreach (QTableWidgetItem *i, ui->tableAccounts->findItems(acc.data()->getName(), Qt::MatchExactly))
|
foreach (QTableWidgetItem *i, ui->tableAccounts->findItems(acc.data()->getName(), Qt::MatchExactly))
|
||||||
{
|
{
|
||||||
if (i->text() == acc.data()->getName())
|
if (i->text() == acc.data()->getName())
|
||||||
{
|
{
|
||||||
ui->tableAccounts->removeRow(i->row());
|
ui->tableAccounts->removeRow(i->row());
|
||||||
ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()-1);
|
//ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()-1);
|
||||||
ui->tableAccounts->resizeColumnsToContents();
|
ui->tableAccounts->resizeColumnsToContents();
|
||||||
ui->tableAccounts->resizeRowsToContents();
|
ui->tableAccounts->resizeRowsToContents();
|
||||||
ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
|
ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,6 @@ static switch_status_t do_config(void)
|
||||||
settings.beginGroup("FreeSWITCH/conf");
|
settings.beginGroup("FreeSWITCH/conf");
|
||||||
if (settings.childGroups().isEmpty())
|
if (settings.childGroups().isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "We are settings default.";
|
|
||||||
setQSettingsDefaults();
|
setQSettingsDefaults();
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
Loading…
Reference in New Issue