[SR-Users] Kamailio Geoip

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 6 12:28:19 CET 2013


Hello,

On 3/5/13 1:31 PM, Sergey Okhapkin wrote:
> 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.
is there any change in the API for the IPv6? Or there are two separate 
databases that should be used?

Cheers,
Daniel

>
> 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

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -




More information about the sr-users mailing list