Module: kamailio
Branch: 5.4
Commit: cbd9c3d2851ece3c8f08b0664b72fca18f6f4f77
URL:
https://github.com/kamailio/kamailio/commit/cbd9c3d2851ece3c8f08b0664b72fca…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-23T10:58:26+02: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)
---
Modified: src/modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cbd9c3d2851ece3c8f08b0664b72fca…
Patch:
https://github.com/kamailio/kamailio/commit/cbd9c3d2851ece3c8f08b0664b72fca…
---
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index 328c6743d4..2324e29e59 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -1249,17 +1249,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;
}
@@ -1275,9 +1277,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 */