[OpenSIPS-Users] can't get is_contact_registered() to return true
jeff at ugnd.org
Thu Oct 8 14:18:54 EST 2020
Yes. I want to compare everything I can between the INVITE I've just
received and the registration I authenticated previously to make sure
everything that is supposed to match does match. I'd love to compare
User-Agent as well, for example, but it doesn't appear there's a way to
access that on lookup(). This use case may or may not be enough to
actually code it -- I'll happily defer that decision to you and the team!
Here's some context of how I use this. In my case, I increment a memcache
counter with a relatively short TTL upon preauth failure, and after
in *y* seconds, I set a distinct memcache key with a relatively long TTL
that matches the source IP. The presence of that key is checked early in
the script to ignore traffic from blacklisted source IP addresses.
Here's to 3.2!
On Thu, Oct 8, 2020 at 9:47 AM Liviu Chircu <liviu at opensips.org> wrote:
> On 08.10.2020 16:40, Jeff Pyle wrote:
> > This loads the registered contacts as branches, which allows me to
> > iterate through each and compare 1) the base URI from the inbound
> > INVITE with the base URI of the registered contact, 2) the received IP
> > and 3) the received port. Assuming one matches, that's enough to
> > satisfy me that we've received a message from a registered endpoint.
> > I'm calling this route on initial INVITEs and so far, so good. There
> > are optimizations that could occur, such as exiting the while loop
> > once we've found a match, but at least this works.
> Interesting use case! Maybe we can formalize this into one or more
> extensions, so you can just call the appropriate functions. Here are
> your current problems which must be addressed:
> * is_ip_registered() is too imprecise, as it only takes the IP as input,
> while you'd want to match the URI and port as well.
> * is_contact_registered() is too precise, as it matches _everything_,
> including URI parameters which you'd like to skip.
> I've put this problem on the bucket list for 3.2 :) Cheers!
> Liviu Chircu
> www.twitter.com/liviuchircu | www.opensips-solutions.com
> Users mailing list
> Users at lists.opensips.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users