[SR-Users] Kamailio Geoip
Daniel-Constantin Mierla
miconda at gmail.com
Tue Mar 5 09:36:59 CET 2013
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 -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130305/27ca787c/attachment.htm>
More information about the sr-users
mailing list