[sr-dev] git:master:a770c495: dialog: added modparam dlg_ctxiuid_mode to control when iuid is set

Daniel-Constantin Mierla miconda at gmail.com
Fri Aug 26 12:11:46 CEST 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-08-26T11:24:30+02:00

dialog: added modparam dlg_ctxiuid_mode to control when iuid is set

---

Modified: src/modules/dialog/dialog.c
Modified: src/modules/dialog/dlg_handlers.c

---

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

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 8eb9f78eec..83a10b3b56 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -154,6 +154,7 @@ str dlg_xavp_cfg = {0};
 int dlg_ka_timer = 0;
 int dlg_ka_interval = 0;
 int dlg_clean_timer = 90;
+int dlg_ctxiuid_mode = 0;
 
 str dlg_lreq_callee_headers = {0};
 
@@ -361,6 +362,8 @@ static param_export_t mod_params[]={
 	{ "dlg_filter_mode",       INT_PARAM, &dlg_filter_mode          },
 	{ "bye_early_code",        PARAM_INT, &bye_early_code           },
 	{ "bye_early_reason",      PARAM_STR, &bye_early_reason         },
+	{ "dlg_ctxiuid_mode",      PARAM_INT, &dlg_ctxiuid_mode         },
+
 	{ 0,0,0 }
 };
 
diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c
index 794aa7c7d2..81525de21b 100644
--- a/src/modules/dialog/dlg_handlers.c
+++ b/src/modules/dialog/dlg_handlers.c
@@ -72,6 +72,7 @@ extern int       dlg_event_rt[DLG_EVENTRT_MAX];
 extern int       dlg_wait_ack;
 extern int       dlg_enable_dmq;
 extern int       dlg_filter_mode;
+extern int       dlg_ctxiuid_mode;
 int              spiral_detected = -1;
 
 extern struct rr_binds d_rrb;		/*!< binding to record-routing module */
@@ -91,6 +92,9 @@ static unsigned int CURR_DLG_ID  = 0xffffffff;	/*!< current dialog id */
 /*! separator inside the record-route paramter */
 #define DLG_SEPARATOR      '.'
 
+/*! flags for dlg_ctxiuid */
+#define DLG_CTXIUID_MODE_CANCEL 1
+
 int dlg_set_tm_callbacks(tm_cell_t *t, sip_msg_t *req, dlg_cell_t *dlg,
 		int mode);
 int dlg_set_tm_waitack(tm_cell_t *t, dlg_cell_t *dlg);
@@ -1258,9 +1262,10 @@ dlg_cell_t *dlg_lookup_msg_dialog(sip_msg_t *msg, unsigned int *dir)
 				msg->callid->body.len, msg->callid->body.s);
 		return NULL;
 	}
-        if(msg->first_line.u.request.method_value == METHOD_CANCEL) {
-                dlg_set_ctx_iuid(dlg);
-        }
+	if((dlg_ctxiuid_mode & DLG_CTXIUID_MODE_CANCEL) && IS_SIP_REQUEST(msg)
+			&& (msg->first_line.u.request.method_value == METHOD_CANCEL)) {
+		dlg_set_ctx_iuid(dlg);
+	}
 	if(dir) *dir = vdir;
 	return dlg;
 }




More information about the sr-dev mailing list