Hi fellow kamailio users,

I'm playing actually with t_on_branch_failure, in a simultaneous forking scenario ( lookup("location") returns multiple contacts ).

Any idea on how to get those "on_branch_failure" working ?

Thanks in Advance !

* Test by putting failure_exec_mode:
- at 1 => no branch failure being called, never.
- at 0 => t_relay does not fail if a single branch answers the transaction, even if all other branches are failing.

* Test by moving the t_on_branch_failure("manage_branch_failure"); line before or after the lookup("location") or on a _on_branch route to set it per branch.
- The on_route branch are executed, but never the failure one.
- tried also with failure_exec_mode = 0 or 1.

* Using set_forward_no_connect, I can see in the logs a "Sending to branch X failed" but no failure route being executed. Without it, nothing in the logs indicating that the branch has timeout.

* Config extract:

# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3) # 3 by default
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)
modparam("tm", "reparse_on_dns_failover", 0)
# 1: Allow branches to have a per branch failure route
# 0: t_relay should fail if a branch fail
modparam("tm", "failure_exec_mode", 1)
# Allow locally generated 408 to be forgotten in case a reply is received.
#modparam("tm", "faked_reply_prio", 2000)


# USER location service
route[LOCATION] {
        t_on_branch_failure("manage_branch_failure");
        if (!lookup("location")) {
        ....
        }
        # Let's get back after 2.5s if no 100/Trying received.
        t_set_fr(0, 2500);
        # set_forward_no_connect();
        #t_on_branch("SET_BRANCH_FAILURE");
        route(RELAY);
        exit;
}

route[RELAY] {
        ....
        if (!t_relay()) {
                xlog("L_WARN","$rm|$ci|$fu|$tu|RELAY_FAILED");
                sl_reply_error();
        }
        exit();
}

# set failure route per branch
branch_route[SET_BRANCH_FAILURE] {
        xlog("L_WARN","$rm|$ci|$fu|$tu|SETTING_BrANCH_FAILURE_ROUTE");
        t_on_branch_failure("manage_branch_failure");
}

# manage failure routing cases per branch
event_route[tm:branch-failure:manage_branch_failure] {
        xlog("L_WARN","$rm|$ci|$fu|$tu[$avp(dest_to)]|MANAGE_BRANCH_FAILURE");
}