[SR-Users] auth by IP

Daniel Tryba d.tryba at pocos.nl
Fri Apr 19 10:22:05 CEST 2019

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:
(or one of the variants):

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

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

More information about the sr-users mailing list