Module: sip-router
Branch: andrei/cancel_reason
Commit: 8165147e32e08032cc20826c8dfad2757d8558d0
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8165147…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Aug 13 21:39:03 2010 +0200
tm: no reason modparams if compiled with no cancelr. support
Don't register cancel_reason modparams and script functions if
compiled with -DNO_CANCEL_REASON_SUPPORT.
---
modules/tm/h_table.h | 2 ++
modules/tm/t_lookup.c | 2 ++
modules/tm/tm.c | 8 ++++++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index 6622e8c..03f587b 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -284,7 +284,9 @@ struct totag_elem {
#define T_DISABLE_6xx (1<<8) /* treat 6xx as a normal reply */
#define T_DISABLE_FAILOVER (1<<9) /* don't perform dns failover */
+#ifdef CANCEL_REASON_SUPPORT
#define T_NO_E2E_CANCEL_REASON (1<<10) /* don't propagate CANCEL Reason */
+#endif /* CANCEL_REASON_SUPPORT */
#define T_DONT_FORK (T_CANCELED|T_6xx)
/* unsigned short should be enough for a retr. timer: max. 65535 ticks =>
diff --git a/modules/tm/t_lookup.c b/modules/tm/t_lookup.c
index 01f6a82..3a15580 100644
--- a/modules/tm/t_lookup.c
+++ b/modules/tm/t_lookup.c
@@ -1265,8 +1265,10 @@ static inline void init_new_t(struct cell *new_cell, struct sip_msg
*p_msg)
(!cfg_get(tm, tm_cfg, tm_auto_inv_100) -1);
new_cell->flags|=T_DISABLE_6xx &
(!cfg_get(tm, tm_cfg, disable_6xx) -1);
+#ifdef CANCEL_REASON_SUPPORT
new_cell->flags|=T_NO_E2E_CANCEL_REASON &
(!!cfg_get(tm, tm_cfg, e2e_cancel_reason) -1);
+#endif /* CANCEL_REASON_SUPPORT */
/* reset flags */
new_cell->flags &=
(~ get_msgid_val(user_cell_reset_flags, p_msg->id, int));
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 221be3b..6dff2ca 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -284,8 +284,10 @@ static int w_t_reset_max_lifetime(struct sip_msg* msg, char* foo,
char* bar);
static int t_set_auto_inv_100(struct sip_msg* msg, char* on_off, char* foo);
static int t_set_disable_6xx(struct sip_msg* msg, char* on_off, char* foo);
static int t_set_disable_failover(struct sip_msg* msg, char* on_off, char* f);
+#ifdef CANCEL_REASON_SUPPORT
static int t_set_no_e2e_cancel_reason(struct sip_msg* msg, char* on_off,
char* f);
+#endif /* CANCEL_REASON_SUPPORT */
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*);
@@ -431,6 +433,7 @@ static cmd_export_t cmds[]={
REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
{"t_set_disable_failover", t_set_disable_failover, 1, fixup_var_int_1,
REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
+#ifdef CANCEL_REASON_SUPPORT
{"t_set_no_e2e_cancel_reason", t_set_no_e2e_cancel_reason, 1,
fixup_var_int_1,
REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
@@ -438,6 +441,7 @@ static cmd_export_t cmds[]={
{"t_disable_e2e_cancel_reason", t_set_no_e2e_cancel_reason, 1,
fixup_var_int_1,
REQUEST_ROUTE|TM_ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE },
+#endif /* CANCEL_REASON_SUPPORT */
{"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,
@@ -545,8 +549,10 @@ 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
},
+#ifdef CANCEL_REASON_SUPPORT
{"local_cancel_reason", PARAM_INT, &default_tm_cfg.local_cancel_reason
},
{"e2e_cancel_reason", PARAM_INT, &default_tm_cfg.e2e_cancel_reason
},
+#endif /* CANCEL_REASON_SUPPORT */
{0,0,0}
};
@@ -1748,8 +1754,10 @@ T_SET_FLAG_GEN_FUNC(t_set_disable_6xx, T_DISABLE_6xx)
T_SET_FLAG_GEN_FUNC(t_set_disable_failover, T_DISABLE_FAILOVER)
+#ifdef CANCEL_REASON_SUPPORT
/* disable/enable e2e cancel reason copy for the current transaction */
T_SET_FLAG_GEN_FUNC(t_set_no_e2e_cancel_reason, T_NO_E2E_CANCEL_REASON)
+#endif /* CANCEL_REASON_SUPPORT */
/* script function, FAILURE_ROUTE only, returns true if the