... and the patch itself attached.

-------- Original Message --------
Subject:        Fwd: Video SDP and Timeout Notification
Date:   Tue, 18 Oct 2011 09:12:27 -0600
From:   Jeremy Childs <[email protected]>
To:     [email protected]



I'm pretty sure I neglected to forward this patch to the list. This patch modifies rtpproxy so one stream's timeout (the video stream, for example) does not fire a notify event unless the timed-out stream is the last stream with that call-id.

This fixes the problem where an offered, but unaccepted video stream would timeout the entire call after 1 minute.

-------- Original Message --------
Subject:        Video SDP and Timeout Notification
Date:   Thu, 01 Sep 2011 11:03:40 -0600
From:   Jeremy Childs <[email protected]>
To:     [email protected]



Maxim:

I have discovered an interesting problem with timeout notification and SDP offers that include a second media stream (video, in my case).

If the second stream in the offer is not accepted by the callee, then the second rtpproxy session times out after 60 seconds, and timeout notification is sent to the controlling application, cancelling the call.

I can see a couple of ways of fixing this, and am looking for advice regarding which strategy is better:

1. The easy fix is to NOT send notifications if the session is not complete.
     if (sc->complete) { do_timeout_notification(); }

2. Harder (but maybe more correct) is to only send a notification if this is the last session left with the given call-id.
   if (is_last_session(sp->call_id)) { do_timeout_notification(); }

Do you have any thoughts on which strategy is better?

J

>From 5ed7462dca19e1ffeb9220bb7237882c40b1c67d Mon Sep 17 00:00:00 2001
From: Jeremy Childs <[email protected]>
Date: Thu, 1 Sep 2011 12:44:28 -0600
Subject: [PATCH] Count sessions so we dont' notify prematurely.

---
 main.c         |    4 +++-
 rtpp_session.c |   18 ++++++++++++++++++
 rtpp_session.h |    1 +
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/main.c b/main.c
index c79b511..2565139 100644
--- a/main.c
+++ b/main.c
@@ -659,7 +659,9 @@ process_rtp(struct cfg *cf, double dtime, int alarm_tick)
          sp->sidx[0] == readyfd) {
            if (get_ttl(sp) == 0) {
                rtpp_log_write(RTPP_LOG_INFO, sp->log, "session timeout");
-               rtpp_notify_schedule(cf, sp);
+               if (count_sessions(cf, sp->call_id) < 2) {
+                 rtpp_notify_schedule(cf, sp);
+               }
                remove_session(cf, sp);
            } else {
                if (sp->ttl[0] != 0)
diff --git a/rtpp_session.c b/rtpp_session.c
index 03e3d8a..cc2f680 100644
--- a/rtpp_session.c
+++ b/rtpp_session.c
@@ -125,6 +125,24 @@ session_findfirst(struct cfg *cf, const char *call_id)
     return (sp);
 }
 
+int
+count_sessions(struct cfg *cf, const char *call_id)
+{
+    uint8_t hash;
+    struct rtpp_session *sp;
+    int count;
+
+    count = 0;
+
+    hash = hash_string(&cf->stable, call_id, NULL);
+    for (sp = cf->hash_table[hash]; sp != NULL; sp = sp->next) {
+       if (strcmp(sp->call_id, call_id) == 0) {
+         count++;
+       }
+    }
+    return count;
+}
+
 struct rtpp_session *
 session_findnext(struct rtpp_session *psp)
 {
diff --git a/rtpp_session.h b/rtpp_session.h
index 69e7659..1984ab8 100644
--- a/rtpp_session.h
+++ b/rtpp_session.h
@@ -96,5 +96,6 @@ void remove_session(struct cfg *, struct rtpp_session *);
 int compare_session_tags(const char *, const char *, unsigned *);
 int find_stream(struct cfg *, const char *, const char *, const char *, struct 
rtpp_session **);
 int get_ttl(struct rtpp_session *);
+int count_sessions(struct cfg *cf, const char *call_id);
 
 #endif
-- 
1.7.3.1

_______________________________________________
Devel mailing list
[email protected]
http://lists.rtpproxy.org/mailman/listinfo/devel

Reply via email to