|
|
|
@ -9,6 +9,7 @@ modparam("htable", "htable", "rate_limits=>initval=-1;autoexpire=60") # init |
|
|
|
#!trydef RATE_LIMIT_MESSAGE "Over rate Limit" |
|
|
|
#!trydef RATE_LIMIT_CODE "603" |
|
|
|
|
|
|
|
#!trydef IP_REGEX "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}" |
|
|
|
route[DOS_PREVENTION_REPLY] { |
|
|
|
setflag(FLAG_IS_REPLY); |
|
|
|
route(DOS_PREVENTION); |
|
|
|
@ -35,8 +36,8 @@ route[DOS_PREVENTION] { |
|
|
|
} |
|
|
|
|
|
|
|
# For BYE method we use REALM from To SIP header |
|
|
|
if (is_method("BYE")) { |
|
|
|
xlog("L_WARNING","$ci|RL-realm log| Fixup for BYE method with IP in from URI: use to-domain"); |
|
|
|
if ($fd =~ IP_REGEX) { |
|
|
|
xlog("L_WARNING","$ci|RL-realm log| Fixup for $rm method with IP in from URI: use to-domain"); |
|
|
|
$var(ltpm_realm) = $td+"/TOTAL/min"; |
|
|
|
$var(ltps_realm) = $td+"/TOTAL/sec"; |
|
|
|
$var(ltpm_device) = $fU+"@"+$td+"/TOTAL/min"; |
|
|
|
@ -66,8 +67,8 @@ route[DOS_PREVENTION] { |
|
|
|
} |
|
|
|
|
|
|
|
if (not_empty("$fU")) { |
|
|
|
if (is_method("BYE")) { |
|
|
|
xlog("L_WARNING","$ci|RL-realm log| Fixup for BYE method with IP in from URI: use to-domain"); |
|
|
|
if ($fd =~ IP_REGEX) { |
|
|
|
xlog("L_WARNING","$ci|RL-realm log| Fixup for $rm method with IP in from URI: use to-domain"); |
|
|
|
$var(entity) = $fU+"@"+$td; |
|
|
|
} else { |
|
|
|
$var(entity) = $fU+"@"+$fd; |
|
|
|
@ -152,8 +153,8 @@ route[DOS_PREVENTION] { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (is_method("BYE")) { |
|
|
|
xlog("L_WARNING","$ci|RL-device log| Fixup for BYE method with IP in from URI: use to-domain"); |
|
|
|
if ($fd =~ IP_REGEX) { |
|
|
|
xlog("L_WARNING","$ci|RL-device log| Fixup for $rm method with IP in from URI: use to-domain"); |
|
|
|
$var(entity) = $td; |
|
|
|
} else { |
|
|
|
$var(entity) = $fd; |
|
|
|
@ -169,9 +170,9 @@ route[DOS_PREVENTION] { |
|
|
|
|
|
|
|
route(DO_DOS_PREVENTION); |
|
|
|
if ( not_empty("$fU") ) { |
|
|
|
if (is_method("BYE")) { |
|
|
|
if ($fd =~ IP_REGEX) { |
|
|
|
$var(entity) = $fU+"@"+$td; |
|
|
|
xlog("L_WARNING","$ci|RL-device log| Fixup for BYE method with IP in from URI: use to-domain"); |
|
|
|
xlog("L_WARNING","$ci|RL-device log| Fixup for $rm method with IP in from URI: use to-domain"); |
|
|
|
} else { |
|
|
|
$var(entity) = $fU+"@"+$fd; |
|
|
|
} |
|
|
|
|