<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><tt>Hi Satish,<br>
<br>
The scripting you use is authenticating only INVITEs (actually
all requests) coming from your own users (based on the SIP
domain in From header). IF the caller is not a local user, the
call is accepted only if callee is a local user (based on the
SIP domain in the RURI).<br>
<br>
If you simply want to decline any calls from non-local callers,
on the "else" branch of the "if(is_from_loca())" reject the call:<br>
send_reply("403","Forbidden");<br>
exit;<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
On 13.02.2015 17:07, Satish Patel wrote:<br>
</div>
<blockquote
cite="mid:CAPgF-foBMKeV14mkxSFRR4WL7scPYvOtpx86rympP0AtEY9O-g@mail.gmail.com"
type="cite">
<div dir="ltr">I have question about how to stop INVITE coming
from unknown source or not subscribed user.
<div><br>
</div>
<div>I have opensips front end proxy and Freeswitch PSTN <br>
</div>
<div><br>
</div>
<div>But recently i have seeing some calls coming from unknown
source and method is INVITE so it is sending direct INVITE to
opensips and opensips forwarding them to Freeswitch, How do i
tell opensip if INVITE from non-registered user then drop it. <br>
</div>
<div><br>
</div>
<div>As you see in Freeswitch section, if you see INVITE forward
it to Freeswitch, How do i check INVITE is authenticated or
not? </div>
<div><br>
</div>
<div>This is what i have in cfg. </div>
<div><br>
</div>
<div>....</div>
<div>....</div>
<div>
<div> if (is_from_local())</div>
<div> {</div>
<div><br>
</div>
<div> # authenticate if from local
subscriber</div>
<div> # authenticate all initial
non-REGISTER request that pretend to be</div>
<div> # generated by local subscriber
(domain from FROM URI is local)</div>
<div> if (!check_source_address("2")) {</div>
<div> if (!proxy_authorize("",
"subscriber")) {</div>
<div> proxy_challenge("", "0");</div>
<div> exit;</div>
<div> }</div>
<div> consume_credentials();</div>
<div> # caller authenticated</div>
<div> }</div>
<div> } else {</div>
<div> # if caller is not local, then
called number must be local</div>
<div><br>
</div>
<div> if (!is_uri_host_local()) {</div>
<div> send_reply("403","Rely
forbidden");</div>
<div> exit;</div>
<div> }</div>
<div> }</div>
<div><br>
</div>
<div> }</div>
</div>
<div><br>
</div>
<div>
<div> # To FreeSWITCH</div>
<div> if (is_method("INVITE")) {</div>
<div> if ( uri=~<a class="moz-txt-link-rfc2396E" href="mailto:^sip:[1-9][0-9]{10,15}@.*">"^sip:[1-9][0-9]{10,15}@.*"</a>) {</div>
<div> xlog("Sending call to ===>
Freeswitch\n");</div>
<div> route("to_dispatcher");</div>
<div> exit;</div>
<div> };</div>
<div> }</div>
</div>
<div><br>
</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>