Module: kamailio
Branch: master
Commit: 92abd0c014b12442a866f824617105cd93e3d72f
URL: 
https://github.com/kamailio/kamailio/commit/92abd0c014b12442a866f824617105cd93e3d72f

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-06-20T11:31:51+02:00

tm: added module parameter evlreq_mode

- if bit 1 set (value 1), event_route[tm:local-request] is also
executed for hop-by-hop CANCEL requests (for received INVITEs,
not only for local generated ones)

---

Modified: src/modules/tm/config.h
Modified: src/modules/tm/t_cancel.c
Modified: src/modules/tm/tm.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/92abd0c014b12442a866f824617105cd93e3d72f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/92abd0c014b12442a866f824617105cd93e3d72f.patch

---

diff --git a/src/modules/tm/config.h b/src/modules/tm/config.h
index 18081d60983..dd9c13c77f8 100644
--- a/src/modules/tm/config.h
+++ b/src/modules/tm/config.h
@@ -88,6 +88,9 @@
 #define CANCEL_DONE "ok -- no more pending branches"
 #define CANCELED "Request canceled"
 
+/* execute event_route[tm:local-request] for hop-by-hop CANCEL */
+#define TM_EVLREQ_CANCEL_HBH 1
+
 /* to-tag separator for stateful processing */
 #define TM_TAG_SEPARATOR '-'
 
diff --git a/src/modules/tm/t_cancel.c b/src/modules/tm/t_cancel.c
index e3114c70d0e..dcf833ab99b 100644
--- a/src/modules/tm/t_cancel.c
+++ b/src/modules/tm/t_cancel.c
@@ -40,6 +40,7 @@
 
 
 extern str tm_event_callback;
+extern int _tm_evlreq_mode;
 
 typedef struct cancel_reason_map
 {
@@ -338,7 +339,7 @@ int cancel_branch(struct cell *t, int branch, sip_msg_t 
*cancel_msg,
 
        LM_DBG("sending cancel...\n");
 
-       if(flags & F_CANCEL_LOCAL) {
+       if((flags & F_CANCEL_LOCAL) || (_tm_evlreq_mode & 
TM_EVLREQ_CANCEL_HBH)) {
                /* Call event */
                rt = -1;
                if(tm_event_callback.s == NULL || tm_event_callback.len <= 0) {
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index b33c66f63fc..1e7fe8cb551 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -230,6 +230,7 @@ str _tm_event_callback_lres_sent = {NULL, 0};
 int _tm_reply_408_code = 408;
 str _tm_reply_408_reason = str_init("Request Timeout");
 int _tm_delayed_reply = 1;
+int _tm_evlreq_mode = 0;
 
 #ifdef USE_DNS_FAILOVER
 str failover_reply_codes_str = {NULL, 0};
@@ -530,6 +531,7 @@ static param_export_t params[] = {
        {"reply_408_code", PARAM_INT, &_tm_reply_408_code},
        {"reply_408_reason", PARAM_STR, &_tm_reply_408_reason},
        {"delayed_reply", PARAM_INT, &_tm_delayed_reply},
+       {"evlreq_mode", PARAM_INT, &_tm_evlreq_mode},
        {0, 0, 0}
 };
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to