Nice, but useful only when matching the source ip. The ipops or permissions module offer more flexibility, so the value that needs to be match can be taken from any variable (e.g., target domain in r-uri, or some header - useful if there is an edge proxy in between).

There are couple of other keywords that should work for network address matching, like dst_ip and snd_ip (in onsend_route).

Cheers,
Daniel

On 10/02/16 10:04, Phil Lavin wrote:

That’s nicer Syntax. Thanks, Daniel J

 

 

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

 

Hello,

for sake of completion, using the src_ip keyword works with network addresses:

if(src_ip==1.2.3.0/24)

Cheers,
Daniel

On 10/02/16 08:39, Sunil More wrote:

Hey Phil,

 

Thank you for the input , this helps.

 

 


Thanking You,
Sunil More

 

On Wed, Feb 10, 2016 at 12:40 PM, Phil Lavin <phil.lavin@synety.com> wrote:

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

 

 


Thanking You,
Sunil More


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

 




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



-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu