@ -28,7 +28,32 @@ modparam("mqueue","mqueue", "name=node_heartbeat")
####### NODES Logic ########
route[NODES_ADVERTISE_ROUTE]
{
$var(Payload) = '{"Event-Category" : "nodes", "Event-Name" : "advertise", "Expires" : 5000, "Used-Memory" : $(stat(real_used_size){s.int}), "Registrations" : $(stat(registered_users){s.int}), "WhApps" : {"kamailio" : {"Startup" : $Tb }} }';
#!ifdef REGISTRAR_ROLE
$var(Registrar) = $_s("Registrar" : {"Registrations" : $(stat(registered_users){s.int})});
#!else
$var(Registrar) = "";
#!endif
#!ifdef DISPATCHER_ROLE
route(DISPATCHER_SUMMARY);
$var(Dispatcher) = $_s("Dispatcher" : {"Groups" : { $var(ds_groups_json) }});
#!else
$var(Dispatcher) = "";
#!endif
#!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)});
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)});
#!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));
}
@ -107,7 +132,6 @@ route[CHECK_MEDIA_SERVERS]
if(kazoo_json_keys($var(Payload), "Media-Servers.$var(MediaKey).Interfaces", "$avp(ProfileKeys)") = = 1) {
$var(ProfileCount) = $cnt($avp(ProfileKeys));
$var(ProfileIdx) = 0;
xlog("L_INFO", "nodes|media|$var(Node) profile count for $(avp(MediaKeys)[$var(Idx)]) is : $var(ProfileCount)\n");
while( $var(ProfileIdx) < $var(ProfileCount) ) {
$var(MediaRawUrl) = $(var(Payload){kz.json,Media-Servers.$var(MediaKey).Interfaces.$(avp(ProfileKeys)[$var(ProfileIdx)]).URL});
$var(MediaUrl) = $(var(MediaRawUrl){re.subst,/^sip:(.*)@(.*)/sip:\2/});