|
|
@ -98,9 +98,6 @@ dns_try_naptr = no |
|
|
use_dns_failover = off |
|
|
use_dns_failover = off |
|
|
dns_srv_lb = off |
|
|
dns_srv_lb = off |
|
|
|
|
|
|
|
|
####### TLS Parameters ######### |
|
|
|
|
|
enable_tls = yes |
|
|
|
|
|
|
|
|
|
|
|
####### SCTP Parameters ######### |
|
|
####### SCTP Parameters ######### |
|
|
disable_sctp = yes |
|
|
disable_sctp = yes |
|
|
|
|
|
|
|
|
@ -130,7 +127,7 @@ loadmodule "sl.so" |
|
|
######## Record-Route and Route module ######## |
|
|
######## Record-Route and Route module ######## |
|
|
loadmodule "rr.so" |
|
|
loadmodule "rr.so" |
|
|
modparam("rr", "enable_full_lr", 1) |
|
|
modparam("rr", "enable_full_lr", 1) |
|
|
modparam("rr", "enable_double_rr", 0) |
|
|
|
|
|
|
|
|
modparam("rr", "enable_double_rr", 1) |
|
|
|
|
|
|
|
|
######## Max-Forward processor module ######## |
|
|
######## Max-Forward processor module ######## |
|
|
loadmodule "maxfwd.so" |
|
|
loadmodule "maxfwd.so" |
|
|
@ -185,6 +182,9 @@ include_file "presence-role.cfg" |
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
include_file "nat-traversal-role.cfg" |
|
|
include_file "nat-traversal-role.cfg" |
|
|
#!endif |
|
|
#!endif |
|
|
|
|
|
#!ifdef WEBSOCKETS-ROLE |
|
|
|
|
|
include_file "websockets-role.cfg" |
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
|
####### Kazoo Integration module ########## |
|
|
####### Kazoo Integration module ########## |
|
|
#!ifdef INCLUDE-DB-KAZOO |
|
|
#!ifdef INCLUDE-DB-KAZOO |
|
|
@ -221,6 +221,10 @@ route |
|
|
route(DOS_PREVENTION); |
|
|
route(DOS_PREVENTION); |
|
|
#!endif |
|
|
#!endif |
|
|
|
|
|
|
|
|
|
|
|
#!ifdef WEBSOCKETS-ROLE |
|
|
|
|
|
route(HANDLE_WEBSOCKETS); |
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
|
route(HANDLE_OPTIONS); |
|
|
route(HANDLE_OPTIONS); |
|
|
|
|
|
|
|
|
route(HANDLE_NOTIFY); |
|
|
route(HANDLE_NOTIFY); |
|
|
@ -254,7 +258,7 @@ route |
|
|
route(EXTERNAL_TO_INTERNAL_RELAY); |
|
|
route(EXTERNAL_TO_INTERNAL_RELAY); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[SANITY_CHECK] |
|
|
|
|
|
|
|
|
route[SANITY_CHECK] |
|
|
{ |
|
|
{ |
|
|
if (!mf_process_maxfwd_header("10")) { |
|
|
if (!mf_process_maxfwd_header("10")) { |
|
|
xlog("L_WARN", "$ci|end|too much hops, not enough barley"); |
|
|
xlog("L_WARN", "$ci|end|too much hops, not enough barley"); |
|
|
@ -262,12 +266,6 @@ route[SANITY_CHECK] |
|
|
exit; |
|
|
exit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( msg:len > 6144 ) { |
|
|
|
|
|
xlog("L_WARN", "$ci|end|message too large"); |
|
|
|
|
|
send_reply("513", "Message too large"); |
|
|
|
|
|
exit; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!sanity_check()) { |
|
|
if (!sanity_check()) { |
|
|
xlog("L_WARN", "$ci|end|message is insane"); |
|
|
xlog("L_WARN", "$ci|end|message is insane"); |
|
|
exit; |
|
|
exit; |
|
|
@ -281,7 +279,7 @@ route[SANITY_CHECK] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[HANDLE_OPTIONS] |
|
|
|
|
|
|
|
|
route[HANDLE_OPTIONS] |
|
|
{ |
|
|
{ |
|
|
if (is_method("OPTIONS")) { |
|
|
if (is_method("OPTIONS")) { |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
@ -298,7 +296,7 @@ route[HANDLE_OPTIONS] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[HANDLE_NOTIFY] |
|
|
|
|
|
|
|
|
route[HANDLE_NOTIFY] |
|
|
{ |
|
|
{ |
|
|
if (is_method("NOTIFY")) { |
|
|
if (is_method("NOTIFY")) { |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
@ -344,13 +342,18 @@ route[HANDLE_MOVE_REQUEST] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[HANDLE_IN_DIALOG_REQUESTS] |
|
|
|
|
|
|
|
|
route[HANDLE_IN_DIALOG_REQUESTS] |
|
|
{ |
|
|
{ |
|
|
if (has_totag()) { |
|
|
if (has_totag()) { |
|
|
if (is_method("INVITE")) { |
|
|
if (is_method("INVITE")) { |
|
|
record_route(); |
|
|
record_route(); |
|
|
} |
|
|
} |
|
|
if (loose_route()) { |
|
|
if (loose_route()) { |
|
|
|
|
|
if (isdsturiset() && !handle_ruri_alias()) { |
|
|
|
|
|
xlog("L_INFO", "$ci|stop|Bad alias <$ru>\n"); |
|
|
|
|
|
sl_send_reply("400", "Bad Request"); |
|
|
|
|
|
exit; |
|
|
|
|
|
} |
|
|
xlog("L_INFO", "$ci|log|loose_route in-dialog message"); |
|
|
xlog("L_INFO", "$ci|log|loose_route in-dialog message"); |
|
|
# Called on in-dialog requests |
|
|
# Called on in-dialog requests |
|
|
# If the request in an Invite for on hold from external to internal, |
|
|
# If the request in an Invite for on hold from external to internal, |
|
|
@ -374,7 +377,7 @@ route[HANDLE_IN_DIALOG_REQUESTS] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[PREPARE_INITIAL_REQUESTS] |
|
|
|
|
|
|
|
|
route[PREPARE_INITIAL_REQUESTS] |
|
|
{ |
|
|
{ |
|
|
if (is_method("CANCEL")) { |
|
|
if (is_method("CANCEL")) { |
|
|
if (t_check_trans()) { |
|
|
if (t_check_trans()) { |
|
|
@ -403,7 +406,7 @@ route[PREPARE_INITIAL_REQUESTS] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[RELAY] |
|
|
|
|
|
|
|
|
route[RELAY] |
|
|
{ |
|
|
{ |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
@ -414,7 +417,7 @@ route[RELAY] |
|
|
exit(); |
|
|
exit(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[INTERNAL_TO_EXTERNAL_RELAY] |
|
|
|
|
|
|
|
|
route[INTERNAL_TO_EXTERNAL_RELAY] |
|
|
{ |
|
|
{ |
|
|
remove_hf_re("X-.*"); |
|
|
remove_hf_re("X-.*"); |
|
|
|
|
|
|
|
|
@ -425,7 +428,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY] |
|
|
t_relay(); |
|
|
t_relay(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
route[EXTERNAL_TO_INTERNAL_RELAY] |
|
|
|
|
|
|
|
|
route[EXTERNAL_TO_INTERNAL_RELAY] |
|
|
{ |
|
|
{ |
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
if (!isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
if (!isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
@ -454,14 +457,14 @@ route[DOS_PREVENTION] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# drop requests with no To domain or IP To domain (friendly-scanner) |
|
|
# drop requests with no To domain or IP To domain (friendly-scanner) |
|
|
if (is_method("REGISTER|SUBSCRIBE|OPTIONS") && |
|
|
|
|
|
|
|
|
if (is_method("REGISTER|SUBSCRIBE|OPTIONS") && |
|
|
($td == $null || $td=~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}")) { |
|
|
($td == $null || $td=~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}")) { |
|
|
xlog("L_WARN", "$ci|log|dropping request with IP domain in To header"); |
|
|
xlog("L_WARN", "$ci|log|dropping request with IP domain in To header"); |
|
|
exit; |
|
|
exit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# drop Invite with IP auth realm |
|
|
# drop Invite with IP auth realm |
|
|
if (is_method("INVITE") && is_present_hf("Proxy-Authorization") && |
|
|
|
|
|
|
|
|
if (is_method("INVITE") && is_present_hf("Proxy-Authorization") && |
|
|
$ar =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}" ) { |
|
|
$ar =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}" ) { |
|
|
xlog("L_WARN", "$ci|log|dropping request with IP domain in Proxy-Authorization header"); |
|
|
xlog("L_WARN", "$ci|log|dropping request with IP domain in Proxy-Authorization header"); |
|
|
exit; |
|
|
exit; |
|
|
@ -477,10 +480,14 @@ route[DOS_PREVENTION] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onreply_route[EXTERNAL_REPLY] |
|
|
|
|
|
|
|
|
onreply_route[EXTERNAL_REPLY] |
|
|
{ |
|
|
{ |
|
|
xlog("L_INFO", "$ci|log|external reply $T_reply_code"); |
|
|
xlog("L_INFO", "$ci|log|external reply $T_reply_code"); |
|
|
|
|
|
|
|
|
|
|
|
#!ifdef WEBSOCKETS-ROLE |
|
|
|
|
|
route(NAT_WEBSOCKETS_CORRECT); |
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
#!ifdef NAT-TRAVERSAL-ROLE |
|
|
route(NAT_TEST_AND_CORRECT); |
|
|
route(NAT_TEST_AND_CORRECT); |
|
|
#!endif |
|
|
#!endif |
|
|
@ -492,11 +499,15 @@ onreply_route[INTERNAL_REPLY] |
|
|
xlog("L_INFO", "$ci|start|recieved internal reply $T_reply_code $rr"); |
|
|
xlog("L_INFO", "$ci|start|recieved internal reply $T_reply_code $rr"); |
|
|
xlog("L_INFO", "$ci|log|source $si:$sp"); |
|
|
xlog("L_INFO", "$ci|log|source $si:$sp"); |
|
|
|
|
|
|
|
|
|
|
|
#!ifdef WEBSOCKETS-ROLE |
|
|
|
|
|
route(NAT_WEBSOCKETS_CORRECT); |
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
|
if (is_method("INVITE") && |
|
|
if (is_method("INVITE") && |
|
|
!isflagset(FLAG_SESSION_PROGRESS) && |
|
|
!isflagset(FLAG_SESSION_PROGRESS) && |
|
|
t_check_status("(180)|(183)|(200)") |
|
|
t_check_status("(180)|(183)|(200)") |
|
|
) { |
|
|
) { |
|
|
if ($avp(AVP_REDIRECT_KEY) != $null && |
|
|
|
|
|
|
|
|
if ($avp(AVP_REDIRECT_KEY) != $null && |
|
|
$sht(redirects=>$avp(AVP_REDIRECT_KEY)) != $null |
|
|
$sht(redirects=>$avp(AVP_REDIRECT_KEY)) != $null |
|
|
) { |
|
|
) { |
|
|
xlog("L_INFO", "$ci|log|removing redirect mapping $avp(AVP_REDIRECT_KEY)"); |
|
|
xlog("L_INFO", "$ci|log|removing redirect mapping $avp(AVP_REDIRECT_KEY)"); |
|
|
@ -513,8 +524,7 @@ onreply_route[INTERNAL_REPLY] |
|
|
$var(reply_reason) = $rr; |
|
|
$var(reply_reason) = $rr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
failure_route[INTERNAL_FAULT] |
|
|
|
|
|
|
|
|
failure_route[INTERNAL_FAULT] |
|
|
{ |
|
|
{ |
|
|
# this branch handles failures (>=300) to our media servers, |
|
|
# this branch handles failures (>=300) to our media servers, |
|
|
# which we can sometimes overcome by routing to another server |
|
|
# which we can sometimes overcome by routing to another server |
|
|
@ -529,7 +539,7 @@ failure_route[INTERNAL_FAULT] |
|
|
|
|
|
|
|
|
# Handle redirects |
|
|
# Handle redirects |
|
|
if (t_check_status("302")) { |
|
|
if (t_check_status("302")) { |
|
|
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->" |
|
|
|
|
|
|
|
|
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->" |
|
|
+ $T_rpl($(ct{tobody.user})) + "@" + $T_rpl($(ct{tobody.host})); |
|
|
+ $T_rpl($(ct{tobody.user})) + "@" + $T_rpl($(ct{tobody.host})); |
|
|
if($T_rpl($hdr(X-Redirect-Server)) != $null) { |
|
|
if($T_rpl($hdr(X-Redirect-Server)) != $null) { |
|
|
$sht(redirects=>$var(redirect)) = $T_rpl($hdr(X-Redirect-Server)); |
|
|
$sht(redirects=>$var(redirect)) = $T_rpl($hdr(X-Redirect-Server)); |
|
|
@ -564,11 +574,11 @@ failure_route[INTERNAL_FAULT] |
|
|
send_reply("486", "Insufficient Funds"); |
|
|
send_reply("486", "Insufficient Funds"); |
|
|
} else if (t_check_status("(4[0-9][0-9])|(5[0-9][0-9])")) { |
|
|
} else if (t_check_status("(4[0-9][0-9])|(5[0-9][0-9])")) { |
|
|
xlog("L_INFO", "$ci|start|received failure reply $T_reply_code $rr"); |
|
|
xlog("L_INFO", "$ci|start|received failure reply $T_reply_code $rr"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#!ifdef DISPATCHER-ROLE |
|
|
#!ifdef DISPATCHER-ROLE |
|
|
route(DISPATCHER_NEXT_ROUTE); |
|
|
route(DISPATCHER_NEXT_ROUTE); |
|
|
#!endif |
|
|
#!endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
send_reply("486", "Unable to Comply"); |
|
|
send_reply("486", "Unable to Comply"); |
|
|
} else { |
|
|
} else { |
|
|
xlog("L_INFO", "$ci|log|failure route ignoring reply $T_reply_code $rr"); |
|
|
xlog("L_INFO", "$ci|log|failure route ignoring reply $T_reply_code $rr"); |
|
|
|