What if I just want to lookup the country code IF the country code is not set. <div>Then queries to MySQL for this would only be made in the cases where the subscriber do not type in + or 00?</div><div><br></div><div>I've tried to look at avpops which apparently uses the usr_preferences as standard - but without any luck...<br><br>On Tuesday, September 1, 2015, Daniel Tryba <<a href="mailto:d.tryba@pocos.nl">d.tryba@pocos.nl</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tuesday 01 September 2015 16:43:42 Michael Nielsen wrote:<br>
> If I want to load a user specific country code, using avp, how can I do<br>
> this?<br>
><br>
> I've added kamctl avp add MY-SUBSCRIBER countrycode 0 +44, so +44 is added<br>
> to usr_preferences.<br>
><br>
> But calling $avp(countrycode) doesn't seem to give me +44?<br>
<br>
There is more than one way to do it, but I choose to load the usr_preferences<br>
into avps after authentication with avp_db_query (to have a fixed number of<br>
queries per call at the expense of memory).<br>
<br>
//auth<br>
                if(avp_db_query("SELECT<br>
replace(replace(concat('src_',attribute),'.','_'),'-','_'),value FROM<br>
usr_preferences WHERE username='$avp(au)' and domain='$fd' and length(value) ><br>
0"))<br>
                {<br>
                        while($avp(i:1)!=$null)<br>
                        {<br>
                                $avp($avp(i:1)[*])=$null;<br>
                                $avp($avp(i:1))=$avp(i:2);<br>
<br>
                                $avp(i:1)=$null;<br>
                                $avp(i:2)=$null;<br>
                        }<br>
                }<br>
<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'sr-users@lists.sip-router.org')">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>