[OpenSER-Users] How to check if $rd lies in an IP range

Josh Mahonin jmahonin at cbnco.com
Thu Mar 20 22:34:19 CET 2008


Hi folks,

In my setup, I've got two disjoint subnets (call then A and B) that
cannot communicate directly to each other, but devices on each can both
communicate to my OpenSER server and Asterisk box (both on their own
subnet, C).  There is no NAT involved, so I only want to use rtpproxy
when it's the case that device from subnet A attempts to call a device
on subnet B, or vice-versa.

I would ideally not like to use rtp proxy for communication between A-C
and A-B (this will enable RTP media between both subnets, but that
solution will not scale very well...)

I'm attempting do something like this:

if (src_ip == a.b.c.d/24 && dst_ip == w.x.y.z/24)
    use rtp proxy

But unfortunately, on an INVITE, after a lookup, dst_ip is set to the
OpenSER server.  The pseudovariable $rd is set to the value I'd like to
check against, but it complains loudly when I attempt to substitute
dst_ip for $rd.

Is there any way to use avp_check() or the like to verify that the value
in $rd lies in a given subnet?  I don't want to match just one IP, but a
whole range.  I found a similar question on the SER mailing list asked
several years ago, with no response.

Thanks,

Josh





More information about the Users mailing list