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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Fri Aug 23 20:53:55 2013 +0200

tm: re-added the option for no-internal reply on error

- new function t_set_disable_internal_reply(0|1) to disable|enable this
  option per transaction
- t_relay_to() flags re-enabled for this option

---

 modules/tm/h_table.h |    2 ++
 modules/tm/t_funcs.c |   10 ++++++++++
 modules/tm/tm.c      |   13 +++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index e260d7e..3b71801 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -310,6 +310,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..531f4bd 100644
--- a/modules/tm/t_funcs.c
+++ b/modules/tm/t_funcs.c
@@ -358,12 +358,22 @@ 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;
                        set_kr(REQ_ERR_DELAYED);
                        DBG("%d error reply generation delayed \n", ser_error);
 #else
+
                        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 5b410c1..7df7ade 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -291,6 +291,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*);
@@ -456,6 +457,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|EVENT_ROUTE},
        {"t_branch_replied",  t_branch_replied,         0, 0,
@@ -1873,6 +1876,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 and BRANCH_FAILURE_ROUTE only,
  * returns true if the choosed "failure" branch failed because of a timeout, 
  * -1 otherwise */
@@ -2282,13 +2289,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;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to