account.cpp 759 B

1234567891011121314151617181920212223242526272829303132
  1. #include <QtGui>
  2. #include "account.h"
  3. #include "fscomm.h"
  4. Account::Account(QString name) :
  5. _name(name)
  6. {
  7. _statusCode = QString();
  8. _statusPhrase = QString();
  9. QSettings settings;
  10. settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
  11. foreach(QString g, settings.childGroups())
  12. {
  13. settings.beginGroup(g);
  14. if(settings.value("gateway/attrs/name").toString() == name)
  15. {
  16. _uuid = g;
  17. settings.endGroup();
  18. break;
  19. }
  20. settings.endGroup();
  21. }
  22. }
  23. QString Account::getStateName()
  24. {
  25. if (_statusPhrase.isEmpty())
  26. return fscomm_gw_state_names[_state];
  27. return QString("%1 - %2").arg(fscomm_gw_state_names[_state], _statusPhrase);
  28. }