Skip to content

Commit

Permalink
KAM26-27 remove headers and record_route on internal redirect
Browse files Browse the repository at this point in the history
* record_route and consume_credentials are not preserved as well as removal of headers like Route
  we need to "redo" those on internal redirect.
  a config option KZ_INTERNAL_REDIRECT_RESERVED_HEADERS was made to set which headers ishould be removed.
  it can be set at runtime with kamcmd cfg.set kazoo internal_redirect_reserved_headers <regex expression>

(cherry picked from commit ebb31d5)
  • Loading branch information
lazedo committed Jul 5, 2024
1 parent 9f4a436 commit 9c2d1db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kamailio/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,8 @@ failure_route[INTERNAL_FAULT]
route[INTERNAL_REDIRECT]
{
xlog("L_INFO", "redirect to $T_rpl($hdr(X-Redirect-Server))\n");
remove_hf_re_pv("$sel(cfg_get.kazoo.internal_redirect_reserved_headers)");
record_route();

if (ds_is_from_list(-1, 7, "$T_rpl($hdr(X-Redirect-Server))")) {
xlog("L_INFO", "found dispatcher redirect for $T_rpl($hdr(X-Redirect-Server)) => $var(ds_uri)\n");
Expand Down
2 changes: 2 additions & 0 deletions kamailio/defs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#!trydef OVERRIDE_MEDIA_REPLY_480 603

#!trydef KZ_RESERVED_HEADERS "^(X-AUTH|X-KAZOO|X-FS-|Referred-By)"
#!trydef KZ_INTERNAL_REDIRECT_RESERVED_HEADERS "^(Route|Proxy-Authorization)"


kazoo.to_internal_no_response_timer = EXTERNAL_TO_INTERNAL_NO_RESPONSE_TIMER descr "external to internal no response timer"
Expand All @@ -43,6 +44,7 @@ kazoo.to_external_no_response_18X_timer = INTERNAL_TO_EXTERNAL_NO_RESPONSE_18X_T
kazoo.override_media_reply_480 = OVERRIDE_MEDIA_REPLY_480 descr "sip code to send upstream when media returns 480 with session in progress"

kazoo.reserved_headers = KZ_RESERVED_HEADERS descr "headers that are removed"
kazoo.internal_redirect_reserved_headers = KZ_INTERNAL_REDIRECT_RESERVED_HEADERS descr "headers that are removed on internal redirect"

#!ifndef MY_HOSTNAME
#!substdef "!MY_HOSTNAME!$HN(f)!g"
Expand Down

0 comments on commit 9c2d1db

Please sign in to comment.