[SR-Users] Hash table.

Slava Bendersky volga629 at networklab.ca
Thu Mar 20 15:57:58 CET 2014


Hello Daniel, 
Excellent, thank you. 


----- Original Message -----

From: "Daniel-Constantin Mierla" <miconda at gmail.com> 
To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.sip-router.org> 
Sent: Thursday, March 20, 2014 5:34:28 AM 
Subject: Re: [SR-Users] Hash table. 

Hello, 

there is no geoip param for hatable module. If you want to put some values in a hash table at startup, either you configure htable to load records from database table or use event_route[htable:mod-init] to set values in hash table. 

For the later, define hatbale named blocked and then: 

event_route[htable:mod-init] { 
$sht(blocked=>TH) = 1; 
$sht(blocked=>IN) = 1; 
} 

The check should be: 

if($sht(blocked=>$gip(src=>cc))==1) { 
# blocked country 
... 
} 

Cheers, 
Daniel 

On 20/03/14 05:57, Slava Bendersky wrote: 



Hello Everyone, 
I am trying set hash table for geoip and put countries code which is not a customers. Currently I have working as static for single country code. 

#!ifdef WITH_GEOIP 
route[GEOIP] 
geoip_match("$si", "src"); 
if($gip(src=>cc)=="TH") { 
xlog("SIP message not from allowed customer (ip: $si) - drop it\n"); 
send_reply("403", "Forbidden"); 
exit; 
} 
#!endif 

I though replace single value on restricted countries with 

modparam("htable", "geoip", "country_code=>TH;") 
modparam("htable", "geoip", "country_code=>IN;") 

if($gip(src=>cc)=="$sht(geoip=>country_code)"); 

but not sure if it good approach or which way to go. Any help thank you. 

Slava. 


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users at lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users 



-- 
Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference - April 2-4, 2014, Berlin, Germany http://www.kamailioworld.com 

_______________________________________________ 
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list 
sr-users at lists.sip-router.org 
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/20140320/7918299b/attachment.html>


More information about the sr-users mailing list