[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-28 Thread Daniel-Constantin Mierla via sr-dev
Closed #3669 as completed.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#event-11349913819
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-21 Thread Dennis via sr-dev
I have tested all 3 DB modes with my latest modifications, the results look 
correct:

```
=== Test mode 1 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 1)

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

>> make 2 calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 1536
dflags: 1536

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

>> terminate calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

=== Mode 1 looks good.


=== Test mode 2 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 2)
modparam("dialog", "db_update_period", 5)


# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


>> make 2 calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 1
dflags: 1538
dflags: 1667
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 1536
dflags: 1536

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0


>> terminate calls

... after 5 seconds

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

=== Mode 2 looks good



=== Test mode 3 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 3)

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


>> make 2 calls


# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1667
dflags: 1667

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

>>terminate calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


=== Mode 3 loos good also.
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1866618262
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.o

[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-21 Thread Dennis via sr-dev
I have tested all 3 DB modes with my latest modifications, the results look 
correct:

```
=== Test mode 1 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 1)

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

>> make 2 calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 1536
dflags: 1536

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

>> terminate calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

=== Mode 1 looks good.


=== Test mode 2 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 2)
modparam("dialog", "db_update_period", 5)


# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


>> make 2 calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 1
dflags: 1538
dflags: 1667
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 1536
dflags: 1536

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
dflags: 0
dflags: 0


>> terminate calls

... after 5 seconds

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

=== Mode 2 looks good



=== Test mode 3 ===
modparam("dialog", "db_url", "sqlite:///etc/kamailio/sqlite.db")
modparam("dialog", "db_mode", 3)

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


>> make 2 calls


# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1667
dflags: 1667

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

# systemctl restart kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 2
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
dflags: 1
dflags: 1

>>terminate calls

# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0

# systemctl stop kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0
ERROR: connect_unix_sock: connect(/var/run/kamailio//kamailio_ctl): No such 
file or directory [2]

# systemctl start kamailio
# echo 'select "dlgs: "||count(*) from dialog'|sqlite3 sqlite.db ; kamcmd 
dlg.list|grep dflags
dlgs: 0


=== Mode 3 looks good also.
```




-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1866616202
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamail

[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-21 Thread Dennis via sr-dev
> You should probably only do this if:
> if(dlg_db_mode == DB_MODE_SHUTDOWN) {

Yes, i missed it, will test all the db modes.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1866163424
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-21 Thread Morten Tryfoss via sr-dev
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:
if(dlg_db_mode == DB_MODE_SHUTDOWN) {

But there may be need to set flags differently for other modes.
It's important to test all modes that can be used when doing such a change.

If opening a pull request, please keep in mind clang-formating of the patch. 
Your commit will fail on this check.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1865922535
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-20 Thread Dennis via sr-dev
I have fixed dialog saving with folowing change:
https://github.com/Den4t/kamailio/commit/0ff12a0a0ab62123c7a37acb1c8f2f81d63751b5

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.
So, if the authors have no objections, I will do a PR.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1864510351
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-17 Thread Dennis via sr-dev
>>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 !

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1859074046
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-16 Thread Morten Tryfoss via sr-dev
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".

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1858912785
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-11 Thread Dennis via sr-dev
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 enother), all this can happend during long life dialog sessios.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1850654380
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Dialogs loaded from the DB are no longer saved. (Issue #3669)

2023-12-11 Thread carstenbock via sr-dev
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.
This does not look like a bug to me

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3669#issuecomment-1850297403
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org