[Users] RE: [Serusers] AVP Distinctive-Ring question

Lenir lenirsantiago at yahoo.com
Tue Nov 8 16:33:54 CET 2005


Daryl,

Try something like this:
avp_db_load("$ruri/domain","i:/usr_preferences");
	
	- loads all AVPs with ID from 'usr_preferences'
	table for domain from RURI

Run that ONCE, then do all your AVP checks without using the avp_db_load
statements. This *should* work with SER and OpenSER, but definitely OpenSER.

Lenir

-----Original Message-----
From: serusers-bounces at iptel.org [mailto:serusers-bounces at iptel.org] On
Behalf Of sip
Sent: Monday, November 07, 2005 2:57 PM
To: Daryl Sanders; SER Users; users at openser.org
Subject: Re: [Serusers] AVP Distinctive-Ring question

SER is severely limited on the passing of variables which ends up making
things like that string of queries necessary to perform some things. 

OpenSER I think allows the use of tossing in pseudo variables here and
there,
so you could probably grab the value of the ringtone from the AVP and then
toss it into the Alert-Info header making it into one query instead of 5. 

Not being an OpenSER user, however, this is only what I understand from my
cursory reading of its docs. You'd have to check on that with someone else,
I
think. 

N.


On Mon, 7 Nov 2005 12:35:55 -0700, Daryl Sanders wrote
> I am using AVPs for distinctive ring preferences. I allows users to
> store up to 5 phone numbers that can be assigned a custom ring. The
> method below works fine but as you can see it requires 5 db queries.
> There must be a better way to do this. Any ideas?
> 
> - Daryl
> 
> 	if (avp_db_load("$ruri/username", "s:ringone")) {
> 		if (avp_check("s:ringone", "eq/$from/i")) {
> 		append_hf("Alert-Info: Bellcore-r1\r\n");
> 		};
> 	};
> 	if (avp_db_load("$ruri/username", "s:ringtwo")) {
> 		if (avp_check("s:ringtwo", "eq/$from/i")) {
> 		append_hf("Alert-Info: Bellcore-r2\r\n");
> 		};
> 	};
> 	if (avp_db_load("$ruri/username", "s:ringthree")) {
> 		if (avp_check("s:ringthree", "eq/$from/i")) {
> 		append_hf("Alert-Info: Bellcore-r3\r\n");
> 		};
> 	};
> 	if (avp_db_load("$ruri/username", "s:ringfour")) {
> 		if (avp_check("s:ringfour", "eq/$from/i")) {
> 		append_hf("Alert-Info: Bellcore-r4\r\n");
> 		};
> 	};
> 	if (avp_db_load("$ruri/username", "s:ringfive")) {
> 		if (avp_check("s:ringfive", "eq/$from/i")) {
> 		append_hf("Alert-Info: Bellcore-r5\r\n");
> 		};
> 	};
> 
> _______________________________________________
> Serusers mailing list
> Serusers at iptel.org
> http://mail.iptel.org/mailman/listinfo/serusers

_______________________________________________
Serusers mailing list
Serusers at iptel.org
http://mail.iptel.org/mailman/listinfo/serusers






More information about the Users mailing list