On Fri, Apr 19, 2019 at 09:44:14AM +0300, Yu Boot wrote:
> Following code snippet from default kamailio.cfg never gives 403 if you
> smart enough to set "fromdomain" parameter on Asterisk to Kamailio's IP. How
> to fix it? I want password-based registration (which is OK now) and permit
> calls via Kamailio only from permitted IPs.

TIMTOWTDI but a fairly generic and easily extendable way is to use the
permissions module:
https://www.kamailio.org/docs/modules/stable/modules/permissions.html#permissions.f.allow_source_address
(or one of the variants):

if (!allow_source_address() || (from_uri!=myself && uri!=myself)) {
        sl_send_reply("403","Not relaying");
        exit;
}


Your remark regarding authentication might result in something like:
if(!allow_source_address() || $au==$null)
{
        sl_send_reply("403","Go away!");
}

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to