[OpenSIPS-Users] BLF authorize
maatohewetbi
trance_maniak at o2.pl
Mon Apr 24 04:13:44 EDT 2017
I've just added BLF to my Opensips 1.11.9 and it seems to work ok, but I want
to start another thing: I want to authorize users, I want to let user to
monitor only certain users. I've just added this to my script:
/
route[handle_presence]
{
avp_db_query("select user_id from user where sip_login='$fU'",
"$avp(from)");
avp_db_query("select user_id from user where sip_login='$tU'", "$avp(to)");
if ($avp(from)==$avp(to))
{
if(!t_newtran()){
sl_reply_error();
exit;
}
if (is_method("PUBLISH")) {
handle_publish();
} else
if (is_method("SUBSCRIBE")) {
handle_subscribe();
}
exit;
}
else
{
xlog("BLF - unauthorized");
send_reply("405","Method Not Allowed");
exit;
}
}/
but it seems that after changing user_id, without restarting Opensips NOTIFY
messages still go to unauthorized user. So I've also added:
/ if (is_method("NOTIFY")) {
xlog("NOTIFY");
avp_db_query("select user_id from user where sip_login='$fU'",
"$avp(from)");
avp_db_query("select user_id from user where sip_login='$tU'",
"$avp(to)");
if (!$avp(from)==$avp(to)) {
xlog("NOTIFY to unauthorized user!");
exit;
}
}/
and it still doesn't work. It looks like NOTIFY messages don't go through
this script. How to make it work without XCAP server?
--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/BLF-authorize-tp7607123.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
More information about the Users
mailing list