Forgot the patch :o)

On 2012/01/12 16:02, Kiss Károly Pál wrote:
> Hello All,
> 
> I have run into a problem with rtpproxy's timeout notification feature.
> The problem appears when the call establishes two separate RTP sessions
> but only uses one of them the other is dead.
> Such a scenario can appear when an endpoint requests a session for audio
> and the other one for video, but during call setup the endpoints decide
> not to use the video stream (called end does not support it).
> 
> In this case the call is disconnected after -T seconds because of the video
> stream being idle, but the call is proceeding properly with audio only.
> This can be considered a bug or a feature, depending on network policy.
> 
> I created a patch to change this behaviour, by simply checking all sessions
> of the same call_id and accumulating their TTL's. If it's at 0 then we have
> a timeout, but if any one of them is active timeout notification is canceled.
> 
> The new behaviour can be activated using the -X parameter, the default
> being the old behaviour.
> 
> Please review, and if you believe it's worthy commit it to the codebase.
> 
> The patch was created against latest git version from
>       git://sippy.git.sourceforge.net/gitroot/sippy/rtpproxy
> 
> Thanks,
> Kiss Karoly
> 
> _______________________________________________
> Devel mailing list
> [email protected]
> http://lists.rtpproxy.org/mailman/listinfo/devel
diff --git a/main.c b/main.c
index c79b511..21b2ade 100644
--- a/main.c
+++ b/main.c
@@ -119,6 +119,7 @@ init_config(struct cfg *cf, int argc, char **argv)
     cf->stable.port_max = PORT_MAX;
 
     cf->stable.max_ttl = SESSION_TIMEOUT;
+    cf->stable.multisession_detect = 0;
     cf->stable.tos = TOS;
     cf->stable.rrtcp = 1;
     cf->stable.ttl_mode = TTL_UNIFIED;
@@ -130,7 +131,7 @@ init_config(struct cfg *cf, int argc, char **argv)
     if (getrlimit(RLIMIT_NOFILE, &(cf->stable.nofile_limit)) != 0)
 	err(1, "getrlimit");
 
-    while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:T:L:m:M:u:Fin:Pad:")) != -1)
+    while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:T:L:m:M:u:Fin:Pad:X")) != -1)
 	switch (ch) {
 	case 'f':
 	    cf->stable.nodaemon = 1;
@@ -293,7 +294,9 @@ init_config(struct cfg *cf, int argc, char **argv)
 	    if (cf->stable.log_level == -1)
 		errx(1, "%s: invalid log level", optarg);
 	    break;
-
+	case 'X':
+	    cf->stable.multisession_detect = 1;
+	    break;
 	case '?':
 	default:
 	    usage();
@@ -646,7 +649,7 @@ send_packet(struct cfg *cf, struct rtpp_session *sp, int ridx,
 static void
 process_rtp(struct cfg *cf, double dtime, int alarm_tick)
 {
-    int readyfd, skipfd, ridx;
+    int readyfd, skipfd, ridx, checkfd, cttl;
     struct rtpp_session *sp;
     struct rtp_packet *packet;
 
@@ -657,7 +660,16 @@ process_rtp(struct cfg *cf, double dtime, int alarm_tick)
 
 	if (alarm_tick != 0 && sp != NULL && sp->rtcp != NULL &&
 	  sp->sidx[0] == readyfd) {
-	    if (get_ttl(sp) == 0) {
+	    if ( cf->stable.multisession_detect == 1 ) {
+		for (checkfd = 0; checkfd < cf->nsessions; checkfd++) {
+		    if ( strcmp( cf->sessions[checkfd]->call_id, cf->sessions[readyfd]->call_id) == 0 ) {
+			cttl += get_ttl(cf->sessions[checkfd]);
+		    }
+		}
+	    } else {
+		cttl = get_ttl(sp);
+	    }
+	    if (cttl == 0) {
 		rtpp_log_write(RTPP_LOG_INFO, sp->log, "session timeout");
 		rtpp_notify_schedule(cf, sp);
 		remove_session(cf, sp);
diff --git a/rtpp_defines.h b/rtpp_defines.h
index 44eddc8..72973b6 100644
--- a/rtpp_defines.h
+++ b/rtpp_defines.h
@@ -89,6 +89,7 @@ struct cfg {
         int port_min;		/* Lowest UDP port for RTP */
         int port_max;		/* Highest UDP port number for RTP */
         int max_ttl;
+        int multisession_detect;	/* Timeout detection checks all sessions of a call */
         /*
          * The first address is for external interface, the second one - for
          * internal one. Second can be NULL, in this case there is no bridge
_______________________________________________
Devel mailing list
[email protected]
http://lists.rtpproxy.org/mailman/listinfo/devel

Reply via email to