[SR-Users] Kamailio Geoip

Sergey Okhapkin sos at sokhapkin.dyndns.org
Tue Mar 5 13:31:40 CET 2013


Are there plans to extend geoip module to work in dual stack environment, i.e. 
lookup both ipv4 and ipv6 addresses? Maxmind provides ipv6 databases.

On Tuesday 05 March 2013 09:36:59 Daniel-Constantin Mierla wrote:
> Hello,
> 
> On 3/4/13 11:48 AM, Ian French wrote:
> > Hey List,
> > 
> >               I'm looking at an article by Daniel,
> > 
> > http://by-miconda.blogspot.ie/2010/10/best-of-new-in-kamailio-310-5-geoip-
> > api.html.
> > 
> > In it he's uses the below to block source IP addresses by country,How
> > could this be used to block multiple country sources?? I've tried a
> > couple of things aleardy but have failed
> > 
> > geoip_match("$si", "src");
> > if($gip(src=>cc)=="CA") {
> > 
> >    xlog("SIP message from Canada (ip: $si) - drop it\n");
> >    
> >    send_reply("403", "Forbidden");
> >    exit;
> > 
> > }
> 
> just make an OR expression:
> 
> if($gip(src=>cc)=="CA" || $gip(src=>cc)=="DE" || $gip(src=>cc)=="FR") {
> 
> Just as an alternative example, you can use sqlops to make a db query
> and check againts a list stored in a database table.
> 
> Cheers,
> Daniel



More information about the sr-users mailing list