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.
Looks ok to me. g-) ----- Original Message ----- From: "sip" sip@arcdiv.com To: serusers@lists.iptel.org Sent: Thursday, October 06, 2005 05:17 PM Subject: [Serusers] Shoot my logic full of holes....
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.
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers