[sr-dev] git:master:974abf6a: dialog: setting dlg_flag parameter is no longer mandatory

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 19 16:43:22 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-10-19T16:43:09+02:00

dialog: setting dlg_flag parameter is no longer mandatory

- dlg_manage() can be used to start tracking the dialog
- using flags can still be used, the parameter has to be set as well as
  the appropriate transaction flag

---

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

---

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

---

diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c
index b6c4d5c..553715d 100644
--- a/modules/dialog/dialog.c
+++ b/modules/dialog/dialog.c
@@ -496,10 +496,7 @@ static int mod_init(void)
 		return -1;
 
 	/* param checkings */
-	if (dlg_flag==-1) {
-		LM_ERR("no dlg flag set!!\n");
-		return -1;
-	} else if (dlg_flag>MAX_FLAG) {
+	if (dlg_flag>MAX_FLAG) {
 		LM_ERR("invalid dlg flag %d!!\n",dlg_flag);
 		return -1;
 	}
diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index ef7a336..f9a16ce 100644
--- a/modules/dialog/dlg_handlers.c
+++ b/modules/dialog/dlg_handlers.c
@@ -55,7 +55,7 @@
 #include "dlg_var.h"
 
 static str       rr_param;		/*!< record-route parameter for matching */
-static int       dlg_flag;		/*!< flag for dialog tracking */
+static int       dlg_flag_mask=0;	/*!< flag for dialog tracking */
 static pv_spec_t *timeout_avp;		/*!< AVP for timeout setting */
 static int       default_timeout;	/*!< default dialog timeout */
 static int       seq_match_mode;	/*!< dlg_match mode */ 
@@ -107,7 +107,7 @@ void init_dlg_handlers(char *rr_param_p, int dlg_flag_p,
 	rr_param.s = rr_param_p;
 	rr_param.len = strlen(rr_param.s);
 
-	dlg_flag = 1<<dlg_flag_p;
+	if(dlg_flag_p>=0) dlg_flag_mask = 1<<dlg_flag_p;
 
 	timeout_avp = timeout_avp_p;
 	default_timeout = default_timeout_p;
@@ -711,7 +711,7 @@ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param)
 		}
 	}
 	if (dlg==NULL) {
-		if((req->flags&dlg_flag)!=dlg_flag)
+		if((req->flags&dlg_flag_mask)!=dlg_flag_mask)
 			return;
 		LM_DBG("dialog creation on config flag\n");
 		dlg_new_dialog(req, t, 1);




More information about the sr-dev mailing list