Account::Account(QString name) :
_name(name)
{
+ _statusCode = QString();
+ _statusPhrase = QString();
+
QSettings settings;
settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
foreach(QString g, settings.childGroups())
if(settings.value("gateway/attrs/name").toString() == name)
{
_uuid = g;
+ settings.endGroup();
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);
+}
QString getName() { return _name; }
void setState(int state) { _state = state; }
int getState() { return _state; }
- QString getStateName() { return fscomm_gw_state_names[_state]; }
+ QString getStateName();
QString getUUID() { return _uuid; }
+ void setStausCode(QString code) { _statusCode = code; }
+ void setStatusPhrase(QString phrase) { _statusPhrase = phrase; }
private:
QString _name;
int _state;
QString _uuid;
+ QString _statusCode;
+ QString _statusPhrase;
};
#endif // ACCOUNT_H
public:
Call();
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 getCidNumber(void) { return _cid_number; }
int getCallID(void) { return _call_id; }
return;
if (state == "TRYING") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_TRYING);
emit accountStateChange(acc);
} else if (state == "REGISTER") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_REGISTER);
emit accountStateChange(acc);
} else if (state == "REGED") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_REGED);
emit accountStateChange(acc);
} else if (state == "UNREGED") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_UNREGED);
emit accountStateChange(acc);
} else if (state == "UNREGISTER") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_UNREGISTER);
emit accountStateChange(acc);
} else if (state =="FAILED") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_FAILED);
emit accountStateChange(acc);
} else if (state == "FAIL_WAIT") {
acc.data()->setState(FSCOMM_GW_STATE_FAIL_WAIT);
emit accountStateChange(acc);
} else if (state == "EXPIRED") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_EXPIRED);
emit accountStateChange(acc);
} else if (state == "NOREG") {
+ acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
acc.data()->setState(FSCOMM_GW_STATE_NOREG);
emit accountStateChange(acc);
}
void MainWindow::accountAdd(QSharedPointer<Account> acc)
{
+ qDebug() << "Adding: " << acc.data()->getName();
ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()+1);
QTableWidgetItem *gwField = new QTableWidgetItem(acc.data()->getName());
QTableWidgetItem *stField = new QTableWidgetItem(acc.data()->getStateName());
void MainWindow::accountDel(QSharedPointer<Account> acc)
{
+ qDebug() << "Deleting: " << acc.data()->getName();
foreach (QTableWidgetItem *i, ui->tableAccounts->findItems(acc.data()->getName(), Qt::MatchExactly))
{
if (i->text() == acc.data()->getName())
{
ui->tableAccounts->removeRow(i->row());
- ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()-1);
+ //ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()-1);
ui->tableAccounts->resizeColumnsToContents();
ui->tableAccounts->resizeRowsToContents();
ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
- return;
+ break;
}
}
}
settings.beginGroup("FreeSWITCH/conf");
if (settings.childGroups().isEmpty())
{
- qDebug() << "We are settings default.";
setQSettingsDefaults();
}
settings.endGroup();