[SR-Users] Avoiding to send 603 DECLINED to un-trusted IPs - Is that possible with Kamilio?
Klaus Darilion
klaus.mailinglists at pernau.at
Mon Jul 25 20:56:06 CEST 2011
Am 25.07.2011 18:44, schrieb Andrade Ricardo (CI/AFU1):
> Hello Bruce,
>
> Strangely, I've never gotten an Anonymous INVITE rejected by Asterisk
> with 603, but that was the version 1.4.
> Let me try to help with your request for a solution with Kamailio.
>
> These few lines could be added to your main route, after the place where
> your handle the registration. It will block any request from
> unregistered users:
> Route {
> ...
> if (!registered("location")) {
> {
> exit;
> }
> ...
> }
This helps if you want to check if the called target is registered. If
you want to know if the source of the INVITE is a registered client then
there is no existing function to do that, but you could that easily do
with sqlops module and a manual SQL query, e.g. some pseudo code:
$var(pattern) = "%" + $si + "%";
if (SELECT COUNT(*) FROM location WHERE received LIKE $var(pattern))
# sender is registered, allow
...
else
# sender is not registered, ignore
exit
Make sure to use db_mode 1 or 3:
http://www.kamailio.org/docs/modules/3.1.x/modules_k/usrloc.html#id2995804
regards
Klaus
>
> I am assuming that you refer to the subscribers registered in the
> location table as "peers", I mean, they should be registered in
> Kamailio, not in asterisk. If not, you can do something similar with
> some database query. But let us know if that is the case.
>
> Perhaps you'd be interested in these next ones as well, they helped me a
> short while ago to workaround on some issues with the code 603:
>
> Module configurations:
> modparam("tm", "disable_6xx_block", 1)
>
> onreply_route
> {
> if ($T_reply_code == "603")
> {
> drop;
> }
> }
>
> Best regards,
> Ricardo.
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
More information about the sr-users
mailing list