[SR-Users] 477 Unfortunately error on sending to next hop occurred

Daniel-Constantin Mierla miconda at gmail.com
Fri Aug 23 19:42:21 CEST 2013


Can you try the new patch attached?

I overlooked that the code where to skip sending the reply was in 
between some #ifdef ... #else ... #endif and I did it only for the #else 
branch, but actually the #ifdef was enabled by compile.

You have to apply the patch on clean sources.

Daniel

On 8/23/13 3:01 PM, Steve Davies wrote:
>
>
>
> On 23 August 2013 14:56, Daniel-Constantin Mierla <miconda at gmail.com 
> <mailto:miconda at gmail.com>> wrote:
>
>     I'll check the logs and most probably have to do some test myself,
>     but it's going to take a bit.
>
>
> No prob, I'll come back to it later.
>
> Steve

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130823/df4d24f1/attachment.html>
-------------- next part --------------
diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index f30bd45..d13cd9b 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -299,6 +299,8 @@ struct totag_elem {
 #	define pass_provisional(_t_)	((_t_)->flags&T_PASS_PROVISIONAL_FLAG)
 #endif
 
+#define T_DISABLE_INTERNAL_REPLY (1<<12) /* don't send internal negative reply */
+
 /* unsigned short should be enough for a retr. timer: max. 65535 ms =>
  * max retr. = 65 s which should be enough and saves us 2*2 bytes */
 typedef unsigned short retr_timeout_t;
diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c
index e9d9598..729b537 100644
--- a/modules/tm/t_funcs.c
+++ b/modules/tm/t_funcs.c
@@ -358,6 +358,15 @@ handle_ret:
 		/* we don't want to pass upstream any reply regarding replicating
 		 * a request; replicated branch must stop at us*/
 		if (likely(!replicate)) {
+			if(t->flags&T_DISABLE_INTERNAL_REPLY) {
+				/* flag set to don't generate the internal negative reply
+				 * - let the transaction live further, processing should
+				 *   continue in config */
+				DBG("not generating immediate reply for error %d\n", ser_error);
+				tm_error=ser_error;
+				ret = -4;
+				goto done;
+			}
 #ifdef TM_DELAYED_REPLY
 			/* current error in tm_error */
 			tm_error=ser_error;
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index a1ca634..6b03081 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -289,6 +289,7 @@ static int t_set_disable_failover(struct sip_msg* msg, char* on_off, char* f);
 static int t_set_no_e2e_cancel_reason(struct sip_msg* msg, char* on_off,
 										char* f);
 #endif /* CANCEL_REASON_SUPPORT */
+static int t_set_disable_internal_reply(struct sip_msg* msg, char* on_off, char* f);
 static int t_branch_timeout(struct sip_msg* msg, char*, char*);
 static int t_branch_replied(struct sip_msg* msg, char*, char*);
 static int t_any_timeout(struct sip_msg* msg, char*, char*);
@@ -448,6 +449,8 @@ static cmd_export_t cmds[]={
 		fixup_var_int_1,
 			REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
 #endif /* CANCEL_REASON_SUPPORT */
+	{"t_set_disable_internal_reply", t_set_disable_internal_reply, 1, fixup_var_int_1,
+			REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
 	{"t_branch_timeout",  t_branch_timeout,         0, 0,  FAILURE_ROUTE},
 	{"t_branch_replied",  t_branch_replied,         0, 0,  FAILURE_ROUTE},
 	{"t_any_timeout",     t_any_timeout,            0, 0, 
@@ -1827,6 +1830,10 @@ T_SET_FLAG_GEN_FUNC(t_set_no_e2e_cancel_reason, T_NO_E2E_CANCEL_REASON)
 #endif /* CANCEL_REASON_SUPPORT */
 
 
+/* disable internal negative reply for the current transaction */
+T_SET_FLAG_GEN_FUNC(t_set_disable_internal_reply, T_DISABLE_INTERNAL_REPLY)
+
+
 /* script function, FAILURE_ROUTE only, returns true if the 
  * choosed "failure" branch failed because of a timeout, 
  * -1 otherwise */
@@ -2220,13 +2227,11 @@ inline static int w_t_relay_to(struct sip_msg *msg, char *proxy, char *flags)
 			param.v.i = 0;
 			t_set_auto_inv_100(msg, (char*)(&param), 0);
 		}
-		/* no auto negative reply - not implemented */
-		/*
+		/* no auto negative reply */
 		if(fl&2) {
 			param.v.i = 1;
-			t_set_disable_internal_reply(msg, (char*)param, 0);
+			t_set_disable_internal_reply(msg, (char*)(&param), 0);
 		}
-		*/
 		/* no dns failover */
 		if(fl&4) {
 			param.v.i = 1;


More information about the sr-users mailing list