Browse Source

tm: support for disabling 6xx special handling

Added disable_6xx_block (same name as in kamailio), which when set
will cause the 6xx to be treated like a normal reply (breaking the
rfc). Default is off.
It can be set also at runtime, e.g.:
sercmd cfg.set_now_int tm disable_6xx_block 1
Andrei Pelinescu-Onciul 16 years ago
parent
commit
77e7d5164d
4 changed files with 9 additions and 2 deletions
  1. 5 1
      modules/tm/config.c
  2. 1 0
      modules/tm/config.h
  3. 2 1
      modules/tm/t_reply.c
  4. 1 0
      modules/tm/tm.c

+ 5 - 1
modules/tm/config.c

@@ -90,7 +90,9 @@ struct cfg_group_tm	default_tm_cfg = {
 			 * for every method except BYE by default */
 	1,	/* cancel_b_method used for e2e and 6xx cancels*/
 	1,	/* reparse_on_dns_failover */
-	INV_FR_TIME_OUT_NEXT
+	INV_FR_TIME_OUT_NEXT, /* fr_inv_timeout_next -> for serial forking subseq.
+							 branches */
+	0 /* disable_6xx, by default off */
 };
 
 void	*tm_cfg = &default_tm_cfg;
@@ -182,5 +184,7 @@ cfg_def_t	tm_cfg_def[] = {
 		"branch instead of from the received request"},
 	{"fr_inv_timer_next",	CFG_VAR_INT,	0, 0, timer_fixup, 0,
 		"The value of fr_inv_timer for subsequent branches during serial forking"},
+	{"disable_6xx_block",	CFG_VAR_INT | CFG_ATOMIC,	0, 1, 0, 0,
+		"if set to 1, 6xx is treated like a normal reply (breaks rfc)"},
 	{0, 0, 0, 0, 0, 0}
 };

+ 1 - 0
modules/tm/config.h

@@ -134,6 +134,7 @@ struct cfg_group_tm {
 	unsigned int	cancel_b_flags;
 	int	reparse_on_dns_failover;
 	unsigned int fr_inv_timeout_next;
+	int disable_6xx;
 };
 
 extern struct cfg_group_tm	default_tm_cfg;

+ 2 - 1
modules/tm/t_reply.c

@@ -1086,7 +1086,8 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code,
 		if (picked_branch==-2) { /* branches open yet */
 			*should_store=1;
 			*should_relay=-1;
-			if (new_code>=600 && new_code<=699){
+			if (new_code>=600 && new_code<=699 &&
+					!cfg_get(tm, tm_cfg, disable_6xx)){
 				if (!(Trans->flags & T_6xx)){
 					/* cancel only the first time we get a 6xx */
 					prepare_to_cancel(Trans, cancel_bitmap, 0);

+ 1 - 0
modules/tm/tm.c

@@ -463,6 +463,7 @@ static param_export_t params[]={
 	{"on_sl_reply",         PARAM_STRING|PARAM_USE_FUNC, fixup_on_sl_reply   },
 	{"fr_inv_timer_next",   PARAM_INT, &default_tm_cfg.fr_inv_timeout_next   },
 	{"contacts_avp",        PARAM_STRING, &contacts_avp_param                },
+	{"disable_6xx_block",   PARAM_INT, &default_tm_cfg.disable_6xx           },
 	{0,0,0}
 };