Hi !
### Description
I have а scenario where dialogs are saved at kamailio shutdown and loaded at startup, the dialog module related configuration:
modparam("dialog", "db_url", DBURL) modparam("dialog", "db_mode", 3)
When kamailio shut down first time all dialogs a saved in DB, upon startup they loaded as expected, but when in some resonable short time kamailio shutdowned again with active dialogs loaded at startup, they not saved in DB.
I think this happens because the dialog dflags in load_dialog_info_from_db function set to zero after dialog loaded, so in update_dialog_dbinfo_unsafe such dialogs are ignored (no DLG_FLAG_NEW, no DLG_FLAG_CHANGED set).
#### Debugging Data
Before shutdown: kamcmd> dlg.list { h_entry: 521 h_id: 11463 ref: 2 call-id: 7z32YR9BCg from_uri: sip:XXXXX@[XXXX:XXXX:b081:1320::1:2c] to_uri: sip:YYYYY@[XXXX:XXXX:0:201d::a1] state: 4 start_ts: 1702137597 init_ts: 1702137595 end_ts: 0 duration: 18 timeout: 1702144797 lifetime: 7200 **dflags: 643** sflags: 0 iflags: 0 .....
After startup: kamcmd> dlg.list { h_entry: 521 h_id: 11463 ref: 2 call-id: 7z32YR9BCg from_uri: sip:XXXXX@[XXXX:XXXX:b081:1320::1:2c] to_uri: sip:YYYYY@[XXXX:XXXX:0:201d::a1] state: 4 start_ts: 1702137597 init_ts: 1702137636 end_ts: 0 duration: 46 timeout: 1702144798 lifetime: 7201 **dflags: 0** sflags: 0 iflags: 0 ....
### Possible Solutions
At first glance, it's easy to set dlg->flags = DLG_FLAG_CHANGED (or may be to DLG_FLAG_NEW|DLG_FLAG_CHANGED) after loading from the database in load_dialog_info_from_db function, but I'm not sure if this could break anything else (e.g. DMQ).
### Additional Information
* **Kamailio Version** - kamailio 5.7.2 (x86_64/linux)
* **Operating System**:
Ubuntu 18.04.6 LTS