<blockquote>
<p>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.</p>
</blockquote>
<p>Is this fact the reason why $du does not hold the last used value in subsequent runs of the branch_failure_route? Example:</p>
<pre><code>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");
t_on_branch("PROVIDER_BRANCH");
t_on_branch_failure("PROVIDER_FAILOVER");
t_on_failure("TRY_OTHER");
route(RELAY);
exit;
} else {
xlog("L_NOTICE", "--- SCRIPT_PROVIDER_FAILOVER: Giving Up. Negative response will be sent upstream.\n");
}
}
}
</code></pre>
<p>In this case, when the first branch fails, unset_dlg_profile will work (dst_uri was set in other route, not shown here).</p>
<p>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.</p>
<p>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.</p>
<p>Sorry for tainting this thread if this is an unrelated issue.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1264?email_source=notifications&email_token=ABO7UZPNF2UFE564KHPGTFDQ74M6PA5CNFSM4D6CJRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKANL4Y#issuecomment-578868723">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN6DFJT65VPLGHDCVDQ74M6PANCNFSM4D6CJRZQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZL6SF64D77GVL5IH7LQ74M6PA5CNFSM4D6CJRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKANL4Y.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1264?email_source=notifications\u0026email_token=ABO7UZPNF2UFE564KHPGTFDQ74M6PA5CNFSM4D6CJRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKANL4Y#issuecomment-578868723",
"url": "https://github.com/kamailio/kamailio/issues/1264?email_source=notifications\u0026email_token=ABO7UZPNF2UFE564KHPGTFDQ74M6PA5CNFSM4D6CJRZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKANL4Y#issuecomment-578868723",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>