Browse Source

KAZOO-5581 add unique subscribers

KAZOO-5650
lazedo 9 years ago
parent
commit
16ae290d9b
2 changed files with 20 additions and 2 deletions
  1. +7
    -2
      kamailio/nodes-role.cfg
  2. +13
    -0
      kamailio/presence-role.cfg

+ 7
- 2
kamailio/nodes-role.cfg View File

@ -45,13 +45,18 @@ route[NODES_ADVERTISE_ROUTE]
#!ifdef PRESENCE_ROLE #!ifdef PRESENCE_ROLE
route(COUNT_ALL_SUBSCRIBERS); route(COUNT_ALL_SUBSCRIBERS);
$var(Subscriptions) = $_s("Subscriptions" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)}); $var(Subscriptions) = $_s("Subscriptions" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)});
route(COUNT_ALL_PRESENTITIES); route(COUNT_ALL_PRESENTITIES);
$var(Presentities) = $_s("Presentities" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)}); $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)});
route(COUNT_UNIQUE_SUBSCRIBERS);
$var(Subscribers) = $_s("Subscribers" : {"message-summary" : $xavp(watchers=>message-summary), "dialog" : $xavp(watchers=>dialog), "presence" : $xavp(watchers=>presence)});
$var(Presence) = $_s("Presence" : {$var(Subscribers), $var(Subscriptions), $var(Presentities)});
#!else #!else
$var(Presence) = ""; $var(Presence) = "";
#!endif #!endif
$var(Roles) = $_s("Roles" : {$var(Dispatcher), $var(Presence) , $var(Registrar)}); $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)}'; $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)); kazoo_publish("nodes", "", $var(Payload));


+ 13
- 0
kamailio/presence-role.cfg View File

@ -235,6 +235,19 @@ route[COUNT_SUBSCRIBERS]
xavp_params_explode($var(p), "watchers"); xavp_params_explode($var(p), "watchers");
} }
route[COUNT_UNIQUE_SUBSCRIBERS]
{
$var(Query) = $_s(select event, (select count(distinct watcher_username || "@" || watcher_domain) from active_watchers b where b.event = a.event) count from event_list a);
$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);
pv_unset("$xavp(subs)");
}
}
xavp_params_explode($var(p), "watchers");
}
event_route[kazoo:consumer-event-presence-dialog-update] event_route[kazoo:consumer-event-presence-dialog-update]
{ {


Loading…
Cancel
Save