<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
As alternative, if you need the country code for caller only, then
look at load_credentials parameter for auth_db module. If you add
the country code in the subscriber table, it will be loaded from
database whent he authentication is done (i.e., in the same query
with the password).<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 01/09/15 17:37, Michael Nielsen
wrote:<br>
</div>
<blockquote
cite="mid:CAKLKb5=-BEiQdMYWXpKgKtP7SLcPfK9M+pk9QVEQKTOuo2mhKg@mail.gmail.com"
type="cite">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
moz-do-not-send="true" 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 moz-do-not-send="true" href="javascript:;"
onclick="_e(event, 'cvml', 'sr-users@lists.sip-router.org')">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
</body>
</html>