ekiga r6135 - in trunk: . src/endpoints



Author: dsandras
Date: Sun Apr  6 18:57:18 2008
New Revision: 6135
URL: http://svn.gnome.org/viewvc/ekiga?rev=6135&view=rev

Log:
Began moving the no answer timeout from the GMManager to the Call,
where it should belong when you have several calls running at the same
time.


Modified:
   trunk/ChangeLog
   trunk/src/endpoints/opal-call.cpp
   trunk/src/endpoints/opal-call.h

Modified: trunk/src/endpoints/opal-call.cpp
==============================================================================
--- trunk/src/endpoints/opal-call.cpp	(original)
+++ trunk/src/endpoints/opal-call.cpp	Sun Apr  6 18:57:18 2008
@@ -71,6 +71,8 @@
     out_of_order_v = 0;
   lost_packets = late_packets = out_of_order_packets = 0.0;
   re_a_bw = tr_a_bw = re_v_bw = tr_v_bw = 0.0;
+
+  NoAnswerTimer.SetNotifier (PCREATE_NOTIFIER (OnNoAnswerTimeout));
 }
 
 
@@ -266,6 +268,8 @@
 PBoolean
 Opal::Call::OnEstablished (OpalConnection & connection)
 {
+  NoAnswerTimer.Stop (false);
+
   if (!PIsDescendant(&connection, OpalPCSSConnection)) {
 
     parse_info (connection);
@@ -281,6 +285,8 @@
 {
   std::string reason;
 
+  NoAnswerTimer.Stop (false);
+
   /** TODO
    * the Call could be destroyed before the signal callback has been executed
    * maybe create a copy constructor
@@ -408,6 +414,9 @@
 
   runtime.run_in_main (setup.make_slot ());
 
+  if (!outgoing)
+    NoAnswerTimer.SetInterval (0, PMIN (10, 60));
+
   return OpalCall::OnSetUp (connection);
 }
 
@@ -502,7 +511,6 @@
     lost_v = session.GetPacketsLost ();
     too_late_v = session.GetPacketsTooLate ();
     out_of_order_v = session.GetPacketsOutOfOrder ();
-
   }
 
   lost_packets = (lost_a + lost_v) / max ((unsigned long)(total_a + total_v), (unsigned long) 1);
@@ -531,3 +539,30 @@
       PDownCast (OpalPCSSConnection, &(*connection))->AcceptIncoming ();
   }
 }
+
+
+void
+Opal::Call::OnNoAnswerTimeout (PTimer &,
+                               INT) 
+{
+  //FIXME
+  if (!is_outgoing ()) {
+    std::cout << "should clear or forward" << std::endl << std::flush;
+  }
+  else
+    std::cout << "should not clear or forward" << std::endl << std::flush;
+  //if (!forward_uri.empty ()) {
+
+
+    /*
+       PSafePtr<OpalCall> call = 
+       endpoint.FindCallWithLock (endpoint.GetCurrentCallToken ());
+       PSafePtr<OpalConnection> con = 
+       endpoint.GetConnection (call, TRUE);
+
+       con->ForwardCall (forward_uri.c_str ());
+       */
+ // }
+ // else
+  //  ClearAllCalls (OpalConnection::EndedByNoAnswer, FALSE);
+}

Modified: trunk/src/endpoints/opal-call.h
==============================================================================
--- trunk/src/endpoints/opal-call.h	(original)
+++ trunk/src/endpoints/opal-call.h	Sun Apr  6 18:57:18 2008
@@ -53,174 +53,179 @@
 
   class Call
     : public OpalCall,
-      public Ekiga::Call
-    {
+    public Ekiga::Call
+  {
 
-  public:
+public:
 
-      Call (OpalManager & _manager, Ekiga::ServiceCore & _core);
+    Call (OpalManager & _manager, Ekiga::ServiceCore & _core);
 
-      ~Call () { };
+    ~Call () { };
 
-      /*
-       * Call Management
-       */
+    /*
+     * Call Management
+     */
 
-      /** Hangup the call
-       */
-      void hangup ();
+    /** Hangup the call
+    */
+    void hangup ();
 
-      /** Answer an incoming call
-       */
-      void answer ();
+    /** Answer an incoming call
+    */
+    void answer ();
 
-      /** Transfer the call to the specified uri
-       * @param: uri: where to transfer the call
-       */
-      void transfer (std::string uri);
+    /** Transfer the call to the specified uri
+     * @param: uri: where to transfer the call
+     */
+    void transfer (std::string uri);
 
-      /** Put the call on hold or retrieve it
-       */
-      void toggle_hold ();
+    /** Put the call on hold or retrieve it
+    */
+    void toggle_hold ();
 
-      /** Toggle stream transmission (if any)
-       * @param type the stream type
-       */
-      void toggle_stream_pause (StreamType type);
+    /** Toggle stream transmission (if any)
+     * @param type the stream type
+     */
+    void toggle_stream_pause (StreamType type);
 
-      /** Send the given DTMF
-       * @param the dtmf (one char)
-       */
-      void send_dtmf (const char dtmf);
+    /** Send the given DTMF
+     * @param the dtmf (one char)
+     */
+    void send_dtmf (const char dtmf);
 
 
-      /*
-       * Call Information
-       */
+    /*
+     * Call Information
+     */
 
-      /** Return the call id
-       * @return: the call id
-       */
-      const std::string get_id () const;
+    /** Return the call id
+     * @return: the call id
+     */
+    const std::string get_id () const;
 
-      /** Return the remote party name
-       * @return: the remote party name
-       */
-      const std::string get_remote_party_name () const;
+    /** Return the remote party name
+     * @return: the remote party name
+     */
+    const std::string get_remote_party_name () const;
 
-      /** Return the remote application
-       * @return: the remote application
-       */
-      const std::string get_remote_application () const;
+    /** Return the remote application
+     * @return: the remote application
+     */
+    const std::string get_remote_application () const;
 
 
-      /** Return the remote callback uri
-       * @return: the remote uri
-       */
-      const std::string get_remote_uri () const;
+    /** Return the remote callback uri
+     * @return: the remote uri
+     */
+    const std::string get_remote_uri () const;
 
 
-      /** Return the call duration
-       * @return: the current call duration
-       */
-      const std::string get_duration () const;
+    /** Return the call duration
+     * @return: the current call duration
+     */
+    const std::string get_duration () const;
 
 
-  public:
+public:
 
-      /* Implementation of inherited methods
-       */
+    /* Implementation of inherited methods
+    */
 
-      bool is_outgoing () const { return outgoing; }
-      double get_received_audio_bandwidth () const { return re_a_bw; }
-      double get_transmitted_audio_bandwidth () const { return tr_a_bw; }
-      double get_received_video_bandwidth () const { return re_v_bw; }
-      double get_transmitted_video_bandwidth () const { return tr_v_bw; }
-      unsigned get_jitter_size () const { return jitter; }
-      double get_lost_packets () const { return lost_packets; }
-      double get_late_packets () const { return late_packets; }
-      double get_out_of_order_packets () const { return out_of_order_packets; }
+    bool is_outgoing () const { return outgoing; }
+    double get_received_audio_bandwidth () const { return re_a_bw; }
+    double get_transmitted_audio_bandwidth () const { return tr_a_bw; }
+    double get_received_video_bandwidth () const { return re_v_bw; }
+    double get_transmitted_video_bandwidth () const { return tr_v_bw; }
+    unsigned get_jitter_size () const { return jitter; }
+    double get_lost_packets () const { return lost_packets; }
+    double get_late_packets () const { return late_packets; }
+    double get_out_of_order_packets () const { return out_of_order_packets; }
 
 
-      /*
-       * Opal Callbacks
-       */
-      void OnHold (bool on_hold);
+    /*
+     * Opal Callbacks
+     */
+    void OnHold (bool on_hold);
 
-      void OnOpenMediaStream (OpalMediaStream & stream);
+    void OnOpenMediaStream (OpalMediaStream & stream);
 
-      void OnClosedMediaStream (OpalMediaStream & stream);
+    void OnClosedMediaStream (OpalMediaStream & stream);
 
-      void OnRTPStatistics (const OpalConnection & connection, const RTP_Session & session);
+    void OnRTPStatistics (const OpalConnection & connection, const RTP_Session & session);
 
-  private:
+private:
 
-      PBoolean OnEstablished (OpalConnection & connection);
+    PBoolean OnEstablished (OpalConnection & connection);
 
-      void OnReleased (OpalConnection & connection);
+    void OnReleased (OpalConnection & connection);
 
-      OpalConnection::AnswerCallResponse OnAnswerCall (OpalConnection & connection, const PString & caller);
+    OpalConnection::AnswerCallResponse OnAnswerCall (OpalConnection & connection, const PString & caller);
 
-      PBoolean OnSetUp (OpalConnection & connection);
+    PBoolean OnSetUp (OpalConnection & connection);
 
-      PDECLARE_NOTIFIER (PThread, Opal::Call, OnAnswer);
+    PDECLARE_NOTIFIER (PThread, Opal::Call, OnAnswer);
 
 
-      /*
-       * Helper methods
-       */
-      void parse_info (OpalConnection & connection);
+    /*
+     * Helper methods
+     */
+    void parse_info (OpalConnection & connection);
 
+    /*
+     *
+     */
+    PDECLARE_NOTIFIER(PTimer, Opal::Call, OnNoAnswerTimeout);
+    PTimer NoAnswerTimer;
 
-      /*
-       * Variables
-       */
-      Ekiga::ServiceCore & core;
-      Ekiga::Runtime & runtime;
+    /*
+     * Variables
+     */
+    Ekiga::ServiceCore & core;
+    Ekiga::Runtime & runtime;
 
 
-      std::string remote_party_name;
-      std::string remote_uri;
-      std::string remote_application;
+    std::string remote_party_name;
+    std::string remote_uri;
+    std::string remote_application;
 
-      bool outgoing;
+    bool outgoing;
 
-      double re_a_bw;
-      double tr_a_bw;
-      double re_v_bw;
-      double tr_v_bw;
-      unsigned re_v_fps;
-      unsigned tr_v_fps;
-      unsigned tr_width;
-      unsigned tr_height;
-      unsigned re_width;
-      unsigned re_height;
+    double re_a_bw;
+    double tr_a_bw;
+    double re_v_bw;
+    double tr_v_bw;
+    unsigned re_v_fps;
+    unsigned tr_v_fps;
+    unsigned tr_width;
+    unsigned tr_height;
+    unsigned re_width;
+    unsigned re_height;
 
-      unsigned jitter;
+    unsigned jitter;
 
-      double lost_packets;
-      double late_packets;
-      double out_of_order_packets;
+    double lost_packets;
+    double late_packets;
+    double out_of_order_packets;
 
-      PMutex stats_mutex;
-      double re_a_bytes;
-      double tr_a_bytes;
-      double re_v_bytes;
-      double tr_v_bytes;
+    PMutex stats_mutex;
+    double re_a_bytes;
+    double tr_a_bytes;
+    double re_v_bytes;
+    double tr_v_bytes;
 
-      PTime last_a_tick;
-      PTime last_v_tick;
-      PTime start_time;
+    PTime last_a_tick;
+    PTime last_v_tick;
+    PTime start_time;
 
-      unsigned lost_a;
-      unsigned too_late_a;
-      unsigned out_of_order_a;
-      unsigned total_a;
-      unsigned lost_v;
-      unsigned too_late_v;
-      unsigned out_of_order_v;
-      unsigned total_v;
-   };
+    unsigned lost_a;
+    unsigned too_late_a;
+    unsigned out_of_order_a;
+    unsigned total_a;
+    unsigned lost_v;
+    unsigned too_late_v;
+    unsigned out_of_order_v;
+    unsigned total_v;
+  };
 };
 
 #endif



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