[OpenSIPS-Users] Globalblacklist and userblacklist

Carlo Dimaggio jaasmailing at gmail.com
Tue Oct 28 12:57:50 CET 2008

Hi all,

I would like to use globalblacklist and userblacklist toghether in my  
config script.
I need this to blacklist some destinations (for example 199XXXXXX)  
but to enable for some users different subsets (199123XXX,  
199345XXX). My idea is to block all calls with 199 prefix in  
globalblacklist table and enable specifics destinations on a per user  
basis (in userblacklist). But I don't understand how i can do this,  
because the function check_user_blacklist returns true even if there  
isn't a match, so I cannot distinguish the "the destination is  
whitelisted" from "there isn't a destination with this prefix".

In other words, this routine works in all conditions except for  
destinations "globalblacklisted" and not "userblacklisted".

if (!check_blacklist("globalblacklist"))) {			
	setflag(31);								#if the destination is globalblacklisted setflag 31

if (!check_user_blacklist("$fU", "$rd")) {			
	setflag(31);								#If the destination is userblacklisted setflag 31
} else {
	resetflag(31);							#If the destination is userwhitelisted  
resetflag 31 <-- here is the problem, because the flag is resetted  
even if there is not a match

if (isflagset(31)) {
        xlog ("L_INFO", "Forbidden. Destination blacklisted  - M=$rm  
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        sl_send_reply("403", "Forbidden");


Can you help me in order to setup the right configuration?


More information about the Users mailing list