ekiga r6055 - in trunk: . src/endpoints



Author: dsandras
Date: Mon Mar 10 21:56:13 2008
New Revision: 6055
URL: http://svn.gnome.org/viewvc/ekiga?rev=6055&view=rev

Log:
Moved more things to the bridge in order to make sip.cpp ready to move
in the engine.


Modified:
   trunk/ChangeLog
   trunk/src/endpoints/opal-gmconf-bridge.cpp
   trunk/src/endpoints/sip.cpp
   trunk/src/endpoints/sip.h

Modified: trunk/src/endpoints/opal-gmconf-bridge.cpp
==============================================================================
--- trunk/src/endpoints/opal-gmconf-bridge.cpp	(original)
+++ trunk/src/endpoints/opal-gmconf-bridge.cpp	Mon Mar 10 21:56:13 2008
@@ -41,7 +41,7 @@
 #include "opal-gmconf-bridge.h"
 
 #include "manager.h"
-
+#include "sip.h"
 
 using namespace Opal;
 
@@ -67,6 +67,10 @@
   keys.push_back (VIDEO_CODECS_KEY "max_frame_rate");
   keys.push_back (VIDEO_CODECS_KEY "maximum_video_rx_bitrate");
 
+  keys.push_back (SIP_KEY "outbound_proxy_host");
+  keys.push_back (SIP_KEY "dtmf_mode");
+  keys.push_back (NAT_KEY "binding_timeout");
+
   load (keys);
 }
 
@@ -202,5 +206,25 @@
       g_slist_free (video_codecs);
     }
   }
+
+  //
+  // SIP related keys
+  // 
+  else if (key == SIP_KEY "outbound_proxy_host") {
+
+    manager.GetSIPEndpoint ()->set_outbound_proxy (gm_conf_entry_get_string (entry));
+  }
+  else if (key == SIP_KEY "dtmf_mode") {
+
+    manager.GetSIPEndpoint ()->set_dtmf_mode (gm_conf_entry_get_int (entry));
+  }
+
+  //
+  // NAT related keys
+  //
+  else if (key == NAT_KEY "binding_timeout") {
+
+    manager.GetSIPEndpoint ()->set_nat_binding_delay (gm_conf_entry_get_int (entry));
+  }
 }
 

Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp	(original)
+++ trunk/src/endpoints/sip.cpp	Mon Mar 10 21:56:13 2008
@@ -66,91 +66,6 @@
 #define new PNEW
 
 
-
-/* DESCRIPTION  :  This notifier is called when the config database data
- *                 associated with the SIP Outbound Proxy changes.
- * BEHAVIOR     :  It updates the endpoint.
- * PRE          :  data is a pointer to the GMSIPEndPoint.
- */
-static void outbound_proxy_changed_nt (G_GNUC_UNUSED gpointer id,
-                                       GmConfEntry *entry,
-                                       gpointer data);
-
-
-/* DESCRIPTION  :  This callback is called to update capabilities when the
- *                 DTMF mode is changed.
- * BEHAVIOR     :  Updates them.
- * PRE          :  data is a pointer to the GMSIPEndPoint.
- */
-static void dtmf_mode_changed_nt (G_GNUC_UNUSED gpointer id,
-                                  GmConfEntry *entry,
-                                  gpointer data);
-
-
-/* DESCRIPTION  :  This callback is called to update capabilities when the
- *                 NAT binding timeout is changed.
- * BEHAVIOR     :  Update it.
- * PRE          :  data is a pointer to the GMSIPEndPoint.
- */
-static void dtmf_mode_changed_nt (G_GNUC_UNUSED gpointer id,
-                                  GmConfEntry *entry,
-                                  gpointer data);
-
-
-static void
-outbound_proxy_changed_nt (G_GNUC_UNUSED gpointer id,
-                           GmConfEntry *entry,
-                           gpointer data)
-{
-  gchar *outbound_proxy_host = NULL;
-
-  g_return_if_fail (data != NULL);
-
-  if (gm_conf_entry_get_type (entry) == GM_CONF_STRING) {
-
-    gdk_threads_enter ();
-    outbound_proxy_host = gm_conf_get_string (SIP_KEY "outbound_proxy_host");
-    gdk_threads_leave ();
-
-    ((GMSIPEndpoint *) data)->SetProxy (outbound_proxy_host); 
-    g_free (outbound_proxy_host);
-  }
-}
-
-
-static void
-dtmf_mode_changed_nt (G_GNUC_UNUSED gpointer id,
-                      GmConfEntry *entry,
-                      G_GNUC_UNUSED gpointer data)
-{
-  unsigned int mode = 0;
-
-  g_return_if_fail (data != NULL);
-
-  if (gm_conf_entry_get_type (entry) == GM_CONF_INT) {
-
-    mode = gm_conf_entry_get_int (entry);
-    ((GMSIPEndpoint *) data)->SetUserInputMode (mode);
-  }
-}
-
-
-static void
-nat_binding_timeout_changed_nt (G_GNUC_UNUSED gpointer id,
-                                GmConfEntry *entry,
-                                G_GNUC_UNUSED gpointer data)
-{
-  unsigned int binding_timeout = 0;
-
-  g_return_if_fail (data != NULL);
-
-  if (gm_conf_entry_get_type (entry) == GM_CONF_INT) {
-
-    binding_timeout = gm_conf_entry_get_int (entry);
-    ((GMSIPEndpoint *) data)->SetNATBindingTimeout (PTimeInterval (0, binding_timeout));
-  }
-}
-
 /* The class */
 GMSIPEndpoint::GMSIPEndpoint (GMManager & ep, Ekiga::ServiceCore & _core)
 : SIPEndPoint (ep), 
@@ -160,8 +75,18 @@
 {
   uri_prefix = "sip:";
 
+  /* Timeouts */
+  SetAckTimeout (PTimeInterval (0, 32));
+  SetPduCleanUpTimeout (PTimeInterval (0, 1));
+  SetInviteTimeout (PTimeInterval (0, 6));
+  SetNonInviteTimeout (PTimeInterval (0, 6));
+  SetRetryTimeouts (500, 4000);
+  SetMaxRetries (8);
+
+  /* Update the User Agent */
+  SetUserAgent ("Ekiga/" PACKAGE_VERSION);
+
   NoAnswerTimer.SetNotifier (PCREATE_NOTIFIER (OnNoAnswerTimeout));
-  Init ();
 
   Ekiga::PersonalDetails *details = dynamic_cast<Ekiga::PersonalDetails *> (_core.get ("personal-details"));
   if (details)
@@ -254,48 +179,33 @@
 
 
 void 
-GMSIPEndpoint::Init ()
+GMSIPEndpoint::set_outbound_proxy (const std::string & uri)
 {
-  gchar *outbound_proxy_host = NULL;
-  int binding_timeout = 60;
-  unsigned int mode = 0;
-
-  /* Read configuration */
-  gnomemeeting_threads_enter ();
-  outbound_proxy_host = gm_conf_get_string (SIP_KEY "outbound_proxy_host");
-  binding_timeout = gm_conf_get_int (NAT_KEY "binding_timeout");
-  mode = gm_conf_get_int (SIP_KEY "dtmf_mode");
-  gnomemeeting_threads_leave ();
-
-  /* Timeouts */
-  SetAckTimeout (PTimeInterval (0, 32));
-  SetPduCleanUpTimeout (PTimeInterval (0, 1));
-  SetInviteTimeout (PTimeInterval (0, 6));
-  SetNonInviteTimeout (PTimeInterval (0, 6));
-  SetNATBindingTimeout (PTimeInterval (0, binding_timeout));
-  SetRetryTimeouts (500, 4000);
-  SetMaxRetries (8);
-
-  /* Input mode */
-  SetUserInputMode (mode);
+  SIPEndPoint::SetProxy (uri.c_str ());
+}
 
-  /* Update the User Agent */
-  SetUserAgent ("Ekiga/" PACKAGE_VERSION);
 
-  /* Initialise internal parameters */
-  if (outbound_proxy_host && !PString (outbound_proxy_host).IsEmpty ())
-    SetProxy (outbound_proxy_host);
-  SetNATBindingRefreshMethod (SIPEndPoint::EmptyRequest);
-
-  /* Notifiers */
-  gm_conf_notifier_add (SIP_KEY "outbound_proxy_host",
-                        outbound_proxy_changed_nt, (gpointer) this);
-  gm_conf_notifier_add (SIP_KEY "dtmf_mode",
-                        dtmf_mode_changed_nt, (gpointer) this);
-  gm_conf_notifier_add (NAT_KEY "binding_timeout",
-                        nat_binding_timeout_changed_nt, (gpointer) this);
+void 
+GMSIPEndpoint::set_dtmf_mode (unsigned int mode)
+{
+  switch (mode) 
+    {
+    case 0:
+      SetSendUserInputMode (OpalConnection::SendUserInputAsTone);
+      break;
+    case 1:
+      SetSendUserInputMode (OpalConnection::SendUserInputAsInlineRFC2833);
+      break;
+    default:
+      break;
+    }
+}
+  
 
-  g_free (outbound_proxy_host);
+void 
+GMSIPEndpoint::set_nat_binding_delay (unsigned int delay)
+{
+  SIPEndPoint::SetNATBindingTimeout (PTimeInterval (0, delay));
 }
 
 
@@ -377,23 +287,6 @@
 
 
 void 
-GMSIPEndpoint::SetUserInputMode (unsigned int mode)
-{
-  switch (mode) 
-    {
-    case 0:
-      SetSendUserInputMode (OpalConnection::SendUserInputAsTone);
-      break;
-    case 1:
-      SetSendUserInputMode (OpalConnection::SendUserInputAsInlineRFC2833);
-      break;
-    default:
-      break;
-    }
-}
-
-
-void 
 GMSIPEndpoint::Register (const PString & _aor,
                          const PString & authUserName,
                          const PString & password,

Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h	(original)
+++ trunk/src/endpoints/sip.h	Mon Mar 10 21:56:13 2008
@@ -83,6 +83,11 @@
   void unfetch (const std::string uri);
   void publish (const Ekiga::PersonalDetails & details);
 
+  /***/
+  void set_outbound_proxy (const std::string & uri);
+  void set_dtmf_mode (unsigned int mode);
+  void set_nat_binding_delay (unsigned int delay);
+
   
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Starts the listener thread on the port choosen 
@@ -103,14 +108,6 @@
 
   
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Adds the User Input Mode following the
-   *                 configuration options. 
-   * PRE          :  /
-   */
-  void SetUserInputMode (unsigned int mode);
-
-  
-  /* DESCRIPTION  :  /
    * BEHAVIOR     :  Register the SIP endpoint to the given SIP server. 
    * PRE          :  Correct parameters.
    */
@@ -224,15 +221,6 @@
    */
   PDECLARE_NOTIFIER(PTimer, GMSIPEndpoint, OnNoAnswerTimeout);
 
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Init the endpoint internal values and the various
-   *                 components.
-   * PRE          :  /
-   */
-  void Init ();
-
-
   PTimer NoAnswerTimer;
 
   GMManager & endpoint;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]