-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialogs loaded from the DB are no longer saved. #3669
Comments
The question is, why do you expect them to be saved again into the DB, if the dialogs were not modified? In your scenario the content from loading seems to be the same as what you want to save afterwards. |
Hi ! Yes, you are right, not modified, but as i said above - "when in some resonable short time kamailio shutdowned again with active dialogs loaded at startup", this can happend for example if i whant to modify scenario when do some mistake, or pod in cloud is migrated for some reason (stop in one location snd start in another), all this can happend during long life dialog sessios. |
The shutdown db mode is special. It should save all dialogs regardless of flag. On startup, all db entries are deleted again in the database. I did not investigate myself, but based on his descriptions dialogs that are created before the first restart is not kept during the second restart since they're no longer marked as "changed" or "new". |
Exactly ! |
I have fixed dialog saving with folowing change: Look like work as expected. I haven't tested DMQ, but having studied the code in detail, i don't think this change will affect it in any way. |
I suspect that might cause duplicate entry if any other db mode is used, after restore and then something that causes a change to the dialog - or even, not being deleted correctly since the DLG_FLAG_NEW flag is set. Please have a look at the remove_dialog_from_db() function. This will return on dialog termination if the flag is set, without deleting from database. You should probably only do this if: But there may be need to set flags differently for other modes. If opening a pull request, please keep in mind clang-formating of the patch. Your commit will fail on this check. |
Yes, i missed it, will test all the db modes. |
I have tested all 3 DB modes with my latest modifications, the results look correct:
|
…tartup when using db_mode 3 - The dialogs that loaded at startup are not saved in DB on shutdown, and so not loaded at restart, fixes issue #3669
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
The text was updated successfully, but these errors were encountered: