Module: sip-router Branch: master Commit: 7f0cdd239d24bc5a81aa4d9ca679eb29cd3e4ffe URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7f0cdd23...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Sat Apr 17 13:06:13 2010 +0200
tm: branch selection for failure_route controlled by param
- replaced cfg compat mode controlling of branch reply selection for failure_ route with a parameter: failure_reply_mode - default value: 0 - keep all branches, use t_drop_replies() for controlling per transaction in failure_route (default behavior of ser 2.1.x) 1 - drop all branches 2 - drop branches of last serial forking step 3 - automatically drop old branches when a new serial forking step is initiated (default kamailio 1.5.x behaviour)
---
modules/tm/t_reply.c | 15 +++++++++++---- modules/tm/t_reply.h | 2 ++ modules/tm/tm.c | 1 + 3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 4415294..9ad1d0e 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -174,6 +174,16 @@ static int goto_on_reply=0; /* where to go on receipt of reply without transaction context */ int goto_on_sl_reply=0;
+/* how to deal with winning branch reply selection in failure_route + * can be overwritten per transaction with t_drop_replies(...) + * Values: + * - 0 - all branches are kept (default, and default ser 2.1.x behaviour) + * - 1 - all branches are discarded + * - 2 - braches of last step of serial forking are discarded + * - 3 - all branches are discarded if a new leg of serial forking + * is started (default kamailio 1.5.x behaviour) + */ +int failure_reply_mode = 0;
/* responses priority (used by t_pick_branch) * 0xx is used only for the initial value (=> should have no chance to be @@ -1158,10 +1168,7 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code, Trans->flags&=~T_6xx; /* clear the 6xx flag , we want to allow new branches from the failure route */
- if(sr_cfg_compat==SR_COMPAT_KAMAILIO) - drop_replies = 3; - else - drop_replies = 0; + drop_replies = failure_reply_mode; replies_dropped = 0; /* run ON_FAILURE handlers ( route and callbacks) */ if (unlikely(has_tran_tmcbs( Trans, TMCB_ON_FAILURE_RO|TMCB_ON_FAILURE) diff --git a/modules/tm/t_reply.h b/modules/tm/t_reply.h index 7ea9dc8..b798fa1 100644 --- a/modules/tm/t_reply.h +++ b/modules/tm/t_reply.h @@ -58,6 +58,8 @@ extern char *tm_tag_suffix;
extern int goto_on_sl_reply;
+extern int failure_reply_mode; + /* has this to-tag been never seen in previous 200/INVs? */ int unmatched_totag(struct cell *t, struct sip_msg *ack);
diff --git a/modules/tm/tm.c b/modules/tm/tm.c index 34a9e9f..28687e6 100644 --- a/modules/tm/tm.c +++ b/modules/tm/tm.c @@ -535,6 +535,7 @@ static param_export_t params[]={ {"contacts_avp", PARAM_STRING, &contacts_avp_param }, {"disable_6xx_block", PARAM_INT, &default_tm_cfg.disable_6xx }, {"local_ack_mode", PARAM_INT, &default_tm_cfg.local_ack_mode }, + {"failure_reply_mode", PARAM_INT, &failure_reply_mode }, {0,0,0} };