[OpenSIPS-Users] Stop INVITE from uknown source

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Feb 26 13:38:52 CET 2015


Hi Satish,

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).

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:
     send_reply("403","Forbidden");
     exit;

Best regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 13.02.2015 17:07, Satish Patel wrote:
> I have question about how to stop INVITE coming from unknown source or 
> not subscribed user.
>
> I have opensips front end proxy and Freeswitch PSTN
>
> 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.
>
> As you see in Freeswitch section, if you see INVITE forward it to 
> Freeswitch, How do i check INVITE is authenticated or not?
>
> This is what i have in cfg.
>
> ....
> ....
>  if (is_from_local())
>                 {
>
>                         # authenticate if from local subscriber
>                         # authenticate all initial non-REGISTER 
> request that pretend to be
>                         # generated by local subscriber (domain from 
> FROM URI is local)
>                         if (!check_source_address("2")) {
>                         if (!proxy_authorize("", "subscriber")) {
>                                 proxy_challenge("", "0");
>                                 exit;
>                         }
>                         consume_credentials();
>                         # caller authenticated
>                         }
>                 } else {
>                         # if caller is not local, then called number 
> must be local
>
>                         if (!is_uri_host_local()) {
>                                 send_reply("403","Rely forbidden");
>                                 exit;
>                         }
>                 }
>
>         }
>
>  # To FreeSWITCH
>         if (is_method("INVITE")) {
>         if  ( uri=~"^sip:[1-9][0-9]{10,15}@.*") {
>                 xlog("Sending call to   ===> Freeswitch\n");
>                 route("to_dispatcher");
>                 exit;
>                 };
>         }
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150226/9493eba2/attachment.htm>


More information about the Users mailing list