Hi Daniel,

Seems like I missed your reply.

I've tried with tcp only, and set_forward_no_connect is used also now.

The only log shown with debug=3 is, for the failing branch:

/usr/sbin/kamailio[60054]: [INVITE] ERROR: tm [../../forward.h:240]: msg_send_buffer():
 tcp_send failed
/usr/sbin/kamailio[60054]: [INVITE] DEBUG: tm [t_fwd.c:1524]: t_send_branch(): t_send_b
ranch: send to 67.188.119.56:50239 (3) failed
/usr/sbin/kamailio[60054]: [INVITE] WARNING: tm [t_fwd.c:1543]: t_send_branch(): ERROR:
 t_send_branch: sending request on branch 0 failed

And after ( or before ), the  logs shows sending to the other UA registered with the same account, no mention of branch failure route and t_relay replies true.

It seems like as there is one branch that was still connected ( tcp wise ), t_relay does not return a negative status, and the branch failure route is never called.

That works as expected if both Contacts have lost their tcp connection though ( t_relay returns a negative value ).

Reproduced just now with kamailio 4.4.0.


On 06/04/2015 07:17 AM, Daniel-Constantin Mierla wrote:
Hello,

have you tested only with tcp and set_forward_no_connect or also with udp?

If you run with debug=3, do you get any other hints about what happens there? Also, you can use debugger module with cfgtrace enabled to see what actions are executed.

Cheers,
Daniel

On 20/05/15 00:31, Tristan Mahé wrote:
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");
}



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com