Module: kamailio
Branch: master
Commit: d3f25a5dd0139677a66792141fff075475085a03
URL:
https://github.com/kamailio/kamailio/commit/d3f25a5dd0139677a66792141fff075…
Author: Stefan Mititelu <stefan-cristian.mititelu(a)1and1.ro>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-10T10:46:04+01:00
tm: Add enable_uac_fr modparam
---
Modified: src/modules/tm/config.c
Modified: src/modules/tm/config.h
Modified: src/modules/tm/doc/params.xml
Modified: src/modules/tm/tm.c
Modified: src/modules/tm/uac.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d3f25a5dd0139677a66792141fff075…
Patch:
https://github.com/kamailio/kamailio/commit/d3f25a5dd0139677a66792141fff075…
---
diff --git a/src/modules/tm/config.c b/src/modules/tm/config.c
index 3bfd007ba0..5c5ea58590 100644
--- a/src/modules/tm/config.c
+++ b/src/modules/tm/config.c
@@ -95,7 +95,8 @@ struct cfg_group_tm default_tm_cfg = {
CANCELs; on by default */
1, /* e2e_cancel_reason -- copy the Reason headers from incoming CANCELs
into the corresp. hop-by-hop CANCELs, on by default */
- 0 /* relay_100 -- by default, assume stateful proxy and do not relay SIP 100 */
+ 0, /* relay_100 -- by default, assume stateful proxy and do not relay SIP 100 */
+ 0 /* enable_uac_fr */
};
void *tm_cfg = &default_tm_cfg;
@@ -206,5 +207,7 @@ cfg_def_t tm_cfg_def[] = {
" the corresponding generated hop-by-hop CANCELs"},
{"relay_100", CFG_VAR_INT | CFG_ATOMIC, 0, 1, 0, 0,
"if set to 1, relay SIP 100 messages as a stateless proxy"},
+ {"enable_uac_fr", CFG_VAR_INT | CFG_ATOMIC, 0, 1, 0, 0,
+ "if set, enables failure route for UAC messages"},
{0, 0, 0, 0, 0, 0}
};
diff --git a/src/modules/tm/config.h b/src/modules/tm/config.h
index 17be5416a6..47f05e0c4c 100644
--- a/src/modules/tm/config.h
+++ b/src/modules/tm/config.h
@@ -130,6 +130,7 @@ struct cfg_group_tm {
int local_cancel_reason;
int e2e_cancel_reason;
unsigned int relay_100;
+ int enable_uac_fr;
};
extern struct cfg_group_tm default_tm_cfg;
diff --git a/src/modules/tm/doc/params.xml b/src/modules/tm/doc/params.xml
index ee305b891c..3f67ae3f4d 100644
--- a/src/modules/tm/doc/params.xml
+++ b/src/modules/tm/doc/params.xml
@@ -1607,4 +1607,20 @@ modparam("tm", "reply_relay_mode", 0)
</example>
</section>
+ <section id="tm.p.enable_uac_fr">
+ <title><varname>enable_uac_fr</varname> (int)</title>
+ <para>
+ Enable failure route trigger, for uac. This will copy the tm uac into uas.
+ Thus, failure route can be triggered even for uac messages.
+ </para>
+ <example>
+ <title>enable_uac_fr example</title>
+ <programlisting>
+...
+modparam("tm", "enable_uac_fr", 1)
+....
+ </programlisting>
+ </example>
+ </section>
+
</section>
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index d8fc7caa19..69defa1f26 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -486,6 +486,7 @@ static param_export_t params[]={
{"event_callback_lres_sent", PARAM_STR, &_tm_event_callback_lres_sent
},
{"exec_time_check" , PARAM_INT, &tm_exec_time_check_param
},
{"reply_relay_mode", PARAM_INT, &tm_reply_relay_mode
},
+ {"enable_uac_fr", PARAM_INT, &default_tm_cfg.enable_uac_fr
},
{0,0,0}
};
diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 7dfcefb6ea..b7be8e3b38 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -548,7 +548,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
#ifdef USE_DNS_FAILOVER
/* Set the outgoing message as UAS, so the failover code has something to work with */
- if(cfg_get(core, core_cfg, use_dns_failover)) {
+ if(cfg_get(core, core_cfg, use_dns_failover) || cfg_get(tm, tm_cfg, enable_uac_fr)) {
if(likely(t_build_msg_from_buf(&lreq, buf, buf_len, uac_r, &dst) == 0)) {
if (parse_headers(&lreq, HDR_EOH_F, 0) == -1) {
LM_ERR("failed to parse headers on uas for failover\n");