diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 4c15ad5ac57723acd5f8818925d7e3b807aada5f..0e5c29a80433309e03f7310a753806e8fb8d0b66 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -138,6 +138,7 @@ void Account::setRegistrationState(RegistrationState state) // Notify the client ConfigurationManager *c(Manager::instance().getClient()->getConfigurationManager()); c->registrationStateChanged(accountID_, static_cast<int32_t>(registrationState_)); + c->volatileAccountDetailsChanged(getAccountID()); } } @@ -256,9 +257,7 @@ std::map<std::string, std::string> Account::getVolatileAccountDetails() const { std::map<std::string, std::string> a; - RegistrationState state(registrationState_); - - a[CONFIG_ACCOUNT_REGISTRATION_STATUS] = mapStateNumberToString(state); + a[CONFIG_ACCOUNT_REGISTRATION_STATUS] = mapStateNumberToString(registrationState_); return a; } diff --git a/daemon/src/account_schema.h b/daemon/src/account_schema.h index 7a61a87a1571d53836de565a06f31ec8073ce822..f6fddc671f8d5bb347e42c0e3489e8ba0fd18ecf 100644 --- a/daemon/src/account_schema.h +++ b/daemon/src/account_schema.h @@ -44,9 +44,6 @@ static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailb static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable"; static const char *const CONFIG_ACCOUNT_AUTOANSWER = "Account.autoAnswer"; static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire"; -static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus"; -static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode"; -static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription"; static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType"; static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath"; static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled"; @@ -103,4 +100,11 @@ static const char *const CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyCli static const char *const CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate"; static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec"; +// Volatile parameters +static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus"; +static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode"; +static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription"; +static const char *const CONFIG_TLS_TRANSPORT_STATE_CODE = "TLS.transportStatusCode"; +static const char *const CONFIG_TLS_TRANSPORT_STATE_DESC = "TLS.transportStatusDescription"; + #endif // ACCOUNT_SCHEMA_H_ diff --git a/daemon/src/client/configurationmanager.cpp b/daemon/src/client/configurationmanager.cpp index f19a1220e7b0a22181f847ae555c22060c071de2..92e9929c8ffec79229f88fe63a9b125d9b1d5572 100644 --- a/daemon/src/client/configurationmanager.cpp +++ b/daemon/src/client/configurationmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com> @@ -639,8 +639,11 @@ void ConfigurationManager::sipRegistrationStateChanged(const std::string& accoun } -void ConfigurationManager::volatileAccountDetailsChanged(const std::string& accountID, const std::map< std::string, std::string >& details) +void ConfigurationManager::volatileAccountDetailsChanged(const std::string& accountID) { + if (evHandlers_.on_volatile_details_change) { + evHandlers_.on_volatile_details_change(accountID, Manager::instance().getVolatileAccountDetails(accountID)); + } } void ConfigurationManager::errorAlert(int alert) diff --git a/daemon/src/client/configurationmanager.h b/daemon/src/client/configurationmanager.h index 171dad4c0408f60f819d954db7ec13ef37d0fc4d..30774f8a8c002a9a9d2bc59f1be484df419bb65d 100644 --- a/daemon/src/client/configurationmanager.h +++ b/daemon/src/client/configurationmanager.h @@ -156,7 +156,7 @@ class ConfigurationManager void registrationStateChanged(const std::string& accoundID, int state); void sipRegistrationStateChanged(const std::string&, const std::string&, int32_t state); - void volatileAccountDetailsChanged(const std::string& accountID, const std::map< std::string, std::string >& details); + void volatileAccountDetailsChanged(const std::string& accountID); void errorAlert(int alert); std::vector< int32_t > getHardwareAudioFormat(); diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 13c80c083f4e50021a65de64ea832b3a232bb10b..f19d7e533e42a5460494628217ac8f2fa0cc5be0 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -658,6 +658,21 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const std::map<std::string, std::string> SIPAccount::getVolatileAccountDetails() const { std::map<std::string, std::string> a = SIPAccountBase::getVolatileAccountDetails(); + std::stringstream codestream; + codestream << registrationStateDetailed_.first; + a[ CONFIG_ACCOUNT_REGISTRATION_STATE_CODE ] = codestream.str(); + a[ CONFIG_ACCOUNT_REGISTRATION_STATE_DESC ] = registrationStateDetailed_.second; + +#ifdef SFL_PRESENCE + if (presence_) { + a[CONFIG_PRESENCE_STATUS] = presence_ and presence_->isOnline()? TRUE_STR : FALSE_STR; + a[CONFIG_PRESENCE_NOTE] = presence_ ? presence_->getNote() : " "; + } +#endif + +#if HAVE_TLS + //TODO +#endif return a; } @@ -1004,6 +1019,7 @@ SIPAccount::onRegister(pjsip_regc_cbparam *param) std::string state(description->ptr, description->slen); Manager::instance().getClient()->getConfigurationManager()->sipRegistrationStateChanged(getAccountID(), state, param->code); + Manager::instance().getClient()->getConfigurationManager()->volatileAccountDetailsChanged(getAccountID()); std::pair<int, std::string> details(param->code, state); // TODO: there id a race condition for this ressource when closing the application setRegistrationStateDetailed(details);