Hello,
I don't recall how the r-uri domain is restored in this case to say what $rd should hold, however, what you can do is store the $rd inside an avp just after use_next_gw():
if (use_next_gw()) {
$avp(rd) = $rd;
}
and then just take the $avp(rd) when handling 401/7.
Cheers,
Daniel
HelloI have setup 2 gateways in my dr_rules: 5,6 - so the 2nd one is tried if the first fails.
The second one requires credentials.
When the first one fails: I execute the following code:
failure_route[ROUTEFAIL] {
if ( t_check_status("[345][0-9][0-9]") or (t_branch_timeout() and !t_branch_replied() )) {t_on_failure("ROUTEFAIL");if (use_next_gw()) {xlog("L_INFO","failure_route(ROUTEFAIL) @@ routing to: rd: $rd, ru:$ru, t_relay");t_relay();exit;}
then in the same ROUTEFAIL (before this code), I have
if (t_check_status("401|407")) {xlog("L_INFO","failure_route(ROUTEFAIL) @@ call to uac_auth(), $si rd: $rd\n");
.....
So, when the first gateway replies with a 404, it executes correctly the first block, finds the second gw and I see in the log that rd is set to its address.
Yet, when the 2nd gw replies with 401, rd is set to the very first gw. However, the pcap traces confirm it is indeed the second that replies this.
If this behaviour is correct, I cant seem to find the source IP of the gateway that replied to me, to retrieve credentials from the db.
version: kamailio 5.0.5 / 5.0.6 (tested on both)
Thank you for your helpJ
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com