Browse code

tm: added drop functionality for branch_route

- missing part of K integration
- credits to Andreas Granig for reporting and testing

Daniel-Constantin Mierla authored on 15/04/2010 09:02:06
Showing 1 changed files
... ...
@@ -204,6 +204,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
204 204
 	snd_flags_t rpl_snd_flags_bak;
205 205
 	struct socket_info *force_send_socket_bak;
206 206
 	struct dest_info *dst;
207
+	struct run_act_ctx ctx;
207 208
 
208 209
 	shbuf=0;
209 210
 	ret=E_UNSPEC;
... ...
@@ -333,7 +334,8 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
333 333
 				/* set the new values */
334 334
 				i_req->fwd_send_flags=snd_flags /* intial value  */;
335 335
 				set_force_socket(i_req, fsocket);
336
-				if (run_top_route(branch_rt.rlist[branch_route], i_req, 0) < 0)
336
+				if (run_top_route(branch_rt.rlist[branch_route], i_req, &ctx)
337
+						< 0)
337 338
 				{
338 339
 					LOG(L_ERR, "Error in run_top_route\n");
339 340
 				}
... ...
@@ -345,6 +347,13 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
345 345
 				i_req->fwd_send_flags=fwd_snd_flags_bak;
346 346
 				i_req->rpl_send_flags=rpl_snd_flags_bak;
347 347
 				exec_post_script_cb(i_req, BRANCH_CB_TYPE);
348
+				/* if DROP was called in cfg, don't forward, jump to end */
349
+				if (unlikely(ctx.run_flags&DROP_R_F))
350
+				{
351
+					tm_ctx_set_branch_index(0);
352
+					set_route_type(backup_route_type);
353
+					goto error03;
354
+				}
348 355
 			}
349 356
 			tm_ctx_set_branch_index(0);
350 357
 			set_route_type(backup_route_type);