Hello, Sorry for being slow to join the discussion.
The requirements I had for the branch-failure route was to be able to run t_next_contact_flow() etc. and also to retrieve the usrloc RUID so that the entry could be de-registered. The latter can be done with $T_reply_ruid.
As you and Daniel saw from the code, I replicated the behaviour of the 'failure-route' but with the current branch index. I didn't deliberately choose the behaviour of $ru etc. so I'm happy with it being classed as a bug if that's what's expected in this situation.
Does $T_req($ru) give something different in this situation?
Regards, Hugh
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Daniel-Constantin Mierla Sent: 14 April 2014 22:56 To: Juha Heinanen Cc: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] event_route[tm:branch-failure] question
On 14/04/14 21:15, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
To get the branch attributes, the code should be similar to execution of failure_route. In failure_route, the attributes are taken from winning branch. In branch-failure, the attributes should be taken from current branch. But in both cases is dealing with a branch
structure.
the code in t_reply.c for branch failure handling already looks very similar to failure handling. run_failure_handlers() use branch
on_failure = t->uac[picked_branch].on_failure;
whereas run_branch_failure_handlers() use branch
on_branch_failure = t->uac[picked_branch].on_branch_failure;
then both create faked request environment, run the route handler, and restore the original environment.
why the faked request in case of branch failure does not include correct $ru goes beyond my knowledge of tm module.
indeed, looking at the code, the failure-route and branch-failure events are using only the request in the uas side of the transaction. It will require writing some c code to get the attributes from uac structure. Most of them are stored there (uri, branch flags, path, ...) but some are not (dst_uri) ...
Cheers, Daniel
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
_______________________________________________ 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