On Tuesday 01 September 2015 16:43:42 Michael Nielsen wrote:
If I want to load a user specific country code, using avp, how can I do this?
I've added kamctl avp add MY-SUBSCRIBER countrycode 0 +44, so +44 is added to usr_preferences.
But calling $avp(countrycode) doesn't seem to give me +44?
There is more than one way to do it, but I choose to load the usr_preferences into avps after authentication with avp_db_query (to have a fixed number of queries per call at the expense of memory).
//auth if(avp_db_query("SELECT replace(replace(concat('src_',attribute),'.','_'),'-','_'),value FROM usr_preferences WHERE username='$avp(au)' and domain='$fd' and length(value) > 0")) { while($avp(i:1)!=$null) { $avp($avp(i:1)[*])=$null; $avp($avp(i:1))=$avp(i:2);
$avp(i:1)=$null; $avp(i:2)=$null; } }