[sr-dev] git:master:f3a031a5: rr: all "record_route_...()" functions consider custom user AVP

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 22 15:32:27 CEST 2021


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

Author: valentin <christoph.valentin at kontron.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-07-22T15:32:21+02:00

rr: all "record_route_...()" functions consider custom user AVP

Until this fix, only the function record_route() considered the
value of the custom user AVP (if present). The functions
record_route_preset() and record_route_advertised_address(),
on the other hand, ignored the value of the custom user AVP,
even if it was presnt.
Now all three functions, record_route(), record_route_preset()
and record_route_advertised_address(), consider the value of the
custom user VP, if it is present.

---

Modified: src/modules/rr/record.c

---

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

---

diff --git a/src/modules/rr/record.c b/src/modules/rr/record.c
index 8624ee5e13..b6178cade3 100644
--- a/src/modules/rr/record.c
+++ b/src/modules/rr/record.c
@@ -527,9 +527,12 @@ int record_route_preset(struct sip_msg* _m, str* _data)
 	}
 
 	if (add_username) {
-		if (get_username(_m, &user) < 0) {
-			LM_ERR("failed to extract username\n");
-			return -1;
+		/* check if there is a custom user set */
+		if (get_custom_user(_m, &user) < 0) {
+			if (get_username(_m, &user) < 0) {
+				LM_ERR("failed to extract username\n");
+				return -1;
+			}
 		}
 	} else if (use_ob == 1) {
 		if (rr_obb.encode_flow_token(&user, &_m->rcv) != 0) {
@@ -814,9 +817,12 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data)
 	user.s = 0;
 
 	if (add_username) {
-		if (get_username(_m, &user) < 0) {
-			LM_ERR("failed to extract username\n");
-			return -1;
+		/* check if there is a custom user set */
+		if (get_custom_user(_m, &user) < 0) {
+			if (get_username(_m, &user) < 0) {
+				LM_ERR("failed to extract username\n");
+				return -1;
+			}
 		}
 	} else if (use_ob == 1) {
 		if (rr_obb.encode_flow_token(&user, &_m->rcv) != 0) {




More information about the sr-dev mailing list