Browse Source

check authorization for anoymous

master
lazedo 6 years ago
parent
commit
d5b746cf45
2 changed files with 19 additions and 3 deletions
  1. +13
    -1
      kamailio/auth.cfg
  2. +6
    -2
      kamailio/default.cfg

+ 13
- 1
kamailio/auth.cfg View File

@ -64,7 +64,7 @@ route[SETUP_AUTH_HEADERS]
#!ifdef REGISTRAR_ROLE
$avp(is_registered) = "false";
$xavp(regcfg=>match_received) = $su;
if (registered("location","$fu", 2, 1) == 1) {
if (registered("location","sip:$Au", 2, 1) == 1) {
$avp(is_registered) = "true";
$avp(auth_allowed) = "true";
#!ifdef WITH_AUTH_TOKEN
@ -73,6 +73,18 @@ route[SETUP_AUTH_HEADERS]
route(AUTH_CCVS)
#!endif
return;
} else if(is_present_hf("Proxy-Authorization")) {
if(registered("location", "sip:$au@$ar", 2, 1) == 1) {
xlog("L_INFO", "$ci|auth|from sip:$au@$ar\n");
$avp(is_registered) = "true";
$avp(auth_allowed) = "true";
#!ifdef WITH_AUTH_TOKEN
route(AUTH_TOKEN);
#!else
route(AUTH_CCVS)
#!endif
return;
}
}
#!endif


+ 6
- 2
kamailio/default.cfg View File

@ -632,8 +632,12 @@ route[SETUP]
{
if($sel(cfg_get.kazoo.strict_auth) == 1 && $avp(auth_allowed) != "true") {
xlog("L_WARN", "$ci|auth|request denied\n");
sl_reply("403", "Please Register");
if(is_present_hf("Proxy-Authorization")) {
xlog("L_WARN", "$ci|auth|request denied\n");
} else {
xlog("L_INFO", "$ci|auth|challenging invite\n");
proxy_challenge("$td", "4");
}
exit;
}


Loading…
Cancel
Save