Skip to content

Commit

Permalink
cleanup tcp/tls connections by default before starting
Browse files Browse the repository at this point in the history
* registrations and presence with tcp/tls are unusable on restart

(cherry picked from commit c659d9f)
  • Loading branch information
lazedo committed Sep 24, 2024
1 parent dd0c0a7 commit d27f918
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kamailio/db_scripts/db_extra_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
do_db_extra_check() {

# location
if [[ "$RESET_NON_UDP_ENABLED" == "true" ]]; then
if [[ ! "${DISABLE_RESET_NON_UDP_ENABLED}" == "true" ]]; then
KazooDB -db ${DB_CURRENT_DB} "delete from location where socket not like 'udp:%';"
fi

##KazooDB -db ${DB_CURRENT_DB} "delete from location where expires > 0 and datetime(expires) < datetime('now', '-30 seconds');"
KazooDB -db ${DB_CURRENT_DB} "delete from location_attrs where not exists(select id from location where ruid = location_attrs.ruid);"

## presence
if [[ "$RESET_NON_UDP_ENABLED" == "true" ]]; then
if [[ ! "${DISABLE_RESET_NON_UDP_ENABLED}" == "true" ]]; then
KazooDB -db ${DB_CURRENT_DB} "delete from active_watchers where socket_info not like 'udp:%';"
fi
KazooDB -db ${DB_CURRENT_DB} "delete from active_watchers where expires > 0 and datetime(expires, 'unixepoch') < datetime('now', '-10 seconds');"
Expand All @@ -27,7 +27,7 @@ KazooDB -db ${DB_CURRENT_DB} "create table tmp_probe as select distinct a.event,
KazooDB -db ${DB_CURRENT_DB} "delete from presentity where id in(select id from presentities where state in('early', 'confirmed', 'onthephone', 'busy'));"

## keepalive
if [[ "$RESET_NON_UDP_ENABLED" == "true" ]]; then
if [[ ! "${DISABLE_RESET_NON_UDP_ENABLED}" == "true" ]]; then
KazooDB -db ${DB_CURRENT_DB} "delete from keepalive where sockinfo NOT LIKE 'udp%';"
fi
KazooDB -db ${DB_CURRENT_DB} "update keepalive set selected = 0, time_sent = datetime('now') where selected < 3;"
Expand Down

0 comments on commit d27f918

Please sign in to comment.