[Serusers] Shoot my logic full of holes....

sip sip at arcdiv.com
Thu Oct 6 17:17:46 CEST 2005


Okay... I'm wondering if this would work as a quick hack for checking call
blocking (and making it rational). 

In order to use AVPOps, and not rewrite a module, I've created a table called
callblock, which looks exactly like the usr_preferences table (basically an
AVP table), but has no primary keys (as I want to be able to add multiple
values for the same username/domain/attribute). 

In my code, I then have a block that looks like:

            if(avp_db_load("$ruri/username","s:callblkna/callblock"))
            {
                if(avp_check("s:callblkna","eq/$from/gi"))
                {
                    sl_send_reply("603", "Call denied");
                    break;
                };
            };
            if(avp_db_load("$ruri/username","s:callblkvm/callblock"))
            {
                if(avp_check("s:callblkvm","eq/$from/gi"))
                {
                    route(4);
                    break;
                };
            };

If it's a callblkna, it then sends an error reply. If it's a callblkvm, it
does a route(4) (which is straight to voicemail). 

Anyone see a glaring hole in this logic here? It seems to work, but I'd hate
to get down the road and discover that I overlooked something glaringly
obvious (which I often do). 


N.




More information about the sr-users mailing list