diff --git a/sflphone-gtk/src/accountwindow.c b/sflphone-gtk/src/accountwindow.c
index 723eed865095bbc8ae52dfb4bbe1313f60d57b38..e1ceb3cf81e479c5a41780a3c9f1c5c51321371b 100644
--- a/sflphone-gtk/src/accountwindow.c
+++ b/sflphone-gtk/src/accountwindow.c
@@ -44,7 +44,6 @@ GtkWidget * entryProtocol;
 GtkWidget * entryEnabled;
 GtkWidget * entryUsername;
 GtkWidget * entryHostname;
-GtkWidget * entryPort;
 GtkWidget * entryPassword;
 GtkWidget * stunServer;
 GtkWidget * stunEnable;
@@ -61,12 +60,10 @@ change_protocol (account_t * currentAccount UNUSED)
   if (strcmp(proto, "SIP") == 0) {
     gtk_widget_set_sensitive( GTK_WIDGET(stunEnable), TRUE);
     gtk_widget_set_sensitive( GTK_WIDGET(stunServer), TRUE);
-    gtk_widget_set_sensitive( GTK_WIDGET(entryPort),  TRUE);
   }
   else if (strcmp(proto, "IAX") == 0) {
     gtk_widget_set_sensitive( GTK_WIDGET(stunEnable),   FALSE);
     gtk_widget_set_sensitive( GTK_WIDGET(stunServer),   FALSE);
-    gtk_widget_set_sensitive( GTK_WIDGET(entryPort),   FALSE);
   }
   else {
     // Should not get here.
@@ -107,7 +104,6 @@ show_account_window (account_t * a)
   gchar * curAlias = "";
   gchar * curUsername = "";
   gchar * curHostname = "";
-  gchar * curPort = "5060";
   gchar * curPassword = "";
   /* TODO: add curProxy, and add boxes for Proxy support */
   gchar * stun_enabled = "FALSE";
@@ -130,7 +126,6 @@ show_account_window (account_t * a)
     }
     else if (strcmp(curAccountType, "SIP") == 0) {
       curHostname = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_HOST);
-      curPort = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_PORT);
       curPassword = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_PASSWORD);
       curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_USER);
       stun_enabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_ENABLED);
@@ -161,7 +156,7 @@ show_account_window (account_t * a)
   gtk_box_pack_start(GTK_BOX(dialog->vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show(frame);
 
-  table = gtk_table_new ( 9, 2  ,  FALSE/* homogeneous */);
+  table = gtk_table_new ( 8, 2  ,  FALSE/* homogeneous */);
   gtk_table_set_row_spacings( GTK_TABLE(table), 10);
   gtk_table_set_col_spacings( GTK_TABLE(table), 10);
   gtk_widget_show(table);
@@ -229,16 +224,8 @@ show_account_window (account_t * a)
   gtk_entry_set_text(GTK_ENTRY(entryHostname), curHostname);
   gtk_table_attach ( GTK_TABLE( table ), entryHostname, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
-  label = gtk_label_new_with_mnemonic (_("_Port"));
-  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-  gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
-  entryPort = gtk_entry_new();
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort);
-  gtk_entry_set_text(GTK_ENTRY(entryPort), curPort);
-  gtk_table_attach ( GTK_TABLE( table ), entryPort, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-
   label = gtk_label_new_with_mnemonic (_("_User name"));
-  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
   gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
   entryUsername = sexy_icon_entry_new();
   //image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
@@ -246,10 +233,10 @@ show_account_window (account_t * a)
   sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(entryUsername), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); 
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryUsername);
   gtk_entry_set_text(GTK_ENTRY(entryUsername), curUsername);
-  gtk_table_attach ( GTK_TABLE( table ), entryUsername, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), entryUsername, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
   label = gtk_label_new_with_mnemonic (_("_Password"));
-  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
   gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
   entryPassword = sexy_icon_entry_new();
   image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
@@ -257,15 +244,15 @@ show_account_window (account_t * a)
   gtk_entry_set_visibility(GTK_ENTRY(entryPassword), FALSE);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPassword);
   gtk_entry_set_text(GTK_ENTRY(entryPassword), curPassword);
-  gtk_table_attach ( GTK_TABLE( table ), entryPassword, 1, 2, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), entryPassword, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
   label = gtk_label_new_with_mnemonic (_("_Voicemail box #"));
-  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 9, 10, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
   gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
   entryMailbox = gtk_entry_new();
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryMailbox);
   gtk_entry_set_text(GTK_ENTRY(entryMailbox), curMailbox);
