Browse Source

simplify internal redirects (#125)

* simplify internal redirects

* missing comma

* another missing comma
master
lazedo 6 years ago
committed by GitHub
parent
commit
679cd9bdcb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 21 deletions
  1. +10
    -21
      kamailio/default.cfg

+ 10
- 21
kamailio/default.cfg View File

@ -756,13 +756,9 @@ 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 + "->"
+ $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));
xlog("L_INFO", "$ci|log|stored redirect mapping $var(redirect) to $T_rpl($hdr(X-Redirect-Server))\n");
route(INTERNAL_REDIRECT);
} }
route(INTERNAL_REDIRECT);
} else if (!t_check_status("407") && } else if (!t_check_status("407") &&
$avp(AVP_REDIRECT_KEY) != $null && $avp(AVP_REDIRECT_KEY) != $null &&
$sht(redirects=>$avp(AVP_REDIRECT_KEY)) != $null $sht(redirects=>$avp(AVP_REDIRECT_KEY)) != $null
@ -809,24 +805,17 @@ failure_route[INTERNAL_FAULT]
route[INTERNAL_REDIRECT] route[INTERNAL_REDIRECT]
{ {
$var(ds_group) = 1;
$var(contact_uri) = $(ct{tobody.user}) + "@" + $(ct{tobody.host});
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->"
+ @ruri.user + "@" + @ruri.host;
if ($sht(redirects=>$var(redirect)) != $null) {
$var(prefered_route) = $sht(redirects=>$var(redirect));
xlog("L_INFO", "$ci|log|found redirect for $var(redirect) : $var(prefered_route)\n");
$du = $var(prefered_route);
$avp(AVP_REDIRECT_KEY) = $var(redirect);
t_on_branch("MANAGE_BRANCH");
t_on_reply("INTERNAL_REPLY");
t_on_failure("INTERNAL_FAULT");
t_set_fr(0, 1000);
t_relay();
exit();
}
xlog("L_INFO", "$ci|log|redirect to $T_rpl($hdr(X-Redirect-Server))\n");
$du = $T_rpl($hdr(X-Redirect-Server));
t_on_branch("MANAGE_BRANCH");
t_on_reply("INTERNAL_REPLY");
t_on_failure("INTERNAL_FAULT");
t_set_fr(0, 1000);
t_relay();
exit();
} }
onsend_route { onsend_route {
if (isflagset(FLAG_ASSOCIATE_USER) && is_request()) { if (isflagset(FLAG_ASSOCIATE_USER) && is_request()) {
$var(user_source) = $(ct{tobody.user}) + "@" + $si + ":" + $sp; $var(user_source) = $(ct{tobody.user}) + "@" + $si + ":" + $sp;


Loading…
Cancel
Save