diff --git a/kamailio/nodes-role.cfg b/kamailio/nodes-role.cfg index 04c88a2..7fb20a7 100644 --- a/kamailio/nodes-role.cfg +++ b/kamailio/nodes-role.cfg @@ -45,13 +45,16 @@ route[NODES_ADVERTISE_ROUTE] #!ifdef PRESENCE_ROLE route(COUNT_ALL_SUBSCRIBERS); $var(Subscriptions) = $_s("Subscriptions" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)}); + $var(Subscribers) = $_s("Subscribers" : {"message-summary" : $xavp(watchers=>message-summary_unique), "dialog" : $xavp(watchers=>dialog_unique), "presence" : $xavp(watchers=>presence_unique)}); + route(COUNT_ALL_PRESENTITIES); $var(Presentities) = $_s("Presentities" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)}); - $var(Presence) = $_s("Presence" : {$var(Subscriptions), $var(Presentities)}); + + $var(Presence) = $_s("Presence" : {$var(Subscribers), $var(Subscriptions), $var(Presentities)}); #!else $var(Presence) = ""; #!endif - + $var(Roles) = $_s("Roles" : {$var(Dispatcher), $var(Presence) , $var(Registrar)}); $var(Payload) = '{"Event-Category" : "nodes", "Event-Name" : "advertise", "Expires" : 5000, "Used-Memory" : $(stat(real_used_size){s.int}), "Startup" : $Tb, "XWhApps" : {"kamailio" : {"Startup" : $Tb }}, $var(Roles)}'; kazoo_publish("nodes", "", $var(Payload)); diff --git a/kamailio/presence-role.cfg b/kamailio/presence-role.cfg index c928021..471d1e9 100644 --- a/kamailio/presence-role.cfg +++ b/kamailio/presence-role.cfg @@ -209,12 +209,13 @@ route[COUNT_ALL_PRESENTITIES] route[COUNT_ALL_SUBSCRIBERS] { - $var(Query) = $_s(select event, (select count(*) from active_watchers b where b.event = a.event) count from event_list a); - $var(p) = $_s(uri=$var(presentity)); + $var(Query) = $_s(select a.event, count(distinct watcher_username || "@" || watcher_domain) count_unique, count(*) count from event_list a, active_watchers b where b.event = a.event group by a.event); + $var(p) = "uri=none"; if (sql_xquery("cb", "$var(Query)", "subs") == 1) { while($xavp(subs) != $null) { $var(p) = $var(p) + ";" + $xavp(subs=>event) + "=" + $xavp(subs=>count); + $var(p) = $var(p) + ";" + $xavp(subs=>event) + "_unique=" + $xavp(subs=>count_unique); pv_unset("$xavp(subs)"); } } @@ -235,7 +236,6 @@ route[COUNT_SUBSCRIBERS] xavp_params_explode($var(p), "watchers"); } - event_route[kazoo:consumer-event-presence-dialog-update] { $var(Now) = $TS;