[sr-dev] git:master:352830ca: Merge pull request #2515 from gaaf/fixes/tm-pick-branch

GitHub noreply at github.com
Fri Oct 23 10:35:50 CEST 2020


Module: kamailio
Branch: master
Commit: 352830ca7c39032dfaecbcb1a6b1bb0865ee55d3
URL: https://github.com/kamailio/kamailio/commit/352830ca7c39032dfaecbcb1a6b1bb0865ee55d3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2020-10-23T10:35:44+02:00

Merge pull request #2515 from gaaf/fixes/tm-pick-branch

tm: Fix faked_reply_prio by passing correct reply to get_prio

---

Modified: src/modules/tm/t_reply.c

---

Diff:  https://github.com/kamailio/kamailio/commit/352830ca7c39032dfaecbcb1a6b1bb0865ee55d3.diff
Patch: https://github.com/kamailio/kamailio/commit/352830ca7c39032dfaecbcb1a6b1bb0865ee55d3.patch

---

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 */
 




More information about the sr-dev mailing list