Browse Source

RESET_NON_UDP_ENABLED from env

update-rsyslog-config
lazedo 7 years ago
parent
commit
1b601b6676
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      kamailio/db_scripts/db_extra_check.sql

+ 10
- 3
kamailio/db_scripts/db_extra_check.sql View File

@ -2,12 +2,17 @@
do_db_extra_check() {
# location
# KazooDB -db ${DB_CURRENT_DB} "delete from location where socket not like 'udp:%';"
if [[ $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
# KazooDB -db ${DB_CURRENT_DB} "delete from active_watchers where socket_info not like 'udp:%';"
if [[ $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');"
KazooDB -db ${DB_CURRENT_DB} "delete from presentity where expires > 0 AND datetime(expires, 'unixepoch') < datetime('now', '-10 seconds');"
KazooDB -db ${DB_CURRENT_DB} "delete from presentity where id in(select id from presentities where state in('terminated','available'));"
@ -21,7 +26,9 @@ 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
# KazooDB -db ${DB_CURRENT_DB} "delete from keepalive where sockinfo NOT LIKE 'udp%';"
if [[ $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;"
}

Loading…
Cancel
Save