<div dir="ltr">Oh, I see... This should be what I was looking for. Thanx</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 2, 2015 at 9:14 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div 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<div><div class="h5"><br>
    <br>
    <div>On 01/09/15 17:37, Michael Nielsen
      wrote:<br>
    </div>
    <blockquote 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 href="mailto:d.tryba@pocos.nl" target="_blank">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>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>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<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>
</pre>
    </blockquote>
    <br>
    </div></div><span class="HOEnZb"><font color="#888888"><pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a></pre>
  </font></span></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto: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" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>