Skip to content
Snippets Groups Projects
Commit ead4b5f6 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #6699: more account cleanup

parent b0a05007
Branches
Tags
No related merge requests found
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "global.h"
#include "config/config.h" #include "config/config.h"
#include "voiplink.h"
#include "config/serializable.h" #include "config/serializable.h"
class VoIPLink; class VoIPLink;
...@@ -49,7 +49,7 @@ class VoIPLink; ...@@ -49,7 +49,7 @@ class VoIPLink;
*/ */
/** Contains all the state an Voip can be in */ /** Contains all the state an Voip can be in */
typedef enum RegistrationState { enum RegistrationState {
Unregistered, Unregistered,
Trying, Trying,
Registered, Registered,
...@@ -60,74 +60,73 @@ typedef enum RegistrationState { ...@@ -60,74 +60,73 @@ typedef enum RegistrationState {
ErrorExistStun, ErrorExistStun,
ErrorConfStun, ErrorConfStun,
NumberOfState NumberOfState
} RegistrationState; };
// Account identifier // Account identifier
#define ACCOUNT_ID "Account.id" static const char *const ACCOUNT_ID = "Account.id";
// Common account parameters // Common account parameters
#define CONFIG_ACCOUNT_TYPE "Account.type" static const char *const CONFIG_ACCOUNT_TYPE = "Account.type";
#define CONFIG_ACCOUNT_ALIAS "Account.alias" static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
#define CONFIG_ACCOUNT_MAILBOX "Account.mailbox" static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
#define CONFIG_ACCOUNT_ENABLE "Account.enable" static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
#define CONFIG_ACCOUNT_RESOLVE_ONCE "Account.resolveOnce" static const char *const CONFIG_ACCOUNT_RESOLVE_ONCE = "Account.resolveOnce";
#define CONFIG_ACCOUNT_REGISTRATION_EXPIRE "Account.expire" static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.expire";
#define CONFIG_CREDENTIAL_NUMBER "Credential.count" static const char *const CONFIG_CREDENTIAL_NUMBER = "Credential.count";
#define ACCOUNT_DTMF_TYPE "Account.dtmfType" static const char *const ACCOUNT_DTMF_TYPE = "Account.dtmfType";
#define CONFIG_RINGTONE_PATH "Account.ringtonePath" static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath";
#define CONFIG_RINGTONE_ENABLED "Account.ringtoneEnabled" static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
#define HOSTNAME "hostname" static const char *const HOSTNAME = "hostname";
#define USERNAME "username" static const char *const USERNAME = "username";
#define ROUTESET "routeset" static const char *const ROUTESET = "routeset";
#define PASSWORD "password" static const char *const PASSWORD = "password";
#define REALM "realm" static const char *const REALM = "realm";
#define DEFAULT_REALM "*" static const char *const DEFAULT_REALM = "*";
#define USERAGENT "useragent" static const char *const USERAGENT = "useragent";
#define LOCAL_INTERFACE "Account.localInterface" static const char *const LOCAL_INTERFACE = "Account.localInterface";
#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" static const char *const PUBLISHED_SAMEAS_LOCAL = "Account.publishedSameAsLocal";
#define LOCAL_PORT "Account.localPort" static const char *const LOCAL_PORT = "Account.localPort";
#define PUBLISHED_PORT "Account.publishedPort" static const char *const PUBLISHED_PORT = "Account.publishedPort";
#define PUBLISHED_ADDRESS "Account.publishedAddress" static const char *const PUBLISHED_ADDRESS = "Account.publishedAddress";
#define DISPLAY_NAME "Account.displayName" static const char *const DISPLAY_NAME = "Account.displayName";
#define DEFAULT_ADDRESS "0.0.0.0" static const char *const DEFAULT_ADDRESS = "0.0.0.0";
// SIP specific parameters // SIP specific parameters
#define SIP_PROXY "SIP.proxy" static const char *const SIP_PROXY = "SIP.proxy";
#define STUN_SERVER "STUN.server" static const char *const STUN_SERVER = "STUN.server";
#define STUN_ENABLE "STUN.enable" static const char *const STUN_ENABLE = "STUN.enable";
// SRTP specific parameters // SRTP specific parameters
#define SRTP_ENABLE "SRTP.enable" static const char *const SRTP_ENABLE = "SRTP.enable";
#define SRTP_KEY_EXCHANGE "SRTP.keyExchange" static const char *const SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
#define SRTP_ENCRYPTION_ALGO "SRTP.encryptionAlgorithm" // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8 static const char *const SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
#define SRTP_RTP_FALLBACK "SRTP.rtpFallback" static const char *const SRTP_RTP_FALLBACK = "SRTP.rtpFallback";
#define ZRTP_HELLO_HASH "ZRTP.helloHashEnable" static const char *const ZRTP_HELLO_HASH = "ZRTP.helloHashEnable";
#define ZRTP_DISPLAY_SAS "ZRTP.displaySAS" static const char *const ZRTP_DISPLAY_SAS = "ZRTP.displaySAS";
#define ZRTP_NOT_SUPP_WARNING "ZRTP.notSuppWarning" static const char *const ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
#define ZRTP_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" static const char *const ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
#define TLS_LISTENER_PORT "TLS.listenerPort" static const char *const TLS_LISTENER_PORT = "TLS.listenerPort";
#define TLS_ENABLE "TLS.enable" static const char *const TLS_ENABLE = "TLS.enable";
#define TLS_CA_LIST_FILE "TLS.certificateListFile" static const char *const TLS_CA_LIST_FILE = "TLS.certificateListFile";
#define TLS_CERTIFICATE_FILE "TLS.certificateFile" static const char *const TLS_CERTIFICATE_FILE = "TLS.certificateFile";
#define TLS_PRIVATE_KEY_FILE "TLS.privateKeyFile" static const char *const TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
#define TLS_PASSWORD "TLS.password" static const char *const TLS_PASSWORD = "TLS.password";
#define TLS_METHOD "TLS.method" static const char *const TLS_METHOD = "TLS.method";
#define TLS_CIPHERS "TLS.ciphers" static const char *const TLS_CIPHERS = "TLS.ciphers";
#define TLS_SERVER_NAME "TLS.serverName" static const char *const TLS_SERVER_NAME = "TLS.serverName";
#define TLS_VERIFY_SERVER "TLS.verifyServer" static const char *const TLS_VERIFY_SERVER = "TLS.verifyServer";
#define TLS_VERIFY_CLIENT "TLS.verifyClient" static const char *const TLS_VERIFY_CLIENT = "TLS.verifyClient";
#define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate" static const char *const TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
#define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" static const char *const TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
#define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" static const char *const TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
#define REGISTRATION_STATUS "Status" static const char *const REGISTRATION_STATUS = "Status";
#define REGISTRATION_STATE_CODE "Registration.code" static const char *const REGISTRATION_STATE_CODE = "Registration.code";
#define REGISTRATION_STATE_DESCRIPTION "Registration.description" static const char *const REGISTRATION_STATE_DESCRIPTION = "Registration.description";
// General configuration keys for accounts // General configuration keys for accounts
static const char * const aliasKey = "alias"; static const char * const aliasKey = "alias";
...@@ -235,28 +234,6 @@ class Account : public Serializable ...@@ -235,28 +234,6 @@ class Account : public Serializable
*/ */
void setRegistrationState (const RegistrationState &state); void setRegistrationState (const RegistrationState &state);
/**
* Set the latest up-to-date state code
* for that account. These codes are
* those used in SIP and IAX (eg. 200, 500 ...)
* @param state The Code:Description state
* @return void
*/
void setRegistrationStateDetailed (std::pair<int, std::string> state) {
registrationStateDetailed_ = state;
}
/**
* Get the latest up-to-date state code
* for that account. These codes are
* those used in SIP and IAX (eg. 200, 500 ...)
* @param void
* @return std::pair<int, std::string> A Code:Description state
*/
std::pair<int, std::string> getRegistrationStateDetailed (void) const {
return registrationStateDetailed_;
}
/* They should be treated like macro definitions by the C++ compiler */ /* They should be treated like macro definitions by the C++ compiler */
std::string getUsername (void) const { std::string getUsername (void) const {
return username_; return username_;
...@@ -396,12 +373,6 @@ class Account : public Serializable ...@@ -396,12 +373,6 @@ class Account : public Serializable
*/ */
RegistrationState registrationState_; RegistrationState registrationState_;
/*
* Details about the registration state.
* This is a protocol Code:Description pair.
*/
std::pair<int, std::string> registrationStateDetailed_;
/** /**
* Vector containing the order of the codecs * Vector containing the order of the codecs
*/ */
...@@ -433,7 +404,6 @@ class Account : public Serializable ...@@ -433,7 +404,6 @@ class Account : public Serializable
*/ */
std::string userAgent_; std::string userAgent_;
/** /**
* Account mail box * Account mail box
*/ */
......
...@@ -135,19 +135,9 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() const ...@@ -135,19 +135,9 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() const
a[PASSWORD] = password_; a[PASSWORD] = password_;
a[CONFIG_ACCOUNT_MAILBOX] = mailBox_; a[CONFIG_ACCOUNT_MAILBOX] = mailBox_;
std::string registrationStateCode;
std::string registrationStateDescription;
RegistrationState state(registrationState_); RegistrationState state(registrationState_);
int code = getRegistrationStateDetailed().first;
std::stringstream out;
out << code;
registrationStateCode = out.str();
registrationStateDescription = getRegistrationStateDetailed().second;
a[REGISTRATION_STATUS] = Manager::instance().mapStateNumberToString (state); a[REGISTRATION_STATUS] = Manager::instance().mapStateNumberToString (state);
a[REGISTRATION_STATE_CODE] = registrationStateCode;
a[REGISTRATION_STATE_DESCRIPTION] = registrationStateDescription;
a[USERAGENT] = userAgent_; a[USERAGENT] = userAgent_;
return a; return a;
......
...@@ -468,15 +468,14 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const ...@@ -468,15 +468,14 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
std::string registrationStateDescription; std::string registrationStateDescription;
if (accountID_ == IP2IP_PROFILE) { if (accountID_ == IP2IP_PROFILE) {
registrationStateCode = ""; // emtpy field
registrationStateDescription = "Direct IP call"; registrationStateDescription = "Direct IP call";
} else { } else {
state = getRegistrationState(); state = getRegistrationState();
int code = getRegistrationStateDetailed().first; int code = registrationStateDetailed_.first;
std::stringstream out; std::stringstream out;
out << code; out << code;
registrationStateCode = out.str(); registrationStateCode = out.str();
registrationStateDescription = getRegistrationStateDetailed().second; registrationStateDescription = registrationStateDetailed_.second;
} }
a[REGISTRATION_STATUS] = (accountID_ == IP2IP_PROFILE) ? "READY": Manager::instance().mapStateNumberToString (state); a[REGISTRATION_STATUS] = (accountID_ == IP2IP_PROFILE) ? "READY": Manager::instance().mapStateNumberToString (state);
......
...@@ -125,6 +125,7 @@ class SIPAccount : public Account ...@@ -125,6 +125,7 @@ class SIPAccount : public Account
* Virtual destructor * Virtual destructor
*/ */
virtual ~SIPAccount(); virtual ~SIPAccount();
void setRegistrationStateDetailed (const std::pair<int, std::string> &details) { registrationStateDetailed_ = details; }
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
...@@ -755,6 +756,11 @@ class SIPAccount : public Account ...@@ -755,6 +756,11 @@ class SIPAccount : public Account
bool _zrtpDisplaySasOnce; bool _zrtpDisplaySasOnce;
bool _zrtpHelloHash; bool _zrtpHelloHash;
bool _zrtpNotSuppWarning; bool _zrtpNotSuppWarning;
/*
* Details about the registration state.
* This is a protocol Code:Description pair.
*/
std::pair<int, std::string> registrationStateDetailed_;
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment