ekiga r6180 - in trunk: . lib/engine/protocol/skel src/endpoints



Author: dsandras
Date: Sat Apr 12 15:22:53 2008
New Revision: 6180
URL: http://svn.gnome.org/viewvc/ekiga?rev=6180&view=rev

Log:
Removed new_call signal which was a hack.
Added CreateConnection callbacks to connect signals when there are new
calls..
Fixed incoming calls handling (no more busy when there should be
none).


Modified:
   trunk/ChangeLog
   trunk/lib/engine/protocol/skel/call-core.cpp
   trunk/lib/engine/protocol/skel/call-core.h
   trunk/lib/engine/protocol/skel/call-manager.h
   trunk/src/endpoints/h323.cpp
   trunk/src/endpoints/h323.h
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/opal-call.cpp
   trunk/src/endpoints/sip.cpp
   trunk/src/endpoints/sip.h

Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp	(original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp	Sat Apr 12 15:22:53 2008
@@ -51,9 +51,6 @@
   managers.insert (&manager);
   manager_added.emit (manager);
 
-  // If this Manager emits the new_call signal, let's relay it at the CallCore level
-  manager.new_call.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_new_call), &manager));
-
   // IM stuff
   manager.im_failed.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_failed), &manager));
   manager.im_received.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_received), &manager));
@@ -100,7 +97,7 @@
 }
 
 
-void CallCore::on_new_call (Call *call, CallManager *manager)
+void CallCore::add_call (Call *call, CallManager *manager)
 {
   call->ringing.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_ringing_call), call, manager));
   call->setup.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_setup_call), call, manager));

Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h	(original)
+++ trunk/lib/engine/protocol/skel/call-core.h	Sat Apr 12 15:22:53 2008
@@ -87,6 +87,12 @@
         { return "\tCall Core managing Call Manager objects"; }
 
 
+      /** Adds a call handled by the CallCore serice.
+       * @param call is the call to be added.
+       * @param manager is the CallManager handling it.
+       */
+      void add_call (Call *call, CallManager *manager);
+
       /** Adds a CallManager to the CallCore service.
        * @param The manager to be added.
        */

Modified: trunk/lib/engine/protocol/skel/call-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-manager.h	(original)
+++ trunk/lib/engine/protocol/skel/call-manager.h	Sat Apr 12 15:22:53 2008
@@ -74,13 +74,6 @@
        */
       virtual bool dial (const std::string uri) = 0; 
 
-      /** This signal is emitted when a new call has been created,
-       * it does not mean the call is setup, just that an Ekiga::Call object
-       * has been created by the Ekiga::CallManager
-       * @param the created call 
-       */
-      sigc::signal<void, Ekiga::Call *> new_call; 
-
 
       /*
        * Mandatory Settings

Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp	(original)
+++ trunk/src/endpoints/h323.cpp	Sat Apr 12 15:22:53 2008
@@ -54,8 +54,11 @@
 
 
 /* The class */
-GMH323Endpoint::GMH323Endpoint (GMManager & ep)
-	: H323EndPoint (ep), endpoint (ep)
+GMH323Endpoint::GMH323Endpoint (GMManager & ep, Ekiga::ServiceCore & _core)
+: H323EndPoint (ep), 
+  endpoint (ep),
+  core (_core),
+  runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
 {
   udp_min = 5000;
   udp_max = 5100; 
@@ -225,6 +228,27 @@
 }
 
 
+H323Connection *GMH323Endpoint::CreateConnection (OpalCall & _call,
+                                                  const PString & token,
+                                                  void *userData,
+                                                  OpalTransport & transport,
+                                                  const PString & alias,
+                                                  const H323TransportAddress & address,
+                                                  H323SignalPDU *setupPDU,
+                                                  unsigned options,
+                                                  OpalConnection::StringOptions *stringOptions)
+{
+  /* FIXME
+  Ekiga::Call *call = dynamic_cast<Ekiga::Call *> (&_call);
+  Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
+  if (call_core)
+    call_core->add_call (call, this);
+    */
+
+  return H323EndPoint::CreateConnection (_call, token, userData, transport, alias, address, setupPDU, options, stringOptions);
+}
+
+
 bool 
 GMH323Endpoint::OnIncomingConnection (OpalConnection & /*connection*/,
                                       G_GNUC_UNUSED unsigned options,
@@ -318,7 +342,6 @@
 
     udp_min = min;
     udp_max = max;
-    std::cout << "set udp " << udp_min << " : " << udp_max << std::endl << std::flush;
     endpoint.SetRtpIpPorts (udp_min, udp_max);
     endpoint.SetUDPPorts (udp_min, udp_max);
 

Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h	(original)
+++ trunk/src/endpoints/h323.h	Sat Apr 12 15:22:53 2008
@@ -59,7 +59,7 @@
    * 		     and initialises the variables
    * PRE          :  /
    */
-  GMH323Endpoint (GMManager &ep);
+  GMH323Endpoint (GMManager &ep, Ekiga::ServiceCore & core);
 
   
   /* DESCRIPTION  :  The destructor.
@@ -115,6 +115,17 @@
   bool IsRegisteredWithGatekeeper (const PString & address);
   
 
+  H323Connection *CreateConnection (OpalCall & call,
+                                    const PString & token,
+                                    void * userData,
+                                    OpalTransport & transport,
+                                    const PString & alias,
+                                    const H323TransportAddress & address,
+                                    H323SignalPDU *setupPDU,
+                                    unsigned int options = 0,
+                                    OpalConnection::StringOptions * stringOptions = NULL); 
+
+
   /* DESCRIPTION  :  Called when there is an incoming SIP connection.
    * BEHAVIOR     :  Checks if the connection must be rejected or forwarded
    * 		     and call the manager function of the same name
@@ -168,6 +179,9 @@
  private:
 
   GMManager & endpoint;
+  Ekiga::ServiceCore & core;
+  Ekiga::Runtime & runtime;
+
   PMutex gk_name_mutex;
   PString gk_name;
 

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sat Apr 12 15:22:53 2008
@@ -183,7 +183,7 @@
   SetVideoInputDevice (video);
 
   // Create endpoints
-  h323EP = new GMH323Endpoint (*this);
+  h323EP = new GMH323Endpoint (*this, core);
   AddRouteEntry("pc:.* = h323:<da>");
 	
   sipEP = new GMSIPEndpoint (*this, core);

Modified: trunk/src/endpoints/opal-call.cpp
==============================================================================
--- trunk/src/endpoints/opal-call.cpp	(original)
+++ trunk/src/endpoints/opal-call.cpp	Sat Apr 12 15:22:53 2008
@@ -287,6 +287,7 @@
 
   NoAnswerTimer.Stop (false);
 
+  std::cout << "releasing " << connection << std::endl << std::flush;
   /** TODO
    * the Call could be destroyed before the signal callback has been executed
    * maybe create a copy constructor
@@ -297,6 +298,7 @@
         && !is_outgoing ()
         && connection.GetCallEndReason () != OpalConnection::EndedByAnswerDenied) {
 
+      std::cout << "emit missed " << std::endl << std::flush;
       runtime.run_in_main (missed.make_slot ());
     }
     else {
@@ -412,7 +414,9 @@
 
   outgoing = PIsDescendant(&connection, OpalPCSSConnection);
 
+  std::cout << "OnSetUp " << outgoing << std::endl << std::flush;
   runtime.run_in_main (setup.make_slot ());
+  std::cout << "emitted OnSetUp " << outgoing << std::endl << std::flush;
 
   if (!outgoing)
     NoAnswerTimer.SetInterval (0, PMIN (10, 60));
@@ -527,6 +531,8 @@
 
   int i = 0;
 
+  std::cout << "Should answer" << std::endl << std::flush;
+
   if (!is_outgoing () && !IsEstablished ()) {
 
     do {
@@ -535,8 +541,11 @@
       i++;
     }  while (!PIsDescendant(&(*connection), OpalPCSSConnection));
 
-    if (PIsDescendant(&(*connection), OpalPCSSConnection))
+    std::cout << "Should answer found" << std::endl << std::flush;
+    if (PIsDescendant(&(*connection), OpalPCSSConnection)) {
       PDownCast (OpalPCSSConnection, &(*connection))->AcceptIncoming ();
+      std::cout << "ici" << std::endl << std::flush;
+    }
   }
 }
 

Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp	(original)
+++ trunk/src/endpoints/sip.cpp	Sat Apr 12 15:22:53 2008
@@ -215,7 +215,6 @@
   // TODO: move this code outside of this class and allow a 
   // more complete document
   std::string status = ((Ekiga::PersonalDetails &) (details)).get_short_status ();
-  std::cout << "ici " << status << std::endl << std::flush;
   for (std::list<std::string>::iterator it = aors.begin ();
        it != aors.end ();
        it++) {
@@ -471,19 +470,6 @@
 }
 
 
-bool GMSIPEndpoint::MakeConnection (OpalCall & _call,
-                                    const PString &party,
-                                    void *userData,
-                                    unsigned int options,
-                                    OpalConnection::StringOptions *stringOptions)
-{
-  Ekiga::Call *call = dynamic_cast<Ekiga::Call *> (&_call);
-  runtime.run_in_main (sigc::bind (new_call, call));
-
-  return SIPEndPoint::MakeConnection (_call, party, userData, options, stringOptions);
-}
-
-
 void
 GMSIPEndpoint::OnRegistrationFailed (const PString & _aor,
                                      SIP_PDU::StatusCodes r,
@@ -717,6 +703,24 @@
 }
 
 
+SIPConnection *GMSIPEndpoint::CreateConnection (OpalCall & _call,
+                                                const PString & token,
+                                                void * userData,
+                                                const SIPURL & destination,
+                                                OpalTransport *transport,
+                                                SIP_PDU *invite,
+                                                unsigned int options,
+                                                OpalConnection::StringOptions *stringOptions)
+{
+  Ekiga::Call *call = dynamic_cast<Ekiga::Call *> (&_call);
+  Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
+  if (call_core)
+    call_core->add_call (call, this);
+
+  return SIPEndPoint::CreateConnection (_call, token, userData, destination, transport, invite, options, stringOptions);
+}
+
+
 bool 
 GMSIPEndpoint::OnIncomingConnection (OpalConnection &connection,
                                      unsigned options,
@@ -726,14 +730,15 @@
 
   if (!forward_uri.empty () && unconditional_forward)
     connection.ForwardCall (forward_uri);
-  else if (endpoint.GetCallsNumber () >= 1) { 
+  else if (endpoint.GetCallsNumber () > 1) { 
 
     if (!forward_uri.empty () && forward_on_busy)
       connection.ForwardCall (forward_uri);
-    else 
+    else {
       connection.ClearCall (OpalConnection::EndedByLocalBusy);
+    }
   }
-  else
+  else 
     return SIPEndPoint::OnIncomingConnection (connection, options, stroptions);
 
   return false;

Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h	(original)
+++ trunk/src/endpoints/sip.h	Sat Apr 12 15:22:53 2008
@@ -145,11 +145,14 @@
                              SIP_PDU::StatusCodes reason,
                              bool wasRegistering);
 
-  bool MakeConnection(OpalCall & call,
-                      const PString & party,
-                      void * userData = NULL,
-                      unsigned int options = 0,
-                      OpalConnection::StringOptions *stringOptions = NULL);
+  SIPConnection *CreateConnection (OpalCall & call,
+                                   const PString & token,
+                                   void * userData,
+                                   const SIPURL & destination,
+                                   OpalTransport * transport,
+                                   SIP_PDU * invite,
+                                   unsigned int options = 0,
+                                   OpalConnection::StringOptions * stringOptions = NULL); 
 
 
   /* DESCRIPTION  :  Called when there is an incoming SIP connection.



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