Commit 0f09e23b authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee Committed by Tristan Matthews

account: Split user defined and volatile account parameters getters (2/2)

Use the new volatileAccountDetailsChanged as a replacement for
sipRegistrationStateChanged.

What this commit does *NOT* do:
 * Clean outdated SIP error messages
 * Forward TLS error messages
 * Forward other transport errors
 * Compute downtime timestamp

Those features will be part of future commits.

Refs #56143

Change-Id: I336cc6826b468a96e14ef08748c6718823bd647b
parent 33dcc425
......@@ -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;
}
......
......@@ -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_
/*
* 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)
......
......@@ -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();
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment