<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Hi, Schneur!<br>
<br>
The second parameter of the </tt><tt><tt>is_ip_registered()
function[1] should be the AOR of the caller, in the </tt></tt><tt><tt><tt>sip:SIP_USER@SIP_DOMAIN
format. The source IP is only checked against the contacts of
that specific subscriber.<br>
</tt></tt></tt><tt><tt><tt><tt>However, if I understand
correctly, your problem is determining what is the correct
AOR to use, because the From username and domain might be
different between REGISTER and INVITE, right?</tt></tt></tt>
If that's the case, you don't have that many choices: either you
search through all registered IPs (but there is no OpenSIPS
function to do that, so you'll need someting external as you've
already done), or you create some sort of mappings between the
REGISTER and INVITE users/formats. Or you impose your customers to
comply with a specific format, that can help you figure out the
mapping.<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.2.x/registrar.html#id294953">http://www.opensips.org/html/docs/modules/2.2.x/registrar.html#id294953</a><br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 12/04/2016 01:20 PM, Schneur
Rosenberg wrote:<br>
</div>
<blockquote
cite="mid:CANvjR0XkgrB8sW6Ljh+uW_x_KSXSsWcDbyBdNKWdEEY3SHhoFQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hi, I would like to check during the initial
invite if the request comes from a IP that is registered (I
don't care about the user credentials at this time), I use it to
know if the invite is from a registered user or if it is from a
unauthenticated source (DID's or hacking attempt) I can't use
is_contact_registered() because not all clients send the user
name in the initial invite, and they only send it in the
authentication username which is absent in the initial invite,
therefore I want to use is_ip_registered() but I'm having issues
and I don't understand exactly what the second parameter is for,
I want to check for the ip in the $si variable if it is
registered (either in the contact field or in the received
field).
<div><br>
</div>
<div>When leaving blank the AOR field, some devices work well
but some don't.<br>
<br>
Due to NAT some devices register the IP in the contact field,
and some in the received field, I want to try to match to
either one, and it should parse the contact field that it
should ignore the username from the contact field.<br>
</div>
<div><br>
</div>
<div>I was doing a avp_db_query() until now, but it had 2 major
issues.<br>
<br>
1) It runs a MYSQL query on each REQUEST which reduces
performance, I couldn't use memcache because IP's are dynamic
in nature. <br>
2) I use db_mode 2 on usrloc and it takes about a minute for
the registration to appear in the DB and the user can't call
out during that minute, and even worse if he tries multiple
times and it gets rejected my iptables will block his IP.</div>
<div><br>
</div>
<div>thank you</div>
<div>S. Rosenberg</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>