From 2e6aba2fa3c4eeb956fa3b1115d5361a6e487285 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Tue, 17 Nov 2009 14:54:57 -0500 Subject: [PATCH] [#2403] Use the published address if checked in GUI --- sflphone-common/src/sip/sipaccount.cpp | 1 + sflphone-common/src/sip/sipvoiplink.cpp | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 580d6bba5e..ee60a55fa0 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -334,6 +334,7 @@ void SIPAccount::loadConfig() setLocalAddress (Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS)); // Published parameters + setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); std::string publishedPort = Manager::instance().getConfigString (_accountID, PUBLISHED_PORT); setPublishedPort (atoi (publishedPort.c_str())); setPublishedAddress (Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS)); diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index d33a0bbf10..16d76a107d 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -1962,11 +1962,29 @@ int SIPVoIPLink::createUDPServer (AccountID id) pj_bzero (bound_addr.sin_zero, sizeof (bound_addr.sin_zero)); // Create UDP-Server (default port: 5060) - strcpy (tmpIP, listeningAddress.data()); + // Use here either the local information or the published address + if (account != NULL && !account->getPublishedSameasLocal ()) + { + + + // Set the listening address to the published address + listeningAddress = account->getPublishedAddress (); + // Set the listening port to the published port + listeningPort = account->getPublishedPort (); + + _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort ); + } + + //strcpy (tmpIP, listeningAddress.data()); + /* Init published name */ + pj_bzero (&a_name, sizeof (pjsip_host_port)); + pj_cstr (&a_name.host, listeningAddress.c_str()); + a_name.port = listeningPort; + - pj_strdup2 (_pool, &a_name.host, tmpIP); + //pj_strdup2 (_pool, &a_name.host, tmpIP); - a_name.port = (pj_uint16_t) listeningPort; + //a_name.port = (pj_uint16_t) listeningPort; status = pjsip_udp_transport_start (_endpt, &bound_addr, &a_name, 1, &transport); @@ -2417,7 +2435,6 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr) void SIPVoIPLink::busy_sleep (unsigned msec) { - _debug("SIPVoIPLink::busy_sleep\n"); #if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 /* Ideally we shouldn't call pj_thread_sleep() and rather * CActiveScheduler::WaitForAnyRequest() here, but that will -- GitLab