diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 295ba4aa7924c6282895ab00327eaaa440490ff2..5fd5ea1b914f80d44a4f876e1fddc3228063be72 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -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")); diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index 0f081fbad59e94ccb50924a1e683a21d3b470eb1..bd7f94327c98b20c71502b4524e6c7e6f133772d 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -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" diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 3272010a2e9f8d924ae09a817cc7f40a03f51cfe..5b424a3c06d7e25659f1c5751efd43c1e5fadc59 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -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" diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 89441cf5e003d7830ca27cf15a5235766dd0a175..1ca9d7609a0ee9d4576565d9fc8b2fecdd71d08d 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -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()) { diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index e50ac19058458dedb75a671bb9894f35e697df69..4dfa02783f5f89784f82140ac13be5b4ab923711 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -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); diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h index 57fd602c6277d33ffbe176700350da3a3e763974..8337b33c80a987550b29482693e519b32fd3893b 100644 --- a/sflphone-common/src/sip/sipaccount.h +++ b/sflphone-common/src/sip/sipaccount.h @@ -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