[sr-dev] git:tmp/k3.0_sr_backports: core: drop reply in K compatible style

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Feb 1 12:32:30 CET 2010


Module: sip-router
Branch: tmp/k3.0_sr_backports
Commit: 05589c01cfe7665439f1b6f1c53c27d12e1900e0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=05589c01cfe7665439f1b6f1c53c27d12e1900e0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Oct 29 11:28:20 2009 +0100

core: drop reply in K compatible style

- drop reply in default onreply_route when using 'drop'

---

 receive.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/receive.c b/receive.c
index 579a6c2..df8f11f 100644
--- a/receive.c
+++ b/receive.c
@@ -91,6 +91,7 @@ unsigned int inc_msg_no(void)
 int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info) 
 {
 	struct sip_msg* msg;
+	struct run_act_ctx ctx;
 	int ret;
 #ifdef STATS
 	int skipped = 1;
@@ -228,13 +229,17 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
 		/* exec the onreply routing script */
 		if (onreply_rt.rlist[DEFAULT_RT]){
 			set_route_type(ONREPLY_ROUTE);
-			ret=run_top_route(onreply_rt.rlist[DEFAULT_RT], msg, 0);
+			ret=run_top_route(onreply_rt.rlist[DEFAULT_RT], msg, &ctx);
+#if 0
 			if (ret<0){
 				LOG(L_WARN, "WARNING: receive_msg: "
 						"error while trying onreply script\n");
 				goto error_rpl;
-			}else if (ret==0) goto skip_send_reply; /* drop the message, 
-													   no error */
+			}else
+#endif
+			if (ctx.run_flags&DROP_R_F){
+				goto skip_send_reply; /* drop the message, no error */
+			}
 		}
 		/* send the msg */
 		forward_reply(msg);
@@ -264,11 +269,13 @@ end:
 	if (skipped) STATS_RX_DROPS;
 #endif
 	return 0;
+#if 0
 error_rpl:
 	/* execute post reply-script callbacks */
 	exec_post_script_cb(msg, ONREPLY_CB_TYPE);
 	reset_avps();
 	goto error02;
+#endif
 error_req:
 	DBG("receive_msg: error:...\n");
 	/* execute post request-script callbacks */




More information about the sr-dev mailing list