[sr-dev] [kamailio/kamailio] tmx: t_reuse_branch() doesn't copy $du into new branch (#1264)

George Diamantopoulos notifications at github.com
Mon Jan 27 18:48:23 CET 2020


> 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");
            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");
        }
    }
}
```
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 or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1264#issuecomment-578868723
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200127/159a57a3/attachment.html>


More information about the sr-dev mailing list