<div dir="ltr">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!<div><br></div><div>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 <i>x</i> failures in <i>y</i> 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.</div><div><br></div><div>Here's to 3.2!</div><div><br></div><div><br></div><div>- Jeff</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 9:47 AM Liviu Chircu <<a href="mailto:liviu@opensips.org">liviu@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08.10.2020 16:40, Jeff Pyle wrote:<br>
><br>
> This loads the registered contacts as branches, which allows me to <br>
> iterate through each and compare 1) the base URI from the inbound <br>
> INVITE with the base URI of the registered contact, 2) the received IP <br>
> and 3) the received port.  Assuming one matches, that's enough to <br>
> satisfy me that we've received a message from a registered endpoint.  <br>
> I'm calling this route on initial INVITEs and so far, so good.  There <br>
> are optimizations that could occur, such as exiting the while loop <br>
> once we've found a match, but at least this works.<br>
<br>
Interesting use case!  Maybe we can formalize this into one or more <br>
extensions, so you can just call the appropriate functions.  Here are <br>
your current problems which must be addressed:<br>
<br>
* is_ip_registered() is too imprecise, as it only takes the IP as input, <br>
while you'd want to match the URI and port as well.<br>
* is_contact_registered() is too precise, as it matches _everything_, <br>
including URI parameters which you'd like to skip.<br>
<br>
I've put this problem on the bucket list for 3.2 :)  Cheers!<br>
<br>
-- <br>
Liviu Chircu<br>
<a href="http://www.twitter.com/liviuchircu" rel="noreferrer" target="_blank">www.twitter.com/liviuchircu</a> | <a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">www.opensips-solutions.com</a><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>