|
|
|
@ -16,6 +16,7 @@ |
|
|
|
#!define AVP_ROUTE_CNT "route_cnt" |
|
|
|
#!define AVP_ASSOCIATED_SERVER "associated_server" |
|
|
|
#!define AVP_ASSOCIATE_CONTACT "associate_contact" |
|
|
|
#!define AVP_REDIRECT_KEY "redirect_key" |
|
|
|
|
|
|
|
####### Flags ####### |
|
|
|
flags |
|
|
|
@ -475,9 +476,14 @@ onreply_route[INTERNAL_REPLY] |
|
|
|
xlog("L_INFO", "$ci|start|recieved internal reply $T_reply_code $rr"); |
|
|
|
xlog("L_INFO", "$ci|log|source $si:$sp"); |
|
|
|
|
|
|
|
if (t_check_status("(180)|(183)")) { |
|
|
|
xlog("L_INFO", "$ci|log|session progress, only listening for redirects"); |
|
|
|
if (t_check_status("(180)|(183)|(200)")) { |
|
|
|
xlog("L_INFO", "$ci|log|call setup, only listening for redirects"); |
|
|
|
setflag(FLAG_SESSION_PROGRESS); |
|
|
|
|
|
|
|
if ($avp(AVP_REDIRECT_KEY) != $null) { |
|
|
|
xlog("L_INFO", "$ci|log|removing redirect mapping for $avp(AVP_REDIRECT_KEY)"); |
|
|
|
$sht(associations=>$avp(AVP_REDIRECT_KEY)) = $null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($rs < 300) { |
|
|
|
@ -501,28 +507,32 @@ failure_route[INTERNAL_FAULT] |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
# if the failure case was something that we should recover |
|
|
|
# from then try to find a new media server |
|
|
|
# Handle redirects |
|
|
|
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->" |
|
|
|
+ @contact.uri.user + "@" + @contact.uri.host; |
|
|
|
if (t_check_status("302")) { |
|
|
|
## TODO - test this |
|
|
|
## get_redirects("*"); |
|
|
|
|
|
|
|
if($T_rpl($hdr(X-Redirect-Server)) != $null) { |
|
|
|
$var(from_uri) = @from.uri.user + "@" + @from.uri.host; |
|
|
|
$sht(associations=>$var(redirect)) = $T_rpl($hdr(X-Redirect-Server)); |
|
|
|
xlog("L_INFO", "$ci|log|stored redirect mapping for $var(redirect) to $T_rpl($hdr(X-Redirect-Server))"); |
|
|
|
} |
|
|
|
|
|
|
|
add_rcv_param("1"); |
|
|
|
|
|
|
|
$sht(associations=>$var(from_uri)) = $T_rpl($hdr(X-Redirect-Server)); |
|
|
|
} else if (!t_check_status("407")) { |
|
|
|
xlog("L_INFO", "$ci|log|removing redirect mapping for $var(redirect)"); |
|
|
|
$sht(associations=>$var(redirect)) = $null; |
|
|
|
} |
|
|
|
|
|
|
|
xlog("L_INFO", "$ci|log|stored redirect mapping for $var(contact_uri) to $T_rpl($hdr(X-Redirect-Server))"); |
|
|
|
remove_hf_re("X-.*"); |
|
|
|
|
|
|
|
remove_hf("X-Redirect-Server"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# change 6xx to 4xx |
|
|
|
if (t_check_status("6[0-9][0-9]")) { |
|
|
|
$var(new_code) = "4" + $(T_reply_code{s.substr,1,0}); |
|
|
|
xlog("L_INFO", "$ci|log|sending 6XX reply as $var(new_code) $var(reply_reason)"); |
|
|
|
t_reply("$(var(new_code){s.int})", "$var(reply_reason)"); |
|
|
|
t_reply("$(var(new_code){s.int})", "$var(reply_reason)"); |
|
|
|
|
|
|
|
# if the failure case was something that we should recover |
|
|
|
# from then try to find a new media server |
|
|
|
} else if ("$var(reply_reason)" =~ "call barred") { |
|
|
|
xlog("L_INFO", "$ci|log|failure route ignoring call barred"); |
|
|
|
} else if (isflagset(FLAG_SESSION_PROGRESS)) { |
|
|
|
|