-  gtk_table_attach ( GTK_TABLE( table ), entryMailbox, 1, 2, 9, 10, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach ( GTK_TABLE( table ), entryMailbox, 1, 2, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
   gtk_widget_show_all( table );
   gtk_container_set_border_width (GTK_CONTAINER(table), 10);
@@ -341,10 +328,6 @@ show_account_window (account_t * a)
 	  g_strdup(ACCOUNT_SIP_HOST), 
 	  g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryHostname))));
 
-      g_hash_table_replace(currentAccount->properties, 
-	  g_strdup(ACCOUNT_SIP_PORT), 
-	  g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryPort))));
-      
       g_hash_table_replace(currentAccount->properties, 
 	  g_strdup(ACCOUNT_SIP_USER), 
 	  g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryUsername))));
diff --git a/sflphone-gtk/src/configurationmanager-glue.h b/sflphone-gtk/src/configurationmanager-glue.h
index 9e54d25286f1a14972ad48274a89bc1fa26f3075..ba2d46b61d762461b715f06ee93ec4d07afd6ede 100644
--- a/sflphone-gtk/src/configurationmanager-glue.h
+++ b/sflphone-gtk/src/configurationmanager-glue.h
@@ -1926,6 +1926,81 @@ org_sflphone_SFLphone_ConfigurationManager_get_pulse_app_volume_control_async (D
   stuff->userdata = userdata;
   return dbus_g_proxy_begin_call (proxy, "getPulseAppVolumeControl", org_sflphone_SFLphone_ConfigurationManager_get_pulse_app_volume_control_async_callback, stuff, g_free, G_TYPE_INVALID);
 }
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+org_sflphone_SFLphone_ConfigurationManager_set_sip_port (DBusGProxy *proxy, const gint IN_port, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "setSipPort", error, G_TYPE_INT, IN_port, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_sip_port_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+org_sflphone_SFLphone_ConfigurationManager_set_sip_port_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(org_sflphone_SFLphone_ConfigurationManager_set_sip_port_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+org_sflphone_SFLphone_ConfigurationManager_set_sip_port_async (DBusGProxy *proxy, const gint IN_port, org_sflphone_SFLphone_ConfigurationManager_set_sip_port_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "setSipPort", org_sflphone_SFLphone_ConfigurationManager_set_sip_port_async_callback, stuff, g_free, G_TYPE_INT, IN_port, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+org_sflphone_SFLphone_ConfigurationManager_get_sip_port (DBusGProxy *proxy, gint* OUT_port, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "getSipPort", error, G_TYPE_INVALID, G_TYPE_INT, OUT_port, G_TYPE_INVALID);
+}
+
+typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_sip_port_reply) (DBusGProxy *proxy, gint OUT_port, GError *error, gpointer userdata);
+
+static void
+org_sflphone_SFLphone_ConfigurationManager_get_sip_port_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  gint OUT_port;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INT, &OUT_port, G_TYPE_INVALID);
+  (*(org_sflphone_SFLphone_ConfigurationManager_get_sip_port_reply)data->cb) (proxy, OUT_port, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+org_sflphone_SFLphone_ConfigurationManager_get_sip_port_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_sip_port_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "getSipPort", org_sflphone_SFLphone_ConfigurationManager_get_sip_port_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
 #endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */
 
 G_END_DECLS
diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c
index bd5ffe20a94d954177d1ea203ae433c923827134..acaba527ba5efc602880aa00b579ffac368f4f2a 100644
--- a/sflphone-gtk/src/configwindow.c
+++ b/sflphone-gtk/src/configwindow.c
@@ -36,6 +36,7 @@
 /**
  * Local variables
  */
+gboolean accDialogOpen = FALSE;
 gboolean dialogOpen = FALSE;
 gboolean ringtoneEnabled = TRUE;
 
@@ -69,7 +70,7 @@ enum {
 void
 config_window_fill_account_list()
 {
-	if(dialogOpen)
+	if(accDialogOpen)
 	{
 		GtkTreeIter iter;
 
@@ -313,6 +314,13 @@ set_pulse_app_volume_control( void )
   dbus_set_pulse_app_volume_control();
 }
 
+//static void update_port( GtkSpinButton *button, void *ptr )
+static void update_port( GtkSpinButton *button )
+{
+  dbus_set_sip_port(gtk_spin_button_get_value_as_int(button));
+  //dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)));
+}
+
 /**
  * Account settings tab
  */
@@ -449,6 +457,7 @@ create_general_settings ()
   GtkWidget *value;
   GtkWidget *label;
   GtkWidget *cleanButton;
+  GtkWidget *entryPort;
 
   // Main widget
   ret = gtk_vbox_new(FALSE, 10);
@@ -534,6 +543,28 @@ create_general_settings ()
   gtk_box_pack_start( GTK_BOX(vbox) , widg , TRUE , TRUE , 1);
   g_signal_connect(G_OBJECT( widg ) , "clicked" , G_CALLBACK( set_pulse_app_volume_control ) , NULL);
 
+  /** SIP port information */
+  int curPort = dbus_get_sip_port();
+  if(curPort <= 0 || curPort > 65535)
+    curPort = 5060;
+    
+  frame = gtk_frame_new( _("SIP Port"));
+  gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
+  gtk_widget_show( frame );
+
+  vbox = gtk_vbox_new(FALSE, 10);
+  gtk_widget_show( vbox );
+  gtk_container_add( GTK_CONTAINER(frame) , vbox);
+
+  label = gtk_label_new(_("Port number:"));
+  entryPort = gtk_spin_button_new_with_range(1, 65535, 1);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort);
+  gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort);
+  //gtk_table_attach ( GTK_TABLE( table ), entryPort, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_box_pack_start( GTK_BOX(vbox) , entryPort , TRUE , TRUE , 1);
+  g_signal_connect( G_OBJECT( entryPort) , "value-changed" , G_CALLBACK( update_port ) , NULL);
+  //g_signal_connect( G_OBJECT( applyButton) , "value-changed" , G_CALLBACK( update_port ) , entryPort);
+
   gtk_widget_show_all(ret);
   
   return ret;
@@ -599,7 +630,7 @@ show_accounts_window( void )
   GtkWidget * accountFrame;
   GtkWidget * tab;
 
-  dialogOpen = TRUE;
+  accDialogOpen = TRUE;
 
   dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Accounts"),
                               GTK_WINDOW(get_main_window()),
@@ -625,7 +656,7 @@ show_accounts_window( void )
 
       gtk_dialog_run( dialog );
 
-      dialogOpen=FALSE;
+      accDialogOpen=FALSE;
       gtk_widget_destroy(GTK_WIDGET(dialog));
       if( account_list_get_size() >0 && account_list_get_current()==NULL ) 
 	account_list_set_current_pos(0);
diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c
index 2246666d1c983b1876ae4cbf4474c6d3c8eff228..2303dc6489ceca7d832806cb2ceb0452a3eeded8 100644
--- a/sflphone-gtk/src/dbus.c
+++ b/sflphone-gtk/src/dbus.c
@@ -1480,3 +1480,34 @@ dbus_get_pulse_app_volume_control( void )
 	return state;
 }
 
