[SR-Users] Hash table.

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 20 10:34:28 CET 2014


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140320/07455abc/attachment.html>


More information about the sr-users mailing list