Ver código fonte

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
Daniel-Constantin Mierla 10 anos atrás
pai
commit
cecdd08170
1 arquivos alterados com 5 adições e 0 exclusões
  1. 5 0
      modules/dialog/dlg_db_handler.c

+ 5 - 0
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*/
 			&sflags_column, /*18*/     &toroute_name_column, /*19*/ &req_uri_column, /*20*/
 			&xdata_column, /*21*/      &iflags_column  /*22*/ };
 			&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;
 	i = 0;
 	if( (cell->dflags & DLG_FLAG_NEW) != 0 
 	if( (cell->dflags & DLG_FLAG_NEW) != 0 
 	|| (cell->dflags & DLG_FLAG_CHANGED_VARS) != 0) {
 	|| (cell->dflags & DLG_FLAG_CHANGED_VARS) != 0) {