+void
+dbus_set_sip_port( const guint portNum  )
+{
+        GError* error = NULL;
+        org_sflphone_SFLphone_ConfigurationManager_set_sip_port(
+                        configurationManagerProxy,
+                        portNum,
+                        &error);
+        if(error)
+        {
+                g_error_free(error);
+        }
+}
+
+guint
+dbus_get_sip_port( void )
+{
+        GError* error = NULL;
+        gint portNum;
+        org_sflphone_SFLphone_ConfigurationManager_get_sip_port(
+                        configurationManagerProxy,
+                        &portNum,
+                        &error);
+        if(error)
+        {
+                g_error_free(error);
+        }
+        g_print("GET MAX CALLS = %i\n" , portNum);
+        return (guint)portNum;
+}
+
diff --git a/sflphone-gtk/src/dbus.h b/sflphone-gtk/src/dbus.h
index 4714a0e4df133006fbbed5b5d89ef0cf2c18aecc..4989443f06897300ebcd52e6cea87c6721cbcc58 100644
--- a/sflphone-gtk/src/dbus.h
+++ b/sflphone-gtk/src/dbus.h
@@ -425,4 +425,8 @@ void dbus_register( int pid, gchar * name);
  */
 void dbus_unregister(int pid);
 
+void dbus_set_sip_port(const guint portNum);
+
+guint dbus_get_sip_port();
+
 #endif
diff --git a/sflphone-gtk/src/sflphone_const.h b/sflphone-gtk/src/sflphone_const.h
index 4ae41ee6903a27f21191cdc0b31f41da61eaa41a..134f462cab85e263c4d63806cae8b356bf6dc049 100644
--- a/sflphone-gtk/src/sflphone_const.h
+++ b/sflphone-gtk/src/sflphone_const.h
@@ -49,8 +49,6 @@
 #define ACCOUNT_SIP_USER      "SIP.username"
 /** SIP parameter: password */
 #define ACCOUNT_SIP_PASSWORD       "SIP.password"
-// SIP connection port
-#define ACCOUNT_SIP_PORT	   "SIP.port"
 /** SIP parameter: proxy address */
 #define ACCOUNT_SIP_PROXY          "SIP.proxy"
 /** SIP parameter: stun server address */
diff --git a/src/account.h b/src/account.h
index fc722ebd074067d303dff75b7ca09b2b415613f0..d099e965c6bd6c00612efef690fff34ba20ae5b9 100644
--- a/src/account.h
+++ b/src/account.h
@@ -56,8 +56,6 @@ typedef std::string AccountID;
 #define SIP_PASSWORD          "SIP.password"
 /** SIP parameter : host name */
 #define SIP_HOST	      "SIP.hostPart"
-// SIP port
-#define SIP_PORT	      "SIP.port"
 /** SIP parameter : proxy address */
 #define SIP_PROXY             "SIP.proxy"
 /** SIP parameter : stun server address */
diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h
index 8061b8ede0f61d6c02331dbec0c11912dbc17574..292756cdb7e2c1c6b476b25432d1d56ac29322df 100644
--- a/src/dbus/configurationmanager-glue.h
+++ b/src/dbus/configurationmanager-glue.h
@@ -71,6 +71,8 @@ public:
         register_method(ConfigurationManager_adaptor, switchPopupMode, _switchPopupMode_stub);
         register_method(ConfigurationManager_adaptor, setPulseAppVolumeControl, _setPulseAppVolumeControl_stub);
         register_method(ConfigurationManager_adaptor, getPulseAppVolumeControl, _getPulseAppVolumeControl_stub);
+        register_method(ConfigurationManager_adaptor, setSipPort, _setSipPort_stub);
+        register_method(ConfigurationManager_adaptor, getSipPort, _getSipPort_stub);
     }
 
     ::DBus::IntrospectedInterface *const introspect() const 
@@ -326,6 +328,16 @@ public:
             { "state", "i", false },
             { 0, 0, 0 }
         };
+        static ::DBus::IntrospectedArgument setSipPort_args[] = 
+        {
+            { "port", "i", true },
+            { 0, 0, 0 }
+        };
+        static ::DBus::IntrospectedArgument getSipPort_args[] = 
+        {
+            { "port", "i", false },
+            { 0, 0, 0 }
+        };
         static ::DBus::IntrospectedArgument parametersChanged_args[] = 
         {
             { "list", "a{ss}", false },
@@ -393,6 +405,8 @@ public:
             { "switchPopupMode", switchPopupMode_args },
             { "setPulseAppVolumeControl", setPulseAppVolumeControl_args },
             { "getPulseAppVolumeControl", getPulseAppVolumeControl_args },
+            { "setSipPort", setSipPort_args },
+            { "getSipPort", getSipPort_args },
             { 0, 0 }
         };
         static ::DBus::IntrospectedMethod ConfigurationManager_adaptor_signals[] = 
@@ -478,6 +492,8 @@ public:
     virtual void switchPopupMode() = 0;
     virtual void setPulseAppVolumeControl() = 0;
     virtual int32_t getPulseAppVolumeControl() = 0;
+    virtual void setSipPort(const int32_t& port) = 0;
+    virtual int32_t getSipPort() = 0;
 
 public:
 
@@ -992,6 +1008,25 @@ private:
         wi << argout1;
         return reply;
     }
+    ::DBus::Message _setSipPort_stub(const ::DBus::CallMessage &call)
+    {
+        ::DBus::MessageIter ri = call.reader();
+
+        int32_t argin1; ri >> argin1;
+        setSipPort(argin1);
+        ::DBus::ReturnMessage reply(call);
+        return reply;
+    }
+    ::DBus::Message _getSipPort_stub(const ::DBus::CallMessage &call)
+    {
+        ::DBus::MessageIter ri = call.reader();
+
+        int32_t argout1 = getSipPort();
+        ::DBus::ReturnMessage reply(call);
+        ::DBus::MessageIter wi = reply.writer();
+        wi << argout1;
+        return reply;
+    }
 };
 
 } } } 
diff --git a/src/dbus/configurationmanager-introspec.xml b/src/dbus/configurationmanager-introspec.xml
index 624260b76321a161920d1b359bb8b0afc257be6b..df72d96e79c6ecf77b4c47ca27c2a4a90b94106c 100644
--- a/src/dbus/configurationmanager-introspec.xml
+++ b/src/dbus/configurationmanager-introspec.xml
@@ -210,6 +210,14 @@
       <arg type="i" name="state" direction="out"/>
     </method>
 
