소스 검색

dialog: added modparam dlg_ctxiuid_mode to control when iuid is set

Daniel-Constantin Mierla 3 년 전
부모
커밋
a770c4957a
2개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 0
      src/modules/dialog/dialog.c
  2. 8 3
      src/modules/dialog/dlg_handlers.c

+ 3 - 0
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 }
 };
 

+ 8 - 3
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;
 }