Module: kamailio
Branch: 5.3
Commit: c25035409c1f03c2f6fd24dd5f96eb28db5f3099
URL:
https://github.com/kamailio/kamailio/commit/c25035409c1f03c2f6fd24dd5f96eb2…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-30T14:46:26+01:00
tm: Fix faked_reply_prio by passing correct reply to get_prio
Instead of passing the to be evaluated reply as the "best" reply, pass the
actual "best" reply.
(cherry picked from commit 5731cc0911ff65bf7efd433a83a25ffbf6073d10)
(cherry picked from commit cbd9c3d2851ece3c8f08b0664b72fca18f6f4f77)
---
Modified: src/modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c25035409c1f03c2f6fd24dd5f96eb2…
Patch:
https://github.com/kamailio/kamailio/commit/c25035409c1f03c2f6fd24dd5f96eb2…
---
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index c868e70a94..99361a5f33 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -1171,17 +1171,19 @@ inline static short int get_prio(unsigned int resp, struct sip_msg
*rpl)
int t_pick_branch(int inc_branch, int inc_code, struct cell *t, int *res_code)
{
int best_b, best_s, b;
- sip_msg_t *rpl;
+ sip_msg_t *rpl, *best_rpl;
best_b=-1; best_s=0;
+ best_rpl=NULL;
for ( b=0; b<t->nr_of_outgoings ; b++ ) {
rpl = t->uac[b].reply;
/* "fake" for the currently processed branch */
if (b==inc_branch) {
- if (get_prio(inc_code, rpl)<get_prio(best_s, rpl)) {
+ if (get_prio(inc_code, rpl)<get_prio(best_s, best_rpl)) {
best_b=b;
best_s=inc_code;
+ best_rpl=rpl;
}
continue;
}
@@ -1197,9 +1199,10 @@ int t_pick_branch(int inc_branch, int inc_code, struct cell *t, int
*res_code)
return -2;
/* if reply is null => t_send_branch "faked" reply, skip over it */
if ( rpl &&
- get_prio(t->uac[b].last_received, rpl)<get_prio(best_s, rpl) ) {
+ get_prio(t->uac[b].last_received, rpl)<get_prio(best_s, best_rpl) ) {
best_b =b;
best_s = t->uac[b].last_received;
+ best_rpl=rpl;
}
} /* find lowest branch */