From d0a5d89af3bd8aab91611e74c14742f70a61cacc Mon Sep 17 00:00:00 2001
From: pierre-luc <pierre-luc@aqra.ca>
Date: Fri, 17 Jul 2009 17:43:29 -0400
Subject: [PATCH] [#1866] Methods getSipPort and setSipPort now have an effect
 on the configuration file and pjsip can be set with the right value.

---
 sflphone-common/src/managerimpl.cpp | 6 +++++-
 sflphone-common/src/sipvoiplink.cpp | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 345fb7df66..0b020633f3 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -2210,11 +2210,15 @@ void ManagerImpl::setMicVolume (unsigned short mic_vol)
 
 void ManagerImpl::setSipPort (int port)
 {
+    _debug("Setting to new port %d\n", port);
+    setConfig(PREFERENCES, CONFIG_SIP_PORT, port);
+    
+    this->restartPJSIP ();
 }
 
 int ManagerImpl::getSipPort (void)
 {
-    return 5060;
+    return getConfigInt (PREFERENCES , CONFIG_SIP_PORT);
 }
 
 
diff --git a/sflphone-common/src/sipvoiplink.cpp b/sflphone-common/src/sipvoiplink.cpp
index 7d40232751..6d01264343 100644
--- a/sflphone-common/src/sipvoiplink.cpp
+++ b/sflphone-common/src/sipvoiplink.cpp
@@ -217,6 +217,8 @@ bool SIPVoIPLink::init()
     if (initDone())
         return false;
 
+    _regPort = Manager::instance().getSipPort();
+    
     /* Instanciate the C++ thread */
     _evThread = new EventThread (this);
 
@@ -890,7 +892,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
      */
     pjsip_evsub_set_mod_data (sub, getModId(), this);
 
-    _debug ("SIP port listener = %i ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", _localExternPort);
+    _debug ("SIP port listener = %i", _localExternPort);
 
     /*
      * Create REFER request.
-- 
GitLab