[Users] AVP Distinctive-Ring question

Daniel-Constantin Mierla daniel at voice-system.ro
Mon Nov 7 21:39:45 CET 2005


Hello,

you can store the ringtone only in one avp, load the value in one query, 
and then push it into a header.
See: http://www.voice-system.ro/docs/avpops/ar01s06.html#avp_pushto

If you need to compose another string based on the value loaded from 
database and other stuff, you can use avp_printf() prior adding the header.
http://www.voice-system.ro/docs/avpops/ar01s06.html#avp_printf

Cheers,
Daniel


On 11/07/05 21:35, 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");
> 		};
> 	};
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>   




More information about the Users mailing list