[SR-Users] Add country code on incoming calls - if not present

Michael Nielsen mic.niel84 at gmail.com
Tue Sep 1 17:37:36 CEST 2015


What if I just want to lookup the country code IF the country code is not
set.
Then queries to MySQL for this would only be made in the cases where the
subscriber do not type in + or 00?

I've tried to look at avpops which apparently uses the usr_preferences as
standard - but without any luck...

On Tuesday, September 1, 2015, Daniel Tryba <d.tryba at pocos.nl> wrote:

> 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;
>                         }
>                 }
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org <javascript:;>
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150901/b7050d18/attachment.html>


More information about the sr-users mailing list