Hello,
it seems that the flag not to generate the internal reply was lost when
adopting the new ser tm module.
Can you try the attached patch on 4.0.x?
Once applied and kamailio reinstalled, before t_relay() use:
t_disable_internal_reply();
An the return code should be -4 in this case.
Let me know if works and I will push the fixes in the git repo, with
updates to docs.
Cheers,
Daniel
On 8/23/13 12:13 PM, Steve Davies wrote:
On 23 August 2013 11:18, Steve Davies <st...@connection-telecom.com
<mailto:st...@connection-telecom.com>> wrote:
Here's what I put in RELAY route block:
$var(rr) = t_relay();
xlog("L_NOTICE","SLD: in RELAY, t_relay returned $var(rr)\n");
if (!$var(rr)) {
sl_reply_error();
}
In 4.0.3, t_relay gives a -1 in the case that there is a physical
network issue (in my test I have a "-j DROP" iptables rule)
Trying to find a way to detect the case where t_relay fails but
doesn't call the failure block. I dumped some hopeful looking pseudo
variables, and tried to use an avp to communicate from the failure
branch back to the relay point.
I tried this:
$avp(senttoast) = 0;
$var(rr) = t_relay();
xlog("L_NOTICE","SLD: in RELAY, t_relay returned $var(rr)
err.rcode is $err.rcode t_r_c is $T_reply_code sent = $avp(senttoast)\n");
if ($var(rr) < 0) {
sl_reply_error();
}
and in my failure block I set $avp(senttoast) to 1.
I get:
Aug 23 12:07:02 ubuntu /usr/local/sbin/kamailio[7819]: NOTICE:
<script>: SLD: in RELAY, t_relay returned -1 err.rcode is <null> t_r_c
is 100 sent = 0
In the case of a 477 being sent back. So I can't find anything
distinctive so far.
In the case of a soft failure (I have the upstream send a 500):
Aug 23 12:09:32 ubuntu /usr/local/sbin/kamailio[7817]: NOTICE:
<script>: SLD: in RELAY, t_relay returned 1 err.rcode is <null> t_r_c
is 100 sent = 0
So the same.
From the trace I can see that the failure block is only executed after
the t_relay returns. The failure block runs on a different pid.
So there is a race. Or maybe the avp doesn't work across branches or
something?
Clues would be welcome!
Steve
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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..1652cb3 100644
--- a/modules/tm/t_funcs.c
+++ b/modules/tm/t_funcs.c
@@ -364,6 +364,14 @@ handle_ret:
set_kr(REQ_ERR_DELAYED);
DBG("%d error reply generation delayed \n", ser_error);
#else
+ 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 */
+ ret = -4;
+ goto done;
+ }
+
reply_ret=kill_transaction( t, ser_error );
if (reply_ret>0) {
/* we have taken care of all -- do nothing in
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*)(¶m), 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*)(¶m), 0);
}
- */
/* no dns failover */
if(fl&4) {
param.v.i = 1;
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users