Browse Source

add some macros & allow custom handling

master
lazedo 6 years ago
parent
commit
8e73660494
1 changed files with 10 additions and 22 deletions
  1. +10
    -22
      kamailio/presence-role.cfg

+ 10
- 22
kamailio/presence-role.cfg View File

@ -3,7 +3,7 @@
#!trydef PRESENCE_MIN_EXPIRES_ACTION 1
#!trydef PRESENCE_MAX_EXPIRES 3600
#!trydef KZ_PRESENCE_IGNORE_STATUS_PROBE_RESP 1
#!trydef KZ_PRESENCE_IGNORE_STATUS_PROBE_RESP 0
#!trydef KZ_PRESENCE_CSEQ_OFFSET 2
#!trydef KZ_PRESENCE_MAX_CALL_PER_PRESENTITY 20
#!trydef BLF_USE_SINGLE_DIALOG 1
@ -15,7 +15,7 @@
#!trydef KZ_PRESENCE_REQUIRE_AUTHN 0
#!trydef KZ_PRESENCE_KEEPALIVE_NAT_ONLY 1
#!trydef KZ_PRESENCE_KEEPALIVE_UDP_ONLY 1
#!trydef KZ_PRESENCE_FAST_NOTIFY 1
#!ifdef NAT_TRAVERSAL_ROLE
#!ifndef KEEPALIVE_ROLE
@ -49,7 +49,7 @@ modparam("presence_xml", "disable_bla", 1)
modparam("presence", "subs_db_mode", 3)
modparam("presence", "expires_offset", 0)
modparam("presence", "send_fast_notify", 1)
modparam("presence", "send_fast_notify", KZ_PRESENCE_FAST_NOTIFY)
modparam("presence", "clean_period", 0)
modparam("presence", "db_update_period", 0)
@ -110,6 +110,8 @@ route[HANDLE_SUBSCRIBE]
return;
}
route_if_exists("CUSTOM_HANDLE_SUBSCRIBE");
if ($hdr(Event) != "dialog"
&& $hdr(Event) != "presence"
&& $hdr(Event) != "message-summary") {
@ -117,13 +119,6 @@ route[HANDLE_SUBSCRIBE]
send_reply(489, "Bad Event");
exit();
}
route(PRESENCE_AUTHN);
if (!t_newtran()) {
sl_reply_error();
exit;
}
if(has_totag()) {
loose_route();
@ -137,8 +132,6 @@ route[HANDLE_SUBSCRIBE]
route(HANDLE_NEW_SUBSCRIBE);
}
t_release();
exit;
}
@ -236,7 +229,7 @@ route[REQUEST_PROBE]
} else {
xlog("L_INFO", "$ci|sub|requesting $hdr(Event) probe for $subs(to_user) in realm $subs(to_domain)\n");
$var(rk) = "probes." + $hdr(Event);
$var(amqp_payload_request) = $_s({"Event-Category" : "presence", "Event-Name" : "probe", "Event-Package" : "$hdr(event)", "Username" : "$tU", "Realm" : "$fd", "Call-ID" : "$ci"});
$var(amqp_payload_request) = $_s({"Event-Category" : "presence", "Event-Name" : "probe", "Event-Package" : "$hdr(event)", "Username" : "$subs(to_user)", "Realm" : "$subs(to_domain)", "Call-ID" : "$ci"});
kazoo_publish("presence", "$var(rk)", $var(amqp_payload_request));
}
}
@ -258,6 +251,8 @@ route[HANDLE_PUBLISH]
return;
}
route_if_exists("CUSTOM_HANDLE_PUBLISH");
if ($hdr(Event) != "dialog"
&& $hdr(Event) != "presence"
&& $hdr(Event) != "message-summary") {
@ -266,19 +261,12 @@ route[HANDLE_PUBLISH]
exit();
}
route(PRESENCE_AUTHN);
if (!t_newtran()) {
sl_reply_error();
exit;
}
if($hdr(Sender)!= $null) {
handle_publish("$hdr(Sender)");
} else {
handle_publish();
}
t_release();
exit;
}
@ -427,7 +415,7 @@ event_route[kazoo:consumer-event-presence-update]
}
}
xlog("L_DEBUG", "$(kzE{kz.json,Call-ID})|log|received presence update for $(kzE{kz.json,Presence-ID})");
xlog("L_DEBUG", "$(kzE{kz.json,Call-ID})|log|received presence update for $(kzE{kz.json,Presence-ID})\n");
$var(JObj) = $kzE;
$var(presentity) = $_s(sip:$(kzE{kz.json,Presence-ID}));
$var(payload) = $kzE;


Loading…
Cancel
Save