Browse code

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.

valentin authored on 25/06/2021 13:51:18 • Daniel-Constantin Mierla committed on 22/07/2021 13:32:21
Showing 1 changed files
... ...
@@ -527,9 +527,12 @@ int record_route_preset(struct sip_msg* _m, str* _data)
527 527
 	}
528 528
 
529 529
 	if (add_username) {
530
-		if (get_username(_m, &user) < 0) {
531
-			LM_ERR("failed to extract username\n");
532
-			return -1;
530
+		/* check if there is a custom user set */
531
+		if (get_custom_user(_m, &user) < 0) {
532
+			if (get_username(_m, &user) < 0) {
533
+				LM_ERR("failed to extract username\n");
534
+				return -1;
535
+			}
533 536
 		}
534 537
 	} else if (use_ob == 1) {
535 538
 		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)
814 817
 	user.s = 0;
815 818
 
816 819
 	if (add_username) {
817
-		if (get_username(_m, &user) < 0) {
818
-			LM_ERR("failed to extract username\n");
819
-			return -1;
820
+		/* check if there is a custom user set */
821
+		if (get_custom_user(_m, &user) < 0) {
822
+			if (get_username(_m, &user) < 0) {
823
+				LM_ERR("failed to extract username\n");
824
+				return -1;
825
+			}
820 826
 		}
821 827
 	} else if (use_ob == 1) {
822 828
 		if (rr_obb.encode_flow_token(&user, &_m->rcv) != 0) {