2 ways:

 

·         is_in_subnet() - http://www.kamailio.org/docs/modules/3.4.x/modules/ipops.html#idp42416

·         Add the IP and mask to the address table and use allow_source_address() - http://kamailio.org/docs/modules/3.1.x/modules_k/permissions.html#id2528610

 

 

Phil

 

 

From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Sunil More
Sent: 10 February 2016 05:41
To: Kamailio (SER) - Users Mailing List <sr-users@lists.sip-router.org>
Subject: [SR-Users] Need to validate a IP address with subnet mask

 

Hi All,

 

I want to validate a IP address in kamailio for requests coming from different IPs. I have browsed and found permissions module, however is there a way where i can directly compare a source IP address to an address stored in an avp and get a true or false value.

 

something like this

 

$si==192.168.2.0/24 

 


Thanking You,
Sunil More