diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 297985f2ed6bbeae6bcd8406ef4626d8627bd1d6..a28461dea4f53e0c60737f017b0a9abf47eca6c7 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -32,10 +32,8 @@ SIPAccount::SIPAccount (const AccountID& accountID) , _publishedSameasLocal(true) , _localIpAddress ("") , _publishedIpAddress ("") - , _actualSessionAddress ("") , _localPort (atoi (DEFAULT_SIP_PORT)) , _publishedPort (atoi (DEFAULT_SIP_PORT)) - , _actualSessionPort (atoi (DEFAULT_SIP_PORT)) , _transportType (PJSIP_TRANSPORT_UNSPECIFIED) , _resolveOnce (false) , _credentialCount (0) diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h index 50fe17d8f1637d623cc047d7635793a9e2536847..0b304bb326afa46752317aab13f14ac5ea4fedc7 100644 --- a/sflphone-common/src/sip/sipaccount.h +++ b/sflphone-common/src/sip/sipaccount.h @@ -268,16 +268,7 @@ class SIPAccount : public Account inline void setAccountTransport (pjsip_transport *transport) { _transport = transport; } - inline std::string getSessionAddress () { return _actualSessionAddress; } - - inline void setSessionAddress (std::string addr) { _actualSessionAddress = addr; } - - inline pj_uint16_t getSessionPort () { return _actualSessionPort; } - - inline void setSessionPort (pj_uint16_t port) { _actualSessionPort = port; } - - - private: + private: /* Maps a string description of the SSL method * to the corresponding enum value in pjsip_ssl_method. @@ -328,9 +319,9 @@ class SIPAccount : public Account // Network settings std::string _registrationExpire; - // Flag which determine if _localIpAddress or _publishedIpAddress is used in + // Flag which determine if _localIpAddress or _publishedIpAddress is used in // sip headers - bool _publishedSameasLocal; + bool _publishedSameasLocal; std::string _localIpAddress; std::string _publishedIpAddress; @@ -364,12 +355,6 @@ class SIPAccount : public Account // Display Name that can be used in SIP URI. std::string _displayName; - - // The actual address we use in the SDP to be contacted - // it needs to be per account, otherwise the same address is used for every account - // TODO Use the published address or the local address - std::string _actualSessionAddress; - pj_uint16_t _actualSessionPort; }; #endif diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index bedcb5b6fe2506e2abeeaf2ac98a3b85b1148d6b..92a7f91f929b61bd8b6bc94a8beee970475fe4d5 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -225,8 +225,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL; SIPVoIPLink::SIPVoIPLink (const AccountID& accountID) : VoIPLink (accountID) , _nbTryListenAddr (2) // number of times to try to start SIP listener - , _localExternAddress ("") - , _localExternPort (0) , _regPort (atoi (DEFAULT_SIP_PORT)) , _clients (0) { @@ -1055,8 +1053,6 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to) */ pjsip_evsub_set_mod_data (sub, getModId(), this); - _debug ("SIP port listener = %i", _localExternPort); - /* * Create REFER request. */ @@ -1698,9 +1694,6 @@ bool SIPVoIPLink::pjsip_init() return false; } - port = _regPort; - // _localPort = port; - // Retrieve Direct IP Calls settings. // This corresponds to the accountID set to // AccountNULL @@ -1710,13 +1703,12 @@ bool SIPVoIPLink::pjsip_init() if (account == NULL) { _debug ("Account is null in pjsip init\n"); + port = _regPort; } else { directIpCallsTlsEnabled = account->isTlsEnabled(); + port = account->getLocalPort (); } - //_localExternAddress = _localIPAddress; - - //_localExternPort = _localPort; // Create a UDP listener meant for all accounts // for which TLS was not enabled errPjsip = createUDPServer(); @@ -1724,21 +1716,20 @@ bool SIPVoIPLink::pjsip_init() // If the above UDP server // could not be created, then give it another try // on a random sip port - if (errPjsip != PJ_SUCCESS) { - _debug ("UserAgent: Could not initialize SIP listener on port %d\n", _localExternPort); - _localExternPort = _localPort = RANDOM_SIP_PORT; + _debug ("UserAgent: Could not initialize SIP listener on port %d\n", port); + port = RANDOM_SIP_PORT; - _debug ("UserAgent: Try to initialize SIP listener on port %d\n", _localExternPort); + _debug ("UserAgent: Trying to initialize SIP listener on port %d\n", port); errPjsip = createUDPServer(); if (errPjsip != PJ_SUCCESS) { - _debug ("UserAgent: Fail to initialize SIP listener on port %d\n", _localExternPort); + _debug ("UserAgent: Fail to initialize SIP listener on port %d\n", port); return errPjsip; } } - _debug ("UserAgent: SIP Init -- listening on port %d\n", _localExternPort); + _debug ("pjsip_init -- listening on port %d\n", port); // Create a TLS listener meant for Direct IP calls // if the user did enabled it. @@ -1930,7 +1921,6 @@ int SIPVoIPLink::createUDPServer (AccountID id) // We are trying to initialize a UDP transport available for all local accounts and direct IP calls if (account->getLocalAddress () != "0.0.0.0"){ listeningAddress = account->getLocalAddress (); - _debug ("**************************************** lsitening -%s-\n", listeningAddress.data()); } listeningPort = account->getLocalPort (); } @@ -3650,9 +3640,7 @@ bool setCallAudioLocal (SIPCall* call, std::string localIP) if (account->isStunEnabled ()) { // If use Stun server - //if (Manager::instance().isBehindNat (std::string (account->getStunServerName ().ptr), callLocalAudioPort)) { - callLocalExternAudioPort = account->getStunPort ();//localExternPort; //Manager::instance().getFirewallPort(); - //} + callLocalExternAudioPort = account->getStunPort (); } _debug (" Setting local ip address: %s\n", localIP.c_str()); diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h index f29bf679e080ed6e49986c7c008120c830aeaa9e..87729d84a5d3b65bf167e2333e860fab774032ed 100644 --- a/sflphone-common/src/sip/sipvoiplink.h +++ b/sflphone-common/src/sip/sipvoiplink.h @@ -366,14 +366,6 @@ class SIPVoIPLink : public VoIPLink pj_status_t createAlternateUdpTransport (AccountID id); - std::string getLocalIP() {return _localExternAddress;} - - /** Local Extern Address is the IP address seen by peers for SIP listener */ - std::string _localExternAddress; - - /** Local Extern Port is the port seen by peers for SIP listener */ - unsigned int _localExternPort; - /** For registration use only */ int _regPort;