[sr-dev] git:kamailio_3.0: tm: added drop functionality for branch_route

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 15 11:05:10 CEST 2010


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Apr 15 11:02:06 2010 +0200

tm: added drop functionality for branch_route

- missing part of K integration
- credits to Andreas Granig for reporting and testing
(cherry picked from commit d592824b6e1b0d31a0d4fff28d003cc4c3c878bc)

---

 modules/tm/t_fwd.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index 1e9644d..b704426 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -204,6 +204,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	snd_flags_t rpl_snd_flags_bak;
 	struct socket_info *force_send_socket_bak;
 	struct dest_info *dst;
+	struct run_act_ctx ctx;
 
 	shbuf=0;
 	ret=E_UNSPEC;
@@ -333,7 +334,8 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 				/* set the new values */
 				i_req->fwd_send_flags=snd_flags /* intial value  */;
 				set_force_socket(i_req, fsocket);
-				if (run_top_route(branch_rt.rlist[branch_route], i_req, 0) < 0)
+				if (run_top_route(branch_rt.rlist[branch_route], i_req, &ctx)
+						< 0)
 				{
 					LOG(L_ERR, "Error in run_top_route\n");
 				}
@@ -345,6 +347,13 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 				i_req->fwd_send_flags=fwd_snd_flags_bak;
 				i_req->rpl_send_flags=rpl_snd_flags_bak;
 				exec_post_script_cb(i_req, BRANCH_CB_TYPE);
+				/* if DROP was called in cfg, don't forward, jump to end */
+				if (unlikely(ctx.run_flags&DROP_R_F))
+				{
+					tm_ctx_set_branch_index(0);
+					set_route_type(backup_route_type);
+					goto error03;
+				}
 			}
 			tm_ctx_set_branch_index(0);
 			set_route_type(backup_route_type);




More information about the sr-dev mailing list