diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 580d6bba5eb1592e47f8b4605ec8a02a6a422fd3..ee60a55fa02fd0253eb74fe20c34d28599357cf6 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 d33a0bbf1043e72ba98262643864ef6189f2e04e..16d76a107d30ca0fb401b25ab29c1800bac162cd 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