diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index f3b8aa024b4e0928c23239c98f906a9bad1b1d99..764ca6a06abce5ea6580c356950a7f43e3e30440 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -810,9 +810,7 @@ GtkWidget * create_advanced_tab(account_t **a) local_interface = g_hash_table_lookup(currentAccount->properties, LOCAL_INTERFACE); - local_port = g_hash_table_lookup(currentAccount->properties, LOCAL_PORT); - local_address = g_hash_table_lookup(currentAccount->properties, LOCAL_ADDRESS); if (g_strcasecmp(published_sameas_local,"true") == 0) { @@ -1170,10 +1168,7 @@ show_account_window (account_t * a) g_hash_table_replace(currentAccount->properties, g_strdup(LOCAL_PORT), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox)))); - - g_hash_table_replace(currentAccount->properties, - g_strdup(LOCAL_ADDRESS), - g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo)))); + if(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton))) { diff --git a/sflphone-client-gnome/src/config/assistant.c b/sflphone-client-gnome/src/config/assistant.c index c3be338bced5e9a7771b67165d8c240b44089019..0319d1bd5e0e7e0bbec6120192546366aa45b4e8 100644 --- a/sflphone-client-gnome/src/config/assistant.c +++ b/sflphone-client-gnome/src/config/assistant.c @@ -164,7 +164,8 @@ static void sip_apply_callback( void ) { iface = iface_list; DEBUG("Selected interface %s", *iface); - g_hash_table_insert(current->properties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)*iface)); + g_hash_table_insert(current->properties, g_strdup(LOCAL_INTERFACE), g_strdup((gchar *)*iface)); + g_hash_table_insert(current->properties, g_strdup(PUBLISHED_ADDRESS), g_strdup((gchar *)*iface)); dbus_add_account( current ); diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index 13257f4c913f86ed62c56ec570b58e5963a0fba1..d83e711183961c79f3d71b7fafa35c25dc51b120 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -58,22 +58,6 @@ static gboolean history_enabled = TRUE; GHashTable * directIpCallsProperties = NULL; - - -static void update_ip_address_port_cb ( GtkSpinButton *button UNUSED, void *ptr ) -{ - // dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr))); - gchar* local_address = g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))); - gchar* local_port = g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox))); - - gchar* ip_interface = g_strconcat(local_address, ":", local_port, NULL); - - DEBUG("update_ip_address_port_cb %s\n", ip_interface); - - dbus_set_sip_address(ip_interface); -} - - static void set_md5_hash_cb(GtkWidget *widget UNUSED, gpointer data UNUSED) { @@ -209,10 +193,8 @@ GtkWidget* create_direct_ip_calls_tab() if(directIpCallsProperties != NULL) { DEBUG("got a directIpCallsProperties"); local_interface = g_hash_table_lookup(directIpCallsProperties, LOCAL_INTERFACE); - local_address = g_hash_table_lookup(directIpCallsProperties, LOCAL_ADDRESS); local_port = g_hash_table_lookup(directIpCallsProperties, LOCAL_PORT); DEBUG(" local interface = %s", local_interface); - DEBUG(" local address = %s", local_address); DEBUG(" local port = %s", local_port); curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED); DEBUG(" curSRTPEnabled = %s", curSRTPEnabled); @@ -315,7 +297,7 @@ GtkWidget* create_direct_ip_calls_tab() GtkWidget *applyModificationButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); - g_signal_connect( G_OBJECT(applyModificationButton) , "clicked" , G_CALLBACK( update_ip_address_port_cb ), localPortSpinBox); + // g_signal_connect( G_OBJECT(applyModificationButton) , "clicked" , G_CALLBACK( update_ip_address_port_cb ), localPortSpinBox); gtk_table_attach( GTK_TABLE(table), applyModificationButton, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index 3957e196939f0c9499c5ac19393c048397809052..018917eaa4db5f890284d00d99d93be1b6871747 100644 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -290,13 +290,6 @@ <method name="switchPopupMode"> </method> - <method name="setSipAddress"> - <arg type="s" name="address" direction="in"/> - </method> - - <method name="getSipAddress"> - <arg type="i" name="address" direction="out"/> - </method> <!-- Addressbook configuration --> <method name="getAddressbookSettings"> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index c4aa52b7dcf53580d519b28a13b35b1e700d18e0..7d4fb6f4e767ef415441d039c2eefe4ffd16b5bb 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -2056,6 +2056,7 @@ dbus_get_audio_manager( void ) return api; } +/* void dbus_set_sip_address( const gchar* address ) { @@ -2069,6 +2070,9 @@ dbus_set_sip_address( const gchar* address ) g_error_free(error); } } +*/ + + /* gint dbus_get_sip_address( void ) @@ -2085,6 +2089,7 @@ dbus_get_sip_address( void ) } return address; } + */ GHashTable* dbus_get_addressbook_settings (void) { diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index 485e755dc0148fcce6a9066b698c83cb09f85031..d8e7870b9efa49f0ee12d2a4b77e181a634851b9 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -91,7 +91,6 @@ #define LOCAL_INTERFACE "Account.localInterface" #define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" #define LOCAL_PORT "Account.localPort" -#define LOCAL_ADDRESS "Account.localAddress" #define PUBLISHED_PORT "Account.publishedPort" #define PUBLISHED_ADDRESS "Account.publishedAddress" diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 22dc6341b7c73ca5898111493ab124886bff3402..2edddfe9bfeda5fc6599b624d5ecca8bcd2bbddc 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -73,7 +73,6 @@ typedef enum RegistrationState { #define LOCAL_INTERFACE "Account.localInterface" #define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" #define LOCAL_PORT "Account.localPort" -#define LOCAL_ADDRESS "Account.localAddress" #define PUBLISHED_PORT "Account.publishedPort" #define PUBLISHED_ADDRESS "Account.publishedAddress" diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 3957e196939f0c9499c5ac19393c048397809052..018917eaa4db5f890284d00d99d93be1b6871747 100644 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -290,13 +290,6 @@ <method name="switchPopupMode"> </method> - <method name="setSipAddress"> - <arg type="s" name="address" direction="in"/> - </method> - - <method name="getSipAddress"> - <arg type="i" name="address" direction="out"/> - </method> <!-- Addressbook configuration --> <method name="getAddressbookSettings"> diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index b17aa8b873e1e7c97e7c408950615afd0966cc09..82f7b6dda2262969406a1ea1dd7b532f919842a1 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -78,7 +78,6 @@ ConfigurationManager::getIp2IpDetails (void) ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, Manager::instance().getConfigString(IP2IP_PROFILE, LOCAL_INTERFACE))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_ADDRESS, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_PORT, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_PORT))); std::map<std::string, std::string> tlsSettings; @@ -101,12 +100,6 @@ ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_INTERFACE, it->second); } - it = map_cpy.find (LOCAL_ADDRESS); - - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, it->second); - } - it = map_cpy.find (LOCAL_PORT); if (it != details.end()) { @@ -722,21 +715,6 @@ ConfigurationManager::getMailNotify (void) } -int -ConfigurationManager::getSipAddress (void) -{ - return Manager::instance().getLocalIp2IpPort(); - - // return "ok"; -} - -void -ConfigurationManager::setSipAddress (const std::string& address) -{ - _debug ("Manager received setSipAddress: %s", address.c_str()); - Manager::instance().setLocalIp2IpInfo (address); -} - std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings (void) { return Manager::instance().getAddressbookSettings (); diff --git a/sflphone-common/src/dbus/configurationmanager.h b/sflphone-common/src/dbus/configurationmanager.h index 92e2dbed7a4715cd55cd786306a733253fb2e26c..61072e16b5bb9153dce4761b143211b4733ac637 100644 --- a/sflphone-common/src/dbus/configurationmanager.h +++ b/sflphone-common/src/dbus/configurationmanager.h @@ -114,9 +114,6 @@ public: int32_t getMailNotify( void ); void setMailNotify( void ); - int getSipAddress( void ); - void setSipAddress( const std::string& address ); - std::map<std::string, int32_t> getAddressbookSettings (void); void setAddressbookSettings (const std::map<std::string, int32_t>& settings); std::vector< std::string > getAddressbookList ( void ); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index d4cd94ab24dd5343b34301e96332acdc1ef13116..f8d3d551ba6ca0f9589a012fc7605448a73ba5d6 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2270,7 +2270,6 @@ ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) _config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, TRUE_STR), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (LOCAL_PORT, DEFAULT_SIP_PORT), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_PORT, DEFAULT_SIP_PORT), IP2IP_PROFILE); - _config.addDefaultValue (std::pair<std::string, std::string> (LOCAL_ADDRESS, DEFAULT_ADDRESS), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, DEFAULT_ADDRESS), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (STUN_ENABLE, DFT_STUN_ENABLE), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (STUN_SERVER, DFT_STUN_SERVER), IP2IP_PROFILE); @@ -3235,49 +3234,10 @@ void ManagerImpl::setMicVolume (unsigned short mic_vol) - - -void ManagerImpl::setLocalIp2IpInfo (const std::string& address) -{ - std::string ip_address = std::string (address); - - int index = ip_address.find_first_of (":"); - - std::string local_address = ip_address.substr (0,index); - std::string local_port = ip_address.substr (index+1); - int newPort = atoi (local_port.c_str()); - - _debug ("Setting new address %s and port %s for default account (ip to ip calls)", local_address.c_str(), local_port.c_str()); - - int prevPort = getConfigInt (IP2IP_PROFILE, LOCAL_PORT); - std::string prevAddress = getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS); - - if ( (prevPort != newPort) || (prevAddress.compare (local_address) != 0)) { - - - if (_directIpAccount) { - - SIPAccount* account = dynamic_cast<SIPAccount*> (_directIpAccount); - - account->setLocalPort (newPort); - account->setLocalAddress (local_address); - } - - setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, local_address); - - setConfig (IP2IP_PROFILE, LOCAL_PORT, newPort); - - SIPVoIPLink* siplink = SIPVoIPLink::instance (""); - // if(siplink) - siplink->updateAccountInfo (_directIpAccount->getAccountID()); - // this->restartPJSIP (); - } -} - - + int ManagerImpl::getLocalIp2IpPort (void) { - /* The SIP port used for default account (IP to IP) calls */ + // The SIP port used for default account (IP to IP) calls _debug ("Default account port %i", getConfigInt (IP2IP_PROFILE, LOCAL_PORT)); return getConfigInt (IP2IP_PROFILE, LOCAL_PORT); @@ -3538,7 +3498,6 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getConfigString (accountID, CONFIG_ACCOUNT_REGISTRATION_EXPIRE))); a.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, getConfigString (accountID, LOCAL_INTERFACE))); a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getConfigString (accountID, PUBLISHED_SAMEAS_LOCAL))); - a.insert (std::pair<std::string, std::string> (LOCAL_ADDRESS, getConfigString (accountID, LOCAL_ADDRESS))); a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getConfigString (accountID, PUBLISHED_ADDRESS))); a.insert (std::pair<std::string, std::string> (LOCAL_PORT, getConfigString (accountID, LOCAL_PORT))); a.insert (std::pair<std::string, std::string> (PUBLISHED_PORT, getConfigString (accountID, PUBLISHED_PORT))); @@ -3816,10 +3775,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma publishedSameasLocal = iter->second; } - if ( (iter = map_cpy.find (LOCAL_ADDRESS)) != map_cpy.end()) { - localAddress = iter->second; - } - if ( (iter = map_cpy.find (PUBLISHED_ADDRESS)) != map_cpy.end()) { publishedAddress = iter->second; } @@ -3944,7 +3899,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma setConfig (accountID, LOCAL_INTERFACE, localInterface); setConfig (accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal); - setConfig (accountID, LOCAL_ADDRESS, localAddress); setConfig (accountID, PUBLISHED_ADDRESS, publishedAddress); setConfig (accountID, LOCAL_PORT, localPort); setConfig (accountID, PUBLISHED_PORT, publishedPort); diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index fe2ce8618d3d80580120e26f47d429929d74a69c..ca88a42939c7c8fd36d316f4dad4eaa36deafed4 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -1319,8 +1319,6 @@ class ManagerImpl { int getLocalIp2IpPort(); - void setLocalIp2IpInfo( const std::string& address ); - std::string getStunServer (void); void setStunServer (const std::string &server); diff --git a/sflphone-common/src/managerimpl_registration.cpp b/sflphone-common/src/managerimpl_registration.cpp index 004faf8f2eeb68f97a55f262f089fe36eb9bf298..241a8b4078db80e6450d79f8f6e68f43b4738ba6 100644 --- a/sflphone-common/src/managerimpl_registration.cpp +++ b/sflphone-common/src/managerimpl_registration.cpp @@ -95,11 +95,8 @@ ManagerImpl::initRegisterAccounts() while (iter != _accountMap.end()) { if (iter->second) { iter->second->loadConfig(); - /* If the account is set as enabled, try to register */ - - // TODO: take off this protection by storing localIPAddress using interface name - setConfig (iter->second->getAccountID(), LOCAL_ADDRESS, "0.0.0.0"); + /* If the account is set as enabled, try to register */ if (iter->second->isEnabled()) { status = iter->second->registerVoIPLink(); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 60085f54afaabd1d57dd11f725dbd0f5c0deadfc..29e1ace7999a4dd17639ae33118b30563c0ef960 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -30,7 +30,6 @@ SIPAccount::SIPAccount (const AccountID& accountID) , _bRegister (false) , _registrationExpire ("") , _publishedSameasLocal (true) - , _localIpAddress ("") , _publishedIpAddress ("") , _localPort (atoi (DEFAULT_SIP_PORT)) , _publishedPort (atoi (DEFAULT_SIP_PORT)) @@ -348,12 +347,6 @@ void SIPAccount::loadConfig() std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT); setLocalPort (atoi (localPort.c_str())); - // Do not store or use IP address in config as this address may change - // Use loadSIPLocalIP for now instead in register/unregister (UDP,STUN,TLS), newOutGoingCall, mod_on_rx_request - // TODO: if we realy have to bind to a specific interface, store interfaces by name instead - // setLocalAddress (std::string("0.0.0.0")); - setLocalAddress (Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS)); - // Published parameters setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); @@ -422,25 +415,7 @@ std::string SIPAccount::getLoginName (void) std::string SIPAccount::getTransportMapKey(void) { - /* - std::string mapKey; - - std::stringstream out; - - out << getLocalPort(); - std::string localAddress = getLocalAddress(); - std::string localPort = out.str(); - - out.seekp (0); - out << getPublishedPort(); - std::string publishedAddress = getPublishedAddress(); - std::string publishedPort = out.str(); - - mapKey.append(localAddress.c_str()); - mapKey.append(localPort.c_str()); - mapKey.append(publishedAddress.c_str()); - mapKey.append(publishedPort.c_str()); - */ + std::stringstream out; out << getLocalPort(); std::string localPort = out.str(); diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h index 855fbe39e4872c539ed30c49b3156730645c6500..ae454a533353680c23a169cc8d0945f523a7efc2 100644 --- a/sflphone-common/src/sip/sipaccount.h +++ b/sflphone-common/src/sip/sipaccount.h @@ -248,19 +248,6 @@ class SIPAccount : public Account * @pram port The port used by this account. */ inline void setPublishedPort(pj_uint16_t port) { _publishedPort = port; } - - /** - * Get the bound address set by the user. - * @return std::string The public IPV4 address formatted in the standard dot notation. - */ - inline std::string getLocalAddress(void) { return _localIpAddress; } - - /** - * Set the bound address chosen by the user. - * @param The public IPV4 address in the standard dot notation. - * @return void - */ - inline void setLocalAddress(const std::string& address) { _localIpAddress = address; } /** * Get the public IP address set by the user for this account. @@ -346,7 +333,6 @@ class SIPAccount : public Account // sip headers bool _publishedSameasLocal; - std::string _localIpAddress; std::string _publishedIpAddress; pj_uint16_t _localPort; diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 51b6beb62c710d050fbb359382b65893cb0022aa..3064cbf01382137a0afdff331f36035b6fef71d8 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -2097,7 +2097,7 @@ bool SIPVoIPLink::acquireTransport(const AccountID& accountID) { _debug("Use default one instead (%s:%i)", localHostName.c_str(), _localUDPTransport->local_name.port); - account->setLocalAddress(localHostName); + // account->setLocalAddress(localHostName); account->setLocalPort(_localUDPTransport->local_name.port); // Transport could not either be created or found in the map, socket not available