Commit a6e83f1e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3170] Add domainname in configuration for sip account

parent d60ca089
......@@ -1334,6 +1334,12 @@ void show_account_window (account_t * a) {
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_USERNAME),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryUsername))));
if(strcmp(proto, "SIP") == 0) {
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_DOMAIN),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryDomainName))));
}
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_PASSWORD),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryPassword))));
......@@ -1350,8 +1356,9 @@ void show_account_window (account_t * a) {
if (g_strcasecmp (currentAccount->accountID, IP2IP) != 0) {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_USERAGENT),
g_strdup(gtk_entry_get_text (GTK_ENTRY(entryUseragent))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_USERAGENT),
g_strdup(gtk_entry_get_text (GTK_ENTRY(entryUseragent))));
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED),
g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useStunCheckBox)) ? "true":"false"));
......
......@@ -62,10 +62,10 @@
#define ACCOUNT_REGISTRATION_EXPIRE "Account.expire"
#define ACCOUNT_SIP_STUN_SERVER "STUN.server"
#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable"
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
#define ACCOUNT_HOSTNAME "hostname"
#define ACCOUNT_USERNAME "username"
#define ACCOUNT_DOMAIN "domainame"
#define ACCOUNT_DOMAIN "domainname"
#define ACCOUNT_PASSWORD "password"
#define ACCOUNT_AUTHENTICATION_USERNAME "authenticationUsername"
#define ACCOUNT_REALM "realm"
......
......@@ -69,6 +69,7 @@ typedef enum RegistrationState {
#define HOSTNAME "hostname"
#define USERNAME "username"
#define DOMAINNAME "domainname"
#define AUTHENTICATION_USERNAME "authenticationUsername"
#define PASSWORD "password"
#define REALM "realm"
......
......@@ -3148,6 +3148,8 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails (
accountID, HOSTNAME)));
a.insert(std::pair<std::string, std::string>(USERNAME, getConfigString(
accountID, USERNAME)));
a.insert(std::pair<std::string, std::string>(DOMAINNAME, getConfigString(
accountID, DOMAINNAME)));
a.insert(std::pair<std::string, std::string>(PASSWORD, getConfigString(
accountID, PASSWORD)));
a.insert(std::pair<std::string, std::string>(REALM, getConfigString(
......@@ -3391,6 +3393,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
map_cpy = details;
std::string username;
std::string domain;
std::string authenticationName;
std::string password;
std::string realm;
......@@ -3405,6 +3408,14 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
username = iter->second;
}
if ((iter = map_cpy.find(DOMAINNAME)) != map_cpy.end()) {
domain = iter->second;
_error("DOMAINNAME is %s", domain.c_str());
}
else {
_error("DOMAINNAME is empty");
}
if ((iter = map_cpy.find(PASSWORD)) != map_cpy.end()) {
password = iter->second;
}
......@@ -3420,6 +3431,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
setConfig(accountID, REALM, realm);
setConfig(accountID, USERAGENT, ua_name);
setConfig(accountID, USERNAME, username);
setConfig(accountID, DOMAINNAME, domain);
setConfig(accountID, AUTHENTICATION_USERNAME, authenticationName);
if (!getMd5CredentialHashing()) {
......
......@@ -26,6 +26,7 @@
SIPAccount::SIPAccount (const AccountID& accountID)
: Account (accountID, "sip")
, _domainName("")
, _regc (NULL)
, _bRegister (false)
, _registrationExpire ("")
......@@ -33,7 +34,7 @@ SIPAccount::SIPAccount (const AccountID& accountID)
, _publishedIpAddress ("")
, _localPort (atoi (DEFAULT_SIP_PORT))
, _publishedPort (atoi (DEFAULT_SIP_PORT))
, _tlsListenerPort (atoi (DEFAULT_SIP_TLS_PORT))
, _tlsListenerPort (atoi (DEFAULT_SIP_TLS_PORT))
, _transportType (PJSIP_TRANSPORT_UNSPECIFIED)
, _transport (NULL)
, _resolveOnce (false)
......@@ -42,7 +43,7 @@ SIPAccount::SIPAccount (const AccountID& accountID)
, _realm (DEFAULT_REALM)
, _authenticationUsername ("")
, _tlsSetting (NULL)
, _dtmfType(OVERRTP)
, _dtmfType(OVERRTP)
, _displayName ("")
{
......@@ -330,6 +331,7 @@ void SIPAccount::loadConfig()
{
// Load primary credential
setUsername (Manager::instance().getConfigString (_accountID, USERNAME));
setDomainName(Manager::instance().getConfigString(_accountID, DOMAINNAME));
setPassword (Manager::instance().getConfigString (_accountID, PASSWORD));
_authenticationUsername = Manager::instance().getConfigString (_accountID, AUTHENTICATION_USERNAME);
_realm = Manager::instance().getConfigString (_accountID, REALM);
......
......@@ -63,6 +63,16 @@ class SIPAccount : public Account
*/
virtual ~SIPAccount();
/**
* Set domain to appears in sip messages for this account
*/
void setDomainName(std::string domain) { _domainName = domain; }
/**
* Get domain name to appear in sip messages for this account
*/
std::string getDomainName(void) { return _domainName; }
/**
* Special setVoIPLink which increment SipVoIPLink's number of client.
*/
......@@ -352,6 +362,8 @@ class SIPAccount : public Account
* @return std::string The login name under which SFLPhone is running.
*/
std::string getLoginName(void);
std::string _domainName;
// The pjsip client registration information
......
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