Hello,
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
Testscenario:
route { setflag(0);
t_on_branch("1"); t_on_reply("1"); t_on_failure("1");
xlog("L_NOTICE", "[$rm] Request before relay: $mF"); t_relay(); }
branch_route[1] { xlog("L_NOTICE", "[$rm] Branch begin: $mF"); setflag(8); xlog("L_NOTICE", "[$rm] Branch end: $mF"); }
onreply_route[1] { xlog("L_NOTICE", "[$rm] Reply ($rs) begin: $mF"); setflag(4); xlog("L_NOTICE", "[$rm] Reply end: $mF"); }
failure_route[1] { xlog("L_NOTICE", "[$rm] Failure ($T_reply_code): $mF"); }
Log output on 3.x: [INVITE] Request begin: 00000000 [INVITE] Request before relay: 00000001 [INVITE] Branch begin: 00000001 [INVITE] Branch end: 00000101 [INVITE] Reply (100) begin: 00000001 [INVITE] Reply end: 00000011 [INVITE] Failure (408): 00000011
Log output on 1.4: [INVITE] Request begin: 00000000 [INVITE] Request before relay: 00000001 [INVITE] Branch begin: 00000001 [INVITE] Branch end: 00000101 [INVITE] Reply (100) begin: 00000101 [INVITE] Reply end: 00000111 [INVITE] Failure (408) begin: 00000111
On Monday 22 August 2011, Alex Hermann wrote:
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
This patch seems to restore old functionality. Would this be ok to commit?
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c index 30558ab..756e4b4 100644 --- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -1510,6 +1510,8 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , clear_branches();
setbflagsval(0, backup_bflags); + /* update flags, if changed in branch route */ + t->uas.request->flags = p_msg->flags;
/* don't forget to clear all branches processed so far */
Testscenario:
route { setflag(0);
t_on_branch("1"); t_on_reply("1"); t_on_failure("1");
xlog("L_NOTICE", "[$rm] Request before relay: $mF"); t_relay(); }
branch_route[1] { xlog("L_NOTICE", "[$rm] Branch begin: $mF"); setflag(8); xlog("L_NOTICE", "[$rm] Branch end: $mF"); }
onreply_route[1] { xlog("L_NOTICE", "[$rm] Reply ($rs) begin: $mF"); setflag(4); xlog("L_NOTICE", "[$rm] Reply end: $mF"); }
failure_route[1] { xlog("L_NOTICE", "[$rm] Failure ($T_reply_code): $mF"); }
Log output on 3.x: [INVITE] Request begin: 00000000 [INVITE] Request before relay: 00000001 [INVITE] Branch begin: 00000001 [INVITE] Branch end: 00000101 [INVITE] Reply (100) begin: 00000001 [INVITE] Reply end: 00000011 [INVITE] Failure (408): 00000011
Log output on 1.4: [INVITE] Request begin: 00000000 [INVITE] Request before relay: 00000001 [INVITE] Branch begin: 00000001 [INVITE] Branch end: 00000101 [INVITE] Reply (100) begin: 00000101 [INVITE] Reply end: 00000111 [INVITE] Failure (408) begin: 00000111
On Monday 22 August 2011 16:43:43 Alex Hermann wrote:
On Monday 22 August 2011, Alex Hermann wrote:
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
This patch seems to restore old functionality. Would this be ok to commit?
Nevermind, i just found t_flush_flags(), which does exactly what i need.
Hello,
On 8/22/11 6:35 PM, Alex Hermann wrote:
On Monday 22 August 2011 16:43:43 Alex Hermann wrote:
On Monday 22 August 2011, Alex Hermann wrote:
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
This patch seems to restore old functionality. Would this be ok to commit?
Nevermind, i just found t_flush_flags(), which does exactly what i need.
was the auto-update of the flags in 1.x? That would have made t_flush_flags() redundant, or maybe the auto-update was in branch route and t_flush_flags() purpose was for failure_route. I want to be sure we don't omit things from 1.x -- t_flush_flags() was also forgotten, added later after a report from Juha.
Thanks, Daniel
On Thursday 25 August 2011, Daniel-Constantin Mierla wrote:
Hello,
On 8/22/11 6:35 PM, Alex Hermann wrote:
On Monday 22 August 2011 16:43:43 Alex Hermann wrote:
On Monday 22 August 2011, Alex Hermann wrote:
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
This patch seems to restore old functionality. Would this be ok to commit?
Nevermind, i just found t_flush_flags(), which does exactly what i need.
was the auto-update of the flags in 1.x? That would have made t_flush_flags() redundant, or maybe the auto-update was in branch route and t_flush_flags() purpose was for failure_route. I want to be sure we don't omit things from 1.x -- t_flush_flags() was also forgotten, added later after a report from Juha.
In 1.4, message flags were updated in the transaction unconditionally after branch_route had run. The patch i provided is an exact copy of the relevant code from 1.4 and provides backward compatibility.
Adding t_flush_flags() to the end of branch_route in the script accomplishes the same functionality, but requires a script update by the user.
IIRC, flags were also copied to the transaction from failure_route in 1.4. Haven't tested though.
On 8/25/11 1:02 PM, Alex Hermann wrote:
On Thursday 25 August 2011, Daniel-Constantin Mierla wrote:
Hello,
On 8/22/11 6:35 PM, Alex Hermann wrote:
On Monday 22 August 2011 16:43:43 Alex Hermann wrote:
On Monday 22 August 2011, Alex Hermann wrote:
It seems kamailio 3 does not save message flags set in branch route into the transaction. In reply_route and failure_route the flag set in branch_route is unset. In 1.4 this used to work. I would like to get that behaviour back, is this possible?
This patch seems to restore old functionality. Would this be ok to commit?
Nevermind, i just found t_flush_flags(), which does exactly what i need.
was the auto-update of the flags in 1.x? That would have made t_flush_flags() redundant, or maybe the auto-update was in branch route and t_flush_flags() purpose was for failure_route. I want to be sure we don't omit things from 1.x -- t_flush_flags() was also forgotten, added later after a report from Juha.
In 1.4, message flags were updated in the transaction unconditionally after branch_route had run. The patch i provided is an exact copy of the relevant code from 1.4 and provides backward compatibility.
I see, then we should add the patch. Using t_flush_flags() will become redundant for this case, but harmless.
Adding t_flush_flags() to the end of branch_route in the script accomplishes the same functionality, but requires a script update by the user.
IIRC, flags were also copied to the transaction from failure_route in 1.4. Haven't tested though.
We have to check and make it the same. The t_flush_flags() will stay then for the route blocks, where the transaction is created with t_newtrans() -- which seems to be its description in 1.4.x:
http://www.kamailio.org/docs/modules/1.4.x/tm.html#id2531069
Cheers, Daniel