+    <method name="setSipPort">
+      <arg type="i" name="port" direction="in"/>
+    </method>
+
+    <method name="getSipPort">
+      <arg type="i" name="port" direction="out"/>
+    </method>
+
   <!--        /////////////////////////////       -->
     <signal name="parametersChanged">
       <arg type="a{ss}" name="list" direction="out"/>
diff --git a/src/dbus/configurationmanager.cpp b/src/dbus/configurationmanager.cpp
index 753bab7f31f69f3ea31173242fd0cd4f9188e248..547afded01e9912d0e65923bf0ce193ba8830cce 100644
--- a/src/dbus/configurationmanager.cpp
+++ b/src/dbus/configurationmanager.cpp
@@ -382,3 +382,16 @@ ConfigurationManager::setPulseAppVolumeControl( void )
   Manager::instance().setPulseAppVolumeControl();
 }
 
+int32_t 
+ConfigurationManager::getSipPort( void )
+{
+  return Manager::instance().getSipPort();
+}
+ 
+void 
+ConfigurationManager::setSipPort( const int32_t& portNum )
+{
+  _debug("Manager received setSipPort: %d\n", portNum);
+  Manager::instance().setSipPort(portNum);
+}
+
diff --git a/src/dbus/configurationmanager.h b/src/dbus/configurationmanager.h
index 3ff93f778e3681291906e55b99f4416feccaa566..86c6ee7dec89ae7352a8ea423ea401cfa4edab8f 100644
--- a/src/dbus/configurationmanager.h
+++ b/src/dbus/configurationmanager.h
@@ -95,6 +95,8 @@ public:
     void setMailNotify( void );
     int32_t getPulseAppVolumeControl( void );
     void setPulseAppVolumeControl( void );
+    int32_t getSipPort( void );
+    void setSipPort( const int32_t& portNum );
 
 };
 
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index dfc47912109f9e6221c9435cee5a2e6509f3c133..b29ce3732955c374d2af4f735cec565d88533529 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -1070,6 +1070,7 @@ ManagerImpl::initConfigFile (void)
   fill_config_int(REGISTRATION_EXPIRE , DFT_EXPIRE_VALUE);
   fill_config_int(CONFIG_AUDIO , DFT_AUDIO_MANAGER);
   fill_config_int(CONFIG_PA_VOLUME_CTRL , YES_STR);
+  fill_config_int(CONFIG_SIP_PORT, DFT_SIP_PORT);
 
   // Loads config from ~/.sflphone/sflphonedrc or so..
   if (createSettingsPath() == 1) {
@@ -1973,12 +1974,6 @@ ManagerImpl::getAccountDetails(const AccountID& accountID)
 	  getConfigString(accountID, SIP_HOST)
 	  )
 	);
