[sr-dev] git:master:cecdd081: dialog: safety check not to store dialog vars and data when state initial

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 10 09:30:30 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-10T09:30:11+02:00

dialog: safety check not to store dialog vars and data when state initial

- acc callbacks for cdrs can trigger setting dialog vars in initial
  state, which then try to save in db, however, initial state might not
  have all required fields for a proper db reload, storing being
  desinged to be done when all mandatory fields are set

---

Modified: modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c
index e8c866d..da4b091 100644
--- a/modules/dialog/dlg_db_handler.c
+++ b/modules/dialog/dlg_db_handler.c
@@ -712,6 +712,11 @@ int update_dialog_dbinfo_unsafe(struct dlg_cell * cell)
 			&sflags_column, /*18*/     &toroute_name_column, /*19*/ &req_uri_column, /*20*/
 			&xdata_column, /*21*/      &iflags_column  /*22*/ };
 
+	if(cell->state<DLG_STATE_EARLY) {
+		LM_DBG("not storing dlg in db during initial state\n");
+		return 0;
+	}
+
 	i = 0;
 	if( (cell->dflags & DLG_FLAG_NEW) != 0 
 	|| (cell->dflags & DLG_FLAG_CHANGED_VARS) != 0) {




More information about the sr-dev mailing list