Skip to content
Snippets Groups Projects
Commit 4cf7f73b authored by Rafaël Carré's avatar Rafaël Carré
Browse files

SIPAccount::getAccountDetails : simplify

parent 35edf391
No related branches found
No related tags found
No related merge requests found
...@@ -467,29 +467,24 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const ...@@ -467,29 +467,24 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
{ {
std::map<std::string, std::string> a; std::map<std::string, std::string> a;
a.insert (std::pair<std::string, std::string> (ACCOUNT_ID, _accountID)); a[ACCOUNT_ID] = _accountID;
// The IP profile does not allow to set an alias // The IP profile does not allow to set an alias
(_accountID == IP2IP_PROFILE) ? a[CONFIG_ACCOUNT_ALIAS] = (_accountID == IP2IP_PROFILE) ? IP2IP_PROFILE : getAlias();
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, IP2IP_PROFILE)) :
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getAlias()));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ENABLE, isEnabled() ? "true" : "false")); a[CONFIG_ACCOUNT_ENABLE] = isEnabled() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_TYPE, getType())); a[CONFIG_ACCOUNT_TYPE] = getType();
a.insert (std::pair<std::string, std::string> (HOSTNAME, getHostname())); a[HOSTNAME] = getHostname();
a.insert (std::pair<std::string, std::string> (USERNAME, getUsername())); a[USERNAME] = getUsername();
a.insert (std::pair<std::string, std::string> (PASSWORD, getPassword())); a[PASSWORD] = getPassword();
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_PATH, getRingtonePath()));
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_ENABLED, getRingtoneEnabled() ? "true" : "false"));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox()));
a[CONFIG_RINGTONE_PATH] = getRingtonePath();
a[CONFIG_RINGTONE_ENABLED] = getRingtoneEnabled() ? "true" : "false";
a[CONFIG_ACCOUNT_MAILBOX] = getMailBox();
RegistrationState state = Unregistered; RegistrationState state = Unregistered;
std::string registrationStateCode; std::string registrationStateCode;
std::string registrationStateDescription; std::string registrationStateDescription;
if (_accountID == IP2IP_PROFILE) { if (_accountID == IP2IP_PROFILE) {
registrationStateCode = ""; // emtpy field registrationStateCode = ""; // emtpy field
registrationStateDescription = "Direct IP call"; registrationStateDescription = "Direct IP call";
...@@ -502,61 +497,57 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const ...@@ -502,61 +497,57 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
registrationStateDescription = getRegistrationStateDetailed().second; registrationStateDescription = getRegistrationStateDetailed().second;
} }
a[REGISTRATION_STATUS] = (_accountID == IP2IP_PROFILE) ? "READY": Manager::instance().mapStateNumberToString (state);
(_accountID == IP2IP_PROFILE) ? a[REGISTRATION_STATE_CODE] = registrationStateCode;
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, "READY")) : a[REGISTRATION_STATE_DESCRIPTION] = registrationStateDescription;
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, Manager::instance().mapStateNumberToString (state)));
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_CODE, registrationStateCode));
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_DESCRIPTION, registrationStateDescription));
// Add sip specific details // Add sip specific details
a.insert (std::pair<std::string, std::string> (ROUTESET, getServiceRoute())); a[ROUTESET] = getServiceRoute();
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_RESOLVE_ONCE, isResolveOnce() ? "true" : "false")); a[CONFIG_ACCOUNT_RESOLVE_ONCE] = isResolveOnce() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (REALM, _realm)); a[REALM] = _realm;
a.insert (std::pair<std::string, std::string> (USERAGENT, getUseragent())); a[USERAGENT] = getUseragent();
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getRegistrationExpire())); a[CONFIG_ACCOUNT_REGISTRATION_EXPIRE] = getRegistrationExpire();
a.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, getLocalInterface())); a[LOCAL_INTERFACE] = getLocalInterface();
a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getPublishedSameasLocal() ? "true" : "false")); a[PUBLISHED_SAMEAS_LOCAL] = getPublishedSameasLocal() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getPublishedAddress())); a[PUBLISHED_ADDRESS] = getPublishedAddress();
std::stringstream localport; std::stringstream localport;
localport << getLocalPort(); localport << getLocalPort();
a.insert (std::pair<std::string, std::string> (LOCAL_PORT, localport.str())); a[LOCAL_PORT] = localport.str();
std::stringstream publishedport; std::stringstream publishedport;
publishedport << getPublishedPort(); publishedport << getPublishedPort();
a.insert (std::pair<std::string, std::string> (PUBLISHED_PORT, publishedport.str())); a[PUBLISHED_PORT] = publishedport.str();
a.insert (std::pair<std::string, std::string> (STUN_ENABLE, isStunEnabled() ? "true" : "false")); a[STUN_ENABLE] = isStunEnabled() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (STUN_SERVER, getStunServer())); a[STUN_SERVER] = getStunServer();
a.insert (std::pair<std::string, std::string> (ACCOUNT_DTMF_TYPE, (getDtmfType() == OVERRTP) ? "overrtp" : "sipinfo")); a[ACCOUNT_DTMF_TYPE] = (getDtmfType() == OVERRTP) ? "overrtp" : "sipinfo";
a.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getSrtpKeyExchange())); a[SRTP_KEY_EXCHANGE] = getSrtpKeyExchange();
a.insert (std::pair<std::string, std::string> (SRTP_ENABLE, getSrtpEnable() ? "true" : "false")); a[SRTP_ENABLE] = getSrtpEnable() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, getSrtpFallback() ? "true" : "false")); a[SRTP_RTP_FALLBACK] = getSrtpFallback() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getZrtpDisplaySas() ? "true" : "false")); a[ZRTP_DISPLAY_SAS] = getZrtpDisplaySas() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, getZrtpDiaplaySasOnce() ? "true" : "false")); a[ZRTP_DISPLAY_SAS_ONCE] = getZrtpDiaplaySasOnce() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, getZrtpHelloHash() ? "true" : "false")); a[ZRTP_HELLO_HASH] = getZrtpHelloHash() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, getZrtpNotSuppWarning() ? "true" : "false")); a[ZRTP_NOT_SUPP_WARNING] = getZrtpNotSuppWarning() ? "true" : "false";
// TLS listener is unique and parameters are modified through IP2IP_PROFILE // TLS listener is unique and parameters are modified through IP2IP_PROFILE
std::stringstream tlslistenerport; std::stringstream tlslistenerport;
tlslistenerport << getTlsListenerPort(); tlslistenerport << getTlsListenerPort();
a.insert (std::pair<std::string, std::string> (TLS_LISTENER_PORT, tlslistenerport.str())); a[TLS_LISTENER_PORT] = tlslistenerport.str();
a.insert (std::pair<std::string, std::string> (TLS_ENABLE, getTlsEnable())); a[TLS_ENABLE] = getTlsEnable();
a.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, getTlsCaListFile())); a[TLS_CA_LIST_FILE] = getTlsCaListFile();
a.insert (std::pair<std::string, std::string> (TLS_CERTIFICATE_FILE, getTlsCertificateFile())); a[TLS_CERTIFICATE_FILE] = getTlsCertificateFile();
a.insert (std::pair<std::string, std::string> (TLS_PRIVATE_KEY_FILE, getTlsPrivateKeyFile())); a[TLS_PRIVATE_KEY_FILE] = getTlsPrivateKeyFile();
a.insert (std::pair<std::string, std::string> (TLS_PASSWORD, getTlsPassword())); a[TLS_PASSWORD] = getTlsPassword();
a.insert (std::pair<std::string, std::string> (TLS_METHOD, getTlsMethod())); a[TLS_METHOD] = getTlsMethod();
a.insert (std::pair<std::string, std::string> (TLS_CIPHERS, getTlsCiphers())); a[TLS_CIPHERS] = getTlsCiphers();
a.insert (std::pair<std::string, std::string> (TLS_SERVER_NAME, getTlsServerName())); a[TLS_SERVER_NAME] = getTlsServerName();
a.insert (std::pair<std::string, std::string> (TLS_VERIFY_SERVER, getTlsVerifyServer() ? "true" : "false")); a[TLS_VERIFY_SERVER] = getTlsVerifyServer() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (TLS_VERIFY_CLIENT, getTlsVerifyClient() ? "true" : "false")); a[TLS_VERIFY_CLIENT] = getTlsVerifyClient() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, getTlsRequireClientCertificate() ? "true" : "false")); a[TLS_REQUIRE_CLIENT_CERTIFICATE] = getTlsRequireClientCertificate() ? "true" : "false";
a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, getTlsNegotiationTimeoutSec())); a[TLS_NEGOTIATION_TIMEOUT_SEC] = getTlsNegotiationTimeoutSec();
a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, getTlsNegotiationTimeoutMsec())); a[TLS_NEGOTIATION_TIMEOUT_MSEC] = getTlsNegotiationTimeoutMsec();
return a; return a;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment