Remove artificial preconditioning + logging improvements

This commit is contained in:
herlesupreeth
2020-11-20 06:03:17 +01:00
parent 4c85358a81
commit acc05e6f59
2 changed files with 9 additions and 42 deletions

View File

@@ -282,7 +282,6 @@ modparam("htable", "htable", "natpingfrom=>size=8;autoexpire=600000;")
modparam("htable", "htable", "contact=>size=8;autoexpire=20") modparam("htable", "htable", "contact=>size=8;autoexpire=20")
modparam("htable", "htable", "a=>size=8;autoexpire=20") modparam("htable", "htable", "a=>size=8;autoexpire=20")
modparam("htable", "htable", "supported=>size=8;autoexpire=20")
#!ifdef WITH_IMS_HDR_CACHE #!ifdef WITH_IMS_HDR_CACHE
modparam("htable", "htable", "serviceroutes=>size=16;autoexpire=14400;") modparam("htable", "htable", "serviceroutes=>size=16;autoexpire=14400;")
@@ -470,7 +469,7 @@ modparam("statistics", "variable", "register_time")
# - processing of any incoming SIP request starts with this route # - processing of any incoming SIP request starts with this route
route { route {
##!ifdef WITH_DEBUG ##!ifdef WITH_DEBUG
xlog("$rm ($fu ($si:$sp) to $tu, $ci)\n"); xnotice("PCSCF: $rm $ru ($fu ($si:$sp) to $tu, $ci)\n");
##!endif ##!endif
#!ifdef WITH_WEBSOCKET #!ifdef WITH_WEBSOCKET
@@ -496,11 +495,6 @@ route {
exit; exit;
} }
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# handle retransmissions # handle retransmissions
if(t_precheck_trans()) { if(t_precheck_trans()) {
t_check_trans(); t_check_trans();
@@ -511,6 +505,11 @@ route {
# Check for Re-Transmissions # Check for Re-Transmissions
t_check_trans(); t_check_trans();
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
if (is_method("UPDATE")) { if (is_method("UPDATE")) {
send_reply("403","Forbidden - Target refresh outside dialog not allowed"); send_reply("403","Forbidden - Target refresh outside dialog not allowed");
break; break;
@@ -778,44 +777,23 @@ route[RELAY] {
# Handle requests within SIP dialogs # Handle requests within SIP dialogs
route[WITHINDLG] { route[WITHINDLG] {
if (has_totag()) { if (has_totag()) {
xnotice("Within DLG"); xnotice("Within DLG\n");
# sequential request withing a dialog should # sequential request withing a dialog should
# take the path determined by record-routing # take the path determined by record-routing
if (loose_route()) { if (loose_route()) {
xnotice("Within loose route"); xnotice("Within loose route\n");
if(!isdsturiset()) { if(!isdsturiset()) {
handle_ruri_alias(); handle_ruri_alias();
#if ($rc == 1) { #if ($rc == 1) {
# $ru = "sip:" + $rU + "@" + $dd + ":" + $dp + ";transport=" + $rP; # $ru = "sip:" + $rU + "@" + $dd + ":" + $dp + ";transport=" + $rP;
#} #}
} }
if ( is_method("ACK") && ($sht(contact=>$ci) != $null) ) { if ( is_method("ACK") && ($sht(contact=>$ci) != $null) ) {
xlog("Contact of Reply: $sht(contact=>$ci) ($ci)\n"); xlog("Contact of Reply: $sht(contact=>$ci) ($ci)\n");
$ru = $sht(contact=>$ci); $ru = $sht(contact=>$ci);
} }
# https://www.sharetechnote.com/html/IMS_SIP_Precondition.html
# https://www.sharetechnote.com/html/IMS_SIP_Precondition.html#Requirement_for_UPDATE
if (is_method("PRACK") && (($sht(supported=>$ci) =~ ".*precondition.*") || ($sht(supported=>$ci) =~ ".*precondition.*"))) {
if(!is_present_hf("Supported")) {
append_hf("Supported: 100rel,precondition\r\n");
} else {
remove_hf("Supported");
$var(new_supp) = $hdr(Supported);
if (!($hdr(Supported) =~ ".*precondition.*")) {
$var(new_supp) = $var(new_supp) + ",precondition";
}
if (!($hdr(Supported) =~ ".*100rel.*")) {
$var(new_supp) = $var(new_supp) + ",100rel";
}
append_hf("Supported: $var(new_supp)\r\n");
}
xnotice("Invite Supported: $sht(supported=>$ci)\n");
xnotice("Old Supported: $hdr(Supported)\n");
xnotice("New Supported: $var(new_supp)\n");
msg_apply_changes();
}
if ($route_uri =~ "sip:mt@.*") { if ($route_uri =~ "sip:mt@.*") {
route(MT_indialog); route(MT_indialog);
} else { } else {

View File

@@ -87,11 +87,6 @@ route[MO]
} }
set_dlg_profile("orig"); set_dlg_profile("orig");
t_on_reply("MO_reply"); t_on_reply("MO_reply");
# Store the supported header if INVITE
if (is_method("INVITE")) {
$sht(supported=>$ci) = $hdr(Supported);
}
} }
###################################################################### ######################################################################
@@ -112,12 +107,6 @@ onreply_route[MO_reply] {
ipsec_forward("location"); ipsec_forward("location");
#} #}
#!endif #!endif
# If reply 183/200 does not have Require: precondition then empty stored supported hash entry
if (t_check_status("183|200") && has_body("application/sdp")) {
if (is_present_hf("Require") && !($hdr(Require) =~ ".*precondition.*")) {
$sht(supported=>$ci) = $null;
}
}
# In case of 1xx and 2xx do NAT # In case of 1xx and 2xx do NAT
if(status=~"[12][0-9][0-9]") if(status=~"[12][0-9][0-9]")
route(NATMANAGE); route(NATMANAGE);