|
|
|
@ -354,6 +354,16 @@ route[PREPARE_INITIAL_REQUESTS] |
|
|
|
} |
|
|
|
|
|
|
|
if (is_method("REGISTER")) { |
|
|
|
if (nat_uac_test("3")) { |
|
|
|
xlog("L_INFO", "$ci|log|Correcting NATed contact in registration\n"); |
|
|
|
force_rport(); |
|
|
|
|
|
|
|
setbflag(FLB_NATB); |
|
|
|
setbflag(FLB_NATSIPPING); |
|
|
|
|
|
|
|
fix_nated_register(); |
|
|
|
} |
|
|
|
|
|
|
|
if (is_present_hf("Authorization")) { |
|
|
|
if ($sht(auth_cache=>$Au) != $null && pv_auth_check("$fd", "$sht(auth_cache=>$Au)", "0", "0")) { |
|
|
|
xlog("L_INFO", "$ci|log|Authenticated $Au via cached SIP creds\n"); |
|
|
|
@ -364,7 +374,7 @@ route[PREPARE_INITIAL_REQUESTS] |
|
|
|
xlog("L_INFO", "$ci|log|Issued new auth challenge to failed registration attempt\n"); |
|
|
|
exit; |
|
|
|
} else { |
|
|
|
xlog("$ci|log|Caching SIP credentials for $Au\n"); |
|
|
|
xlog("L_INFO", "$ci|log|Caching SIP credentials for $Au\n"); |
|
|
|
$sht(auth_cache=>$Au) = $avp(password); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -377,16 +387,6 @@ route[PREPARE_INITIAL_REQUESTS] |
|
|
|
# user authenticated - remove auth header |
|
|
|
consume_credentials(); |
|
|
|
|
|
|
|
if (nat_uac_test("3")) { |
|
|
|
xlog("L_INFO", "$ci|log|Correcting NATed contact in registration\n"); |
|
|
|
force_rport(); |
|
|
|
|
|
|
|
setbflag(FLB_NATB); |
|
|
|
setbflag(FLB_NATSIPPING); |
|
|
|
|
|
|
|
fix_nated_register(); |
|
|
|
} |
|
|
|
|
|
|
|
save("location"); |
|
|
|
exit; |
|
|
|
} else if (!is_method("MESSAGE")) { |
|
|
|
|