From 3ec5795af8db19e953660b8b84278fd8dccd784b Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Tue, 6 Jul 2010 12:53:19 -0400 Subject: [PATCH] [#3648] Fix stun initialization --- sflphone-common/sequence2.yml | 30 +++++++++++++++----------- sflphone-common/src/managerimpl.cpp | 3 ++- sflphone-common/src/sip/sipaccount.cpp | 8 ++++++- sflphone-common/src/sip/sipaccount.h | 4 ++++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/sflphone-common/sequence2.yml b/sflphone-common/sequence2.yml index d8d04011dc..d60851089d 100755 --- a/sflphone-common/sequence2.yml +++ b/sflphone-common/sequence2.yml @@ -1,6 +1,6 @@ accounts: - id: IP2IP - alias: ip2ip + alias: username: password: hostname: @@ -10,11 +10,13 @@ accounts: interface: default port: 5060 mailbox: - publishAddr: 127.0.0.1 + publishAddr: 0.0.0.0 publishPort: 5060 sameasLocal: true resolveOnce: false codecs: 0/9/110/111/112/ + stunServer: stun.sflphone.org + stunEnabled: false credential: count: 0 srtp: @@ -41,7 +43,7 @@ accounts: verifyClient: false verifyServer: false - - id: Account:1278342101 + - id: Account:1278432417 alias: sfl-181 username: 181 password: sfl-181pw @@ -57,12 +59,14 @@ accounts: sameasLocal: true resolveOnce: false codecs: 0/9/110/111/112/ + stunServer: stun.sflphone.org + stunEnabled: false credential: count: 0 srtp: - enable: true + enable: false keyExchange: sdes - rtpFallback: true + rtpFallback: false zrtp: displaySas: false displaySasOnce: false @@ -73,7 +77,7 @@ accounts: certificate: /home/msavard/Development/sflphone/sflphone-client-gnome/config.guess calist: /home/msavard/Development/sflphone/sflphone-client-gnome/aclocal.m4 ciphers: - enable: true + enable: false method: TLSv1 timeout: 0 password: @@ -83,28 +87,30 @@ accounts: verifyClient: true verifyServer: true - - id: Account:1278343345 + - id: Account:1278432440 alias: sfl-431 username: 431 password: alexandre hostname: 192.168.50.3 - enable: false + enable: true type: SIP expire: 3600 - interface: lo + interface: default port: 5060 mailbox: 97 - publishAddr: 192.168.50.182 + publishAddr: 0.0.0.0 publishPort: 5060 sameasLocal: true resolveOnce: false codecs: 0/9/110/111/112/ + stunServer: stun.sflphone.org + stunEnabled: false credential: count: 0 srtp: - enable: true + enable: false keyExchange: sdes - rtpFallback: true + rtpFallback: false zrtp: displaySas: false displaySasOnce: false diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index f3a5e6ed63..a138658c99 100755 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3410,6 +3410,7 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails ( a.insert(std::pair<std::string, std::string>(LOCAL_INTERFACE, sipaccount->getLocalInterface())); a.insert(std::pair<std::string, std::string>(PUBLISHED_SAMEAS_LOCAL, sipaccount->getPublishedSameasLocal() ? "true" : "false")); a.insert(std::pair<std::string, std::string>(PUBLISHED_ADDRESS, sipaccount->getPublishedAddress())); + std::stringstream localport; localport << sipaccount->getLocalPort(); a.insert(std::pair<std::string, std::string>(LOCAL_PORT, localport.str())); @@ -3428,7 +3429,7 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails ( a.insert(std::pair<std::string, std::string>(ZRTP_DISPLAY_SAS_ONCE, sipaccount->getZrtpDiaplaySasOnce() ? "true" : "false")); a.insert(std::pair<std::string, std::string>(ZRTP_HELLO_HASH, sipaccount->getZrtpHelloHash() ? "true" : "false")); a.insert(std::pair<std::string, std::string>(ZRTP_NOT_SUPP_WARNING, sipaccount->getZrtpNotSuppWarning() ? "true" : "false")); - + // TLS listener is unique and parameters are modified through IP2IP_PROFILE std::stringstream tlslistenerport; tlslistenerport << sipaccount->getTlsListenerPort(); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 10b33c10e3..e0e0a9d604 100755 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -190,6 +190,12 @@ void SIPAccount::unserialize(Conf::MappingNode *map) // _dtmfType = atoi(val->getValue(); // stun enabled + val = (Conf::ScalarNode *)(map->getValue(stunEnabledKey)); + if(val) { _stunEnabled = (val->getValue().compare("true") == 0) ? true : false; val = NULL; } + val = (Conf::ScalarNode *)(map->getValue(stunServerKey)); + if(val) { _stunServer = val->getValue(); val = NULL; } + _stunServerName = pj_str ( (char*) _stunServer.data()); + credMap = (Conf::MappingNode *)(map->getValue(credKey)); credentials.unserialize(credMap); @@ -495,7 +501,7 @@ void SIPAccount::initStunConfiguration (void) size_t pos; std::string stunServer, serverName, serverPort; - stunServer = Manager::instance().getConfigString (_accountID, STUN_SERVER); + stunServer = _stunServer; // Manager::instance().getConfigString (_accountID, STUN_SERVER); // Init STUN socket pos = stunServer.find (':'); diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h index 1db6cebfa9..0e61719e5a 100755 --- a/sflphone-common/src/sip/sipaccount.h +++ b/sflphone-common/src/sip/sipaccount.h @@ -90,6 +90,9 @@ const Conf::Key serverKey("server"); const Conf::Key verifyClientKey("verifyClient"); const Conf::Key verifyServerKey("verifyServer"); +const Conf::Key stunEnabledKey("stunEnabled"); +const Conf::Key stunServerKey("stunServer"); + const Conf::Key credKey("credential"); const Conf::Key credentialCountKey("count"); @@ -293,6 +296,7 @@ class SIPAccount : public Account * account is set to OTHER. */ inline bool isStunEnabled(void) { return (_transportType == PJSIP_TRANSPORT_START_OTHER) ? true: false; } + inline void setStunEnabled(bool enabl) { _stunEnabled = enabl; } /* * @return pj_str_t "From" uri based on account information. -- GitLab