Browse Source

missing files

4.3
lazedo 7 years ago
committed by Luis Azedo
parent
commit
be2cdba506
3 changed files with 54 additions and 0 deletions
  1. +16
    -0
      kamailio/custom-init.cfg
  2. +23
    -0
      kamailio/db_scripts/db_extra_check.sql
  3. +15
    -0
      kamailio/presence-custom-cleanup.cfg

+ 16
- 0
kamailio/custom-init.cfg View File

@ -0,0 +1,16 @@
#!ifdef PRESENCE_ROLE
######## async operations module ########
loadmodule "async.so"
modparam("async", "workers", 5)
event_route[core:worker-one-init]
{
// t_newtran();
async_route("PRESENCE_INITIAL_CLEANUP", "20");
// t_drop();
## route(PRESENCE_INITIAL_CLEANUP);
}
#!endif

+ 23
- 0
kamailio/db_scripts/db_extra_check.sql View File

@ -0,0 +1,23 @@
do_db_extra_check() {
# location
KazooDB -db ${DB_CURRENT_DB} "delete from location where socket not like 'udp:%';"
KazooDB -db ${DB_CURRENT_DB} "delete from location where expires > 0 and datetime(expires, 'unixepoch') < datetime('now', '-10 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:%';"
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'));"
KazooDB -db ${DB_CURRENT_DB} "delete from active_watchers_log where id in(select id from active_watchers_log a where not exists(select callid from active_watchers b where b.callid = a.callid and b.watcher_username = a.watcher_username and b.watcher_domain = a.watcher_domain));"
KazooDB -db ${DB_CURRENT_DB} "delete from presentity where id in(select id from presentities a where not exists(select * from active_watchers where presentity_uri = a.presentity_uri));"
## notify watchers of pending calls
## 'create temp table as' because it will be dropped as soon as we ended the session
KazooDB -db ${DB_CURRENT_DB} "drop table if exists tmp_probe;"
KazooDB -db ${DB_CURRENT_DB} "create table tmp_probe as select distinct b.event, a.presentity_uri from presentities a inner join active_watchers b on a.presentity_uri = b.presentity_uri where state in('early', 'confirmed', 'onthephone', 'busy');"
KazooDB -db ${DB_CURRENT_DB} "delete from presentity where id in(select id from presentities where state in('early', 'confirmed', 'onthephone', 'busy'));"
}

+ 15
- 0
kamailio/presence-custom-cleanup.cfg View File

@ -0,0 +1,15 @@
route[PRESENCE_INITIAL_CLEANUP]
{
xlog("L_INFO", "processing presence initial cleanup\n");
if (sql_xquery("cb", "select * from tmp_probe", "ra") == 1)
{
while($xavp(ra) != $null) {
xlog("L_WARNING", "processing $xavp(ra=>event) notifies for $xavp(ra=>presentity_uri)\n");
pres_refresh_watchers("$xavp(ra=>presentity_uri)", "$xavp(ra=>event)", 1);
pv_unset("$xavp(ra)");
}
}
// t_release();
// t_drop();
}

Loading…
Cancel
Save