-    a.insert(
-	std::pair<std::string, std::string>(
-	  SIP_PORT, 
-	  getConfigString(accountID, SIP_PORT)
-	  )
-	);	
     a.insert(
 	std::pair<std::string, std::string>(
 	  SIP_PROXY, 
@@ -2053,7 +2048,6 @@ ManagerImpl::setAccountDetails( const std::string& accountID,
     setConfig(accountID, SIP_USER, (*details.find(SIP_USER)).second);
     setConfig(accountID, SIP_PASSWORD,  (*details.find(SIP_PASSWORD)).second);
     setConfig(accountID, SIP_HOST, (*details.find(SIP_HOST)).second);
-    setConfig(accountID, SIP_PORT, (*details.find(SIP_PORT)).second);
     setConfig(accountID, SIP_STUN_SERVER,(*details.find(SIP_STUN_SERVER)).second);
     setConfig(accountID, CONFIG_ACCOUNT_MAILBOX,(*details.find(CONFIG_ACCOUNT_MAILBOX)).second);
     setConfig(accountID, SIP_USE_STUN,
@@ -2080,6 +2074,8 @@ ManagerImpl::setAccountDetails( const std::string& accountID,
 
   // Update account details
   if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
+
+  //restartPjsip();
 }
 
 void
@@ -2106,7 +2102,6 @@ ManagerImpl::sendRegister( const std::string& accountID , const int32_t& expire
 ManagerImpl::addAccount(const std::map< std::string, std::string >& details)
 {
 
-  _debug("********************** Into ManagerImpl::addAccount \n");
   /** @todo Deal with both the _accountMap and the Configuration */
   std::string accountType = (*details.find(CONFIG_ACCOUNT_TYPE)).second;
   Account* newAccount;
@@ -2119,6 +2114,7 @@ ManagerImpl::addAccount(const std::map< std::string, std::string >& details)
      if(!_userAgentInitlized) {
         // Initialize the SIP Manager
         _userAgent = new UserAgent();
+        _userAgent->setSipPort(Manager::instance().getConfigInt(PREFERENCES , CONFIG_SIP_PORT));
       }
 
       newAccount = AccountCreator::createAccount(AccountCreator::SIP_ACCOUNT, newAccountID);
@@ -2147,6 +2143,8 @@ ManagerImpl::addAccount(const std::map< std::string, std::string >& details)
   saveConfig();
 
   if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
+
+  //restartPjsip();
 }
 
   void 
@@ -2224,15 +2222,21 @@ ManagerImpl::getNewCallID()
   }
   return random_id.str();
 }
-/*
-ManagerImpl::updatePjsip()
+
+  void 
+ManagerImpl::restartPjsip()
 {
-  if ( _userAgentInitlized )
-	delete _userAgent;
-       //loadAccountMap
-	
+  if ( _userAgentInitlized ){
+    unregisterCurSIPAccounts();
+    _userAgent->sipDestory();
+    //_userAgent->setSipPort(Manager::instance().getConfigInt(PREFERENCES , CONFIG_SIP_PORT));
+
+    _userAgent->sipCreate();
+    _userAgent->sipInit();
+    registerCurSIPAccounts();
+  } 
 }
-*/
+
   short
 ManagerImpl::loadAccountMap()
 {
@@ -2246,6 +2250,7 @@ ManagerImpl::loadAccountMap()
 
   TokenList::iterator iter = sections.begin();
   while(iter != sections.end()) {
+    _debug("***************** In Load account: into while\n");
     // Check if it starts with "Account:" (SIP and IAX pour le moment)
     if ((int)(iter->find("Account:")) == -1) {
       iter++;
@@ -2258,7 +2263,7 @@ ManagerImpl::loadAccountMap()
         // Initialize the SIP Manager
         _userAgent = new UserAgent();
         _userAgentInitlized = true;
-        _userAgent->setRegPort(DEFAULT_SIP_PORT);
+        _userAgent->setSipPort(Manager::instance().getConfigInt(PREFERENCES , CONFIG_SIP_PORT));
       }
 
       tmpAccount = AccountCreator::createAccount(AccountCreator::SIP_ACCOUNT, *iter);
@@ -2270,12 +2275,12 @@ ManagerImpl::loadAccountMap()
         _userAgent->setStunServer(Manager::instance().getConfigString(tmpAccount->getAccountID(), SIP_STUN_SERVER).data());
       }
       
-      // Set registration port for all accounts, The last non-5060 port will be recorded in _userAgent.
+      /*// Set registration port for all accounts, The last non-5060 port will be recorded in _userAgent.
       port = Manager::instance().getConfigString(tmpAccount->getAccountID(), SIP_PORT);
       std::istringstream is(port);
       is >> iPort;
       if (iPort != DEFAULT_SIP_PORT)
-      	_userAgent->setRegPort(iPort);  
+      	_userAgent->setRegPort(iPort);  */
     }
     else if (accountType == "IAX") {
       tmpAccount = AccountCreator::createAccount(AccountCreator::IAX_ACCOUNT, *iter);
@@ -2388,6 +2393,52 @@ UserAgent *ManagerImpl::getUserAgent()
     return _userAgent;
 }
 
+int 
+ManagerImpl::getSipPort()
+{
+    return _userAgent->getSipPort();
+}
+
+void 
+ManagerImpl::setSipPort(int portNum)
+{
+    if(portNum != _userAgent->getSipPort()) {
+        _userAgent->setSipPort(portNum);
+        restartPjsip();
+        setConfig( PREFERENCES , CONFIG_SIP_PORT , portNum );
+    }
+}
+
+void ManagerImpl::unregisterCurSIPAccounts()
+{
+  AccountMap::iterator iter = _accountMap.begin();
+  while( iter != _accountMap.end() ) {
+    if ( iter->second) {
+        std::string p =  Manager::instance().getConfigString( iter->first , CONFIG_ACCOUNT_TYPE );
+      if ( iter->second->isEnabled() && p == "SIP") {
+	// NOW
+	iter->second->unregisterVoIPLink();
+      }
+    }
+    iter++;
+  }
+}
+
+void ManagerImpl::registerCurSIPAccounts()
+{
+  AccountMap::iterator iter = _accountMap.begin();
+  while( iter != _accountMap.end() ) {
+    if ( iter->second) {
+        std::string p =  Manager::instance().getConfigString( iter->first , CONFIG_ACCOUNT_TYPE );
+      if ( iter->second->isEnabled() && p == "SIP") {
+	// NOW
+	iter->second->registerVoIPLink();
+      }
+    }
+    iter++;
+  }    
+}
+
 #ifdef TEST
 /** 
  * Test accountMap
diff --git a/src/managerimpl.h b/src/managerimpl.h
index 8f643ec268528bdb7bfbc66ef7988a417a2d1fdd..57c3b733856e75dd29983165ef134c59e6315f1c 100644
--- a/src/managerimpl.h
+++ b/src/managerimpl.h
@@ -812,12 +812,20 @@ class ManagerImpl {
     bool isCurrentCall(const CallID& callId);
 
     /**
-     * Get the _regc in each sip account
-     * @param AccountID Account ID
-     * @return pjsip_regc*  The regc in the account
+     * Restart PJSIP
+     * @param void
+     * @return void
      */
-    //pjsip_regc *getSipRegcFromID(const AccountID& id); 
+    void restartPjsip();
 
+    int getSipPort();
+    
+    void setSipPort(int port);
+    
+    void unregisterCurSIPAccounts();
+    
+    void registerCurSIPAccounts();
+    
   private:
     
     /**
diff --git a/src/sipaccount.cpp b/src/sipaccount.cpp
index efcf3eb8e1d931cbfa145697dae40aef41499ca3..f7a156ed960c227c5293bcee1414f8cdc8f26680 100644
--- a/src/sipaccount.cpp
+++ b/src/sipaccount.cpp
@@ -63,7 +63,6 @@ SIPAccount::registerVoIPLink()
   thislink->setAuthName(Manager::instance().getConfigString(_accountID,SIP_USER));
   thislink->setPassword(Manager::instance().getConfigString(_accountID,SIP_PASSWORD));
   thislink->setSipServer(Manager::instance().getConfigString(_accountID,SIP_HOST));
-  thislink->setPortNumber(Manager::instance().getConfigString(_accountID,SIP_PORT));
 
   _link->sendRegister();
 }
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 93a8f013d59623db6d4488d132ab7a97f155db12..b440845dc6b2928064816b8c9f01efa58c941622 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -58,7 +58,6 @@ SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
  , _regc()
  , _server("")
  , _bRegister(false)
- , _port(5060)
 {
   // to get random number for RANDOM_PORT
   srand (time(NULL));
@@ -154,7 +153,7 @@ SIPVoIPLink::sendRegister()
 
   setRegistrationState(Trying);
 
-  return Manager::instance().getUserAgent()->addAccount(id, &_regc, _server, _authname, _password, expire_value, _port);
+  return Manager::instance().getUserAgent()->addAccount(id, &_regc, _server, _authname, _password, expire_value);
 }
 
 std::string
@@ -726,16 +725,6 @@ void SIPVoIPLink::setSipServer(const std::string& sipServer)
     //_user = pj_str((char *)tmp.data());
 }
 
-void SIPVoIPLink::setPortNumber(const std::string& port)
-{
-    /*
-	istringstream is(port);
-	unsigned int iPort;
-	is >> iPort;
-	_port = port;
-     */
-}
-
 pj_str_t SIPVoIPLink::string2PJStr(const std::string &value)
 {
     char tmp[256];
diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h
index e8805bcff8c0960162ac3ddaa5044112cf47c2ce..2b4c6b99c145c07d0640af87cd46b1414fbeed8b 100644
--- a/src/sipvoiplink.h
+++ b/src/sipvoiplink.h
@@ -23,7 +23,6 @@
 
 #include "voiplink.h"
 #include <string>
-#include <sstream>
 #include <pjsip.h>
 #include <pjlib-util.h>
 #include <pjlib.h>
@@ -210,8 +209,6 @@ class SIPVoIPLink : public VoIPLink
     
     void setSipServer(const std::string& sipServer);
    
-    void setPortNumber(const std::string& port);
- 
     bool isRegister() {return _bRegister;}
     
     void setRegister(bool result) {_bRegister = result;}
@@ -386,7 +383,6 @@ private:
     pjsip_regc *_regc;
     std::string _server;
     bool _bRegister;
-    unsigned int _port;
 };
 
 #endif
diff --git a/src/user_cfg.h b/src/user_cfg.h
index 25a0cc953b959d9dbe41d5f11aa169bde5f4c8c0..57201f084be7353e84750920d6b4aa74909b64f6 100644
--- a/src/user_cfg.h
+++ b/src/user_cfg.h
@@ -61,6 +61,7 @@
 #define REGISTRATION_EXPIRE	"Registration.expire"	  /** Registration expire value */
 #define CONFIG_AUDIO		"Audio.api"		  /** Audio manager (ALSA or pulseaudio) */
 #define CONFIG_PA_VOLUME_CTRL	"Pulseaudio.volumeCtrl"	  /** Whether or not PA should modify volume of other applications on the same sink */
+#define CONFIG_SIP_PORT         "SIP.portNum"
 
 #define SIGNALISATION		"VoIPLink"	      /** Section Signalisation */
 #define PLAY_DTMF		"DTMF.playDtmf"	      /** Whether or not should play dtmf */
@@ -87,7 +88,7 @@
 #define DFT_MAX_CALLS		"20"			/** Default maximum calls in history */
 #define DFT_EXPIRE_VALUE	"180"			/** Default expire value for registration */
 #define DFT_AUDIO_MANAGER	"1"			/** Default audio manager */
-
+#define DFT_SIP_PORT            "5060"
 
 #ifdef USE_ZEROCONF
 #define CONFIG_ZEROCONF_DEFAULT_STR "1"			/** Default Zero configuration networking module value */
diff --git a/src/useragent.cpp b/src/useragent.cpp
index 3db1fd6b72d805062db581d1d924ca9c23eb7bc2..86c024bdf4c6bbb01f311f54fb941d4b0a6e43a1 100644
--- a/src/useragent.cpp
+++ b/src/useragent.cpp
@@ -35,7 +35,7 @@
 UserAgent *UserAgent::_current;
 
 UserAgent::UserAgent():_endpt(NULL) ,_sock(NULL), _cp(), _pool(NULL), _mutex(NULL), _mod(), _options_handler(), _useStun(false), _stunHost(),
-        _stunServer(""), _localExternAddress(""), _localIPAddress("127.0.0.1"), _localExternPort(0), _localPort(0), _thread(NULL) {
+        _stunServer(""), _localExternAddress(""), _localIPAddress("127.0.0.1"), _localExternPort(0), _localPort(0), _regPort(DEFAULT_SIP_PORT), _thread(NULL) {
     //_useStun = false;
     //_localIPAddress = "127.0.0.1";
     UserAgent::_current = this;
@@ -359,7 +359,7 @@ void UserAgent::busy_sleep(unsigned msec)
 }
 
 bool UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& server, const std::string& user, const std::string& passwd, 
-				const int& timeout UNUSED, const unsigned int& port) {
+				const int& timeout UNUSED) {
     pj_status_t status;
     AccountID *currentId = new AccountID(id);
     char contactTmp[256];
@@ -871,6 +871,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const
     pjsip_tx_data *tdata;
     pj_str_t from, to, contact;
 
+    _debug("*******************AccountId is %s\n", id.data());
     // Get the basic information about the callee account
     SIPAccount* account = dynamic_cast<SIPAccount *>(Manager::instance().getAccount(id));
     
diff --git a/src/useragent.h b/src/useragent.h
index 783e86eca5093899119814f88fb68391d0d033a0..1c92cf1cf9190f190781107de5b05e491653eba6 100644
--- a/src/useragent.h
+++ b/src/useragent.h
@@ -67,7 +67,7 @@ private:
     unsigned int _localPort;
 
     /** For registration use only */
-    unsigned int _regPort;
+    int _regPort;
     
     pj_thread_t *_thread;
     
@@ -75,7 +75,6 @@ private:
     
     /* Sleep with polling */
     void busy_sleep(unsigned msec);
-    void sipDestory();
 public:
     UserAgent();
     ~UserAgent();
@@ -86,7 +85,10 @@ public:
      * This method is used to initialize the pjsip
      */
     pj_status_t sipInit();
-    
+
+
+    void sipDestory();
+
     /** Create SIP UDP Listener */
     int createUDPServer();
 
@@ -94,14 +96,14 @@ public:
     void setStunServer(const char *server); 
 
     /** Set the port number user designated */
-    void setRegPort(unsigned int port) { _regPort = port; }
+    void setSipPort(int port) { _regPort = port; }
  
-    unsigned int getRegPort() { return _regPort; }
+    int getSipPort() { return _regPort; }
     
     pj_str_t getStunServer() { return _stunHost; }
     
     bool addAccount(AccountID id, pjsip_regc **regc, const std::string& server, const std::string& user, const std::string& passwd
-						   , const int& timeout,  const unsigned int& port);
+						   , const int& timeout);
     bool removeAccount(pjsip_regc *regc);
     
     pj_str_t buildContact(char *userName);