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