diff --git a/kamailio/db_queries_postgres.cfg b/kamailio/db_queries_postgres.cfg index 4b1ce60..5733f73 100644 --- a/kamailio/db_queries_postgres.cfg +++ b/kamailio/db_queries_postgres.cfg @@ -13,7 +13,7 @@ #!substdef "!KZQ_PRESENCE_SEARCH_SUMMARY!select * from active_watchers where watcher_domain = '\$var(Domain)'!g" #!substdef "!KZQ_PRESENCE_RESET!delete from presentity where sender = '\$var(MediaUrl)'!g" -#!substdef "!KZQ_REPLACE_WATCHERS_LOG!INSERT INTO active_watchers_log (presentity_uri, watcher_username, watcher_domain, event, callid, to_user, to_domain, user_agent, time, result, sent_msg, received_msg) VALUES ('\$subs(uri)', '\$subs(watcher_username)', '\$subs(watcher_domain)', '\$subs(event)','\$subs(callid)','\$subs(to_user)','\$subs(to_domain)', '\$(subs(user_agent){s.escape.common}{s.replace,\\\',''}{s.replace,\$\$,})', \$TS, \$notify_reply(\$rs), '\$(mb{s.replace,\\\',''}{s.replace,\$\$,''})', '\$(notify_reply(\$mb){s.replace,\\\',''}{s.replace,\$\$,''})') ON CONFLICT (presentity_uri, watcher_username, watcher_domain, event) DO UPDATE SET presentity_uri = excluded.presentity_uri, watcher_username = excluded.watcher_username, watcher_domain = excluded.watcher_domain, event = excluded.event!g" +#!substdef "!KZQ_REPLACE_WATCHERS_LOG!INSERT INTO active_watchers_log (presentity_uri, watcher_username, watcher_domain, event, callid, to_user, to_domain, user_agent, time, result, sent_msg, received_msg) VALUES ('$var(subs_uri)', '$var(subs_watcher_username)', '$var(subs_watcher_domain)', '$var(subs_event)','$var(subs_callid)','$var(subs_to_user)','$var(subs_to_domain)', '$var(subs_user_agent)', \$TS, '$var(notify_reply_code)', '$var(sent_msg)', '$var(received_msg)') ON CONFLICT (presentity_uri, watcher_username, watcher_domain, event) DO UPDATE SET presentity_uri = excluded.presentity_uri, watcher_username = excluded.watcher_username, watcher_domain = excluded.watcher_domain, event = excluded.event!g" #!substdef "!KZQ_DELETE_FROM_ACTIVE_WATCHERS_WHERE_EXPIRES!DELETE FROM active_watchers WHERE expires > 0 AND to_timestamp(expires) < now() - interval '90 seconds'!g" #!substdef "!KZQ_DELETE_FROM_ACTIVE_WATCHERS_WHERE_PRESENTITY!DELETE FROM ACTIVE_WATCHERS WHERE PRESENTITY_URI='\$subs(uri)' AND EVENT='\$subs(event)' AND FROM_USER = '\$subs(from_user)' AND FROM_DOMAIN='\$subs(from_domain)' AND CALLID <> '\$subs(callid)'!g" diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 4f2799d..adbc780 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -208,12 +208,19 @@ modparam("debugger", "mod_level", "core=1") ####### STATISTICS ###### loadmodule "statistics.so" -####### DATABASE module ########## -include_file "db_KAMAILIO_DBMS.cfg" - ###### kazoo bindings ###### include_file "kazoo-bindings.cfg" +#!ifdef PRESENCE_ROLE +loadmodule "presence.so" +loadmodule "presence_dialoginfo.so" +loadmodule "presence_mwi.so" +loadmodule "presence_xml.so" +#!endif + +####### DATABASE module ########## +include_file "db_KAMAILIO_DBMS.cfg" + ####### Role Configurations ########## #!ifdef AUTHORIZATION_ROLE include_file "authorization-role.cfg" diff --git a/kamailio/presence-notify.cfg b/kamailio/presence-notify.cfg index 33ca06a..d86775d 100644 --- a/kamailio/presence-notify.cfg +++ b/kamailio/presence-notify.cfg @@ -64,6 +64,20 @@ event_route[presence:notify-reply] $xavp(pres=>delete_subscription) = 0; + ###Fix issues with nested variables in specific load orders + $var(subs_uri) = $subs(uri); + $var(subs_watcher_username) = $subs(watcher_username); + $var(subs_watcher_domain) = $subs(watcher_domain); + $var(subs_event) = $subs(event); + $var(subs_callid) = $subs(callid); + $var(subs_to_user) = $subs(to_user); + $var(subs_to_domain) = $subs(to_domain); + $var(subs_user_agent) = $(subs(user_agent){s.escape.common}{s.replace,\','}{s.replace,$$,}); + $var(notify_reply_code) = $notify_reply($rs); + $var(sent_msg) = $(mb{s.replace,\','}{s.replace,$$,}); + $var(received_msg) = $(notify_reply($mb){s.replace,\','}{s.replace,$$,}); + + if($notify_reply($rs) == 200) { $sht(notify=>$ci) = $null; $sht(notify=>$ci::count) = 0; diff --git a/kamailio/presence-role.cfg b/kamailio/presence-role.cfg index df20b5c..8308461 100644 --- a/kamailio/presence-role.cfg +++ b/kamailio/presence-role.cfg @@ -34,10 +34,7 @@ modparam("nat_traversal", "keepalive_interval", 45) modparam("htable", "htable", "first=>size=32;autoexpire=3600;initval=0;") -loadmodule "presence.so" -loadmodule "presence_dialoginfo.so" -loadmodule "presence_mwi.so" -loadmodule "presence_xml.so" +### loadmodule for the presence modules have been moved to default.cfg to load them earlier modparam("presence_dialoginfo", "force_dummy_dialog", 1) modparam("presence_dialoginfo", "force_single_dialog", BLF_USE_SINGLE_DIALOG)