I looked a bit and dst uri is not saved directly in the transaction branch structure, so there needs to be a larger patch involved to add this enhancement.

Is this fact the reason why $du does not hold the last used value in subsequent runs of the branch_failure_route? Example:

branch_route[PROVIDER_BRANCH] {
    xlog("L_NOTICE", "--- SCRIPT_PROVIDER_BRANCH: Will try setting dialog profile for du: $du\n");
    set_dlg_profile("outbound_providers", "$(du{uri.param,xdesc})");

event_route[tm:branch-failure:PROVIDER_FAILOVER] {
    xlog("L_NOTICE", "--- SCRIPT_PROVIDER_FAILOVER: Will try unsetting dialog profile for du: $du\n");

    unset_dlg_profile("outbound_providers", "$(du{uri.param,xdesc})");

	if (t_is_canceled()) exit;

    # next DST - only for 5xx or local timeout
    if ( t_check_status("5[[:digit:]]+") || (t_branch_timeout() && !t_branch_replied()) ) {
        if ( ds_next_dst() ) {
            xlog("L_NOTICE", "--- SCRIPT_PROVIDER_FAILOVER: A failover destination was selected: Forwarding to $du\n");
        } else {
            xlog("L_NOTICE", "--- SCRIPT_PROVIDER_FAILOVER: Giving Up. Negative response will be sent upstream.\n");

In this case, when the first branch fails, unset_dlg_profile will work (dst_uri was set in other route, not shown here).

Then the branch failure route will select the next $du as a result of ds_next_dst, and indeed a new branch is relayed to the next dst_uri.

If this second branch also fails, however, $du holds the initial dst_uri (of the first branch) when tm:branch-failure is executed a second time.

Sorry for tainting this thread if this is an unrelated issue.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.