Hello,
the function can be committed.
For the variable, I would go for a new class, $T_branch(attr). You can
implement the part for flags as $T_branch(flags). Other attributes can
be implemented later under the same class.
Cheers,
Daniel
On 19/04/14 14:57, Juha Heinanen wrote:
as per daniel's suggestion, i wrote a new tmx
function t_reuse_branch(),
which can currently be called from branch-failure route:
/**
* Creates new "main" branch by making copy of branch-failure branch.
* Currently the following branch attributes are included:
* request-uri, ruid, path, instance, and branch flags.
*/
static int w_t_reuse_branch(struct sip_msg* msg, char *p1, char *p2)
{
struct cell *t;
int branch;
if (msg == NULL) return -1;
/* first get the transaction */
if (_tmx_tmb.t_check(msg, 0) == -1) return -1;
if ((t = _tmx_tmb.t_gett()) == 0) {
LM_ERR("no transaction\n");
return -1;
}
switch (get_route_type()) {
case BRANCH_FAILURE_ROUTE:
/* use the reason of the winning reply */
if ((branch = _tmx_tmb.t_get_picked_branch()) < 0) {
LM_CRIT("no picked branch (%d) for a final response"
" in MODE_ONFAILURE\n", branch);
return -1;
}
rewrite_uri(msg, &(t->uac[branch].uri));
set_ruid(msg, &(t->uac[branch].ruid));
if (t->uac[branch].path.len) {
set_path_vector(msg, &(t->uac[branch].path));
} else {
reset_path_vector(msg);
}
setbflagsval(0, t->uac[branch].flags);
set_instance(msg, &(t->uac[branch].instance));
return 1;
default:
LM_ERR("unsupported route_type %d\n", get_route_type());
return -1;
}
}
the new "main" branch does not include destination uri and socket,
because i didn't find them in struct ua_client. unless someone adds
them to struct ua_clients, they thus need to be set separately from
htable after calling t_reuse_branch().
is it ok that i commit the above function to tmx module?
in addition, i would like to add $T_reply_bf (branch flags) pv, since i
need to test some of the branch flags in other parts of branch-failure
route.
-- juha
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev