[sr-dev] git:sr_3.0: tm: onreply_route: fix cleanup after DROP

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Mar 4 10:25:53 CET 2010


Module: sip-router
Branch: sr_3.0
Commit: af9cbb358ba104e12bd5f8cec2e5ff117d57f1b2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=af9cbb358ba104e12bd5f8cec2e5ff117d57f1b2

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Feb 22 18:01:26 2010 +0100

tm: onreply_route: fix cleanup after DROP

After a DROP in the onreply_route the avp lists where not restored
to their original values and the possible msg flags changes in the
script were dropped.

(cherry-picked from commit ba15378ef66a11d3cbd6862aa2bfb060d099ca03)

---

 modules/tm/t_reply.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index ff89dd4..e13acbb 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -2020,13 +2020,6 @@ int reply_received( struct sip_msg  *p_msg )
 		LOCK_REPLIES( t );
 		replies_locked=1;
 		run_top_route(onreply_rt.rlist[t->on_reply], p_msg, &ctx);
-		if ((ctx.run_flags&DROP_R_F)  && (msg_status<200)) {
-			if (unlikely(replies_locked)) {
-				replies_locked = 0;
-				UNLOCK_REPLIES( t );
-			}
-			goto done;
-		}
 		/* transfer current message context back to t */
 		if (t->uas.request) t->uas.request->flags=p_msg->flags;
 		getbflagsval(0, &uac->branch_flags);
@@ -2038,6 +2031,16 @@ int reply_received( struct sip_msg  *p_msg )
 		set_avp_list( AVP_TRACK_TO | AVP_CLASS_USER, backup_user_to );
 		set_avp_list( AVP_TRACK_FROM | AVP_CLASS_DOMAIN, backup_domain_from );
 		set_avp_list( AVP_TRACK_TO | AVP_CLASS_DOMAIN, backup_domain_to );
+		/* handle a possible DROP in the script, but only if this
+		   is not a final reply (final replies already stop the timers
+		   and droping them might leave a transaction living forever) */
+		if ((ctx.run_flags&DROP_R_F)  && (msg_status<200)) {
+			if (unlikely(replies_locked)) {
+				replies_locked = 0;
+				UNLOCK_REPLIES( t );
+			}
+			goto done;
+		}
 	}
 #ifdef USE_DST_BLACKLIST
 		/* add temporary to the blacklist the source of a 503 reply */




More information about the sr-dev mailing list