Browse code

siptrace: fix regression introduced from 4e9a760123c for siptrace(), sip_trace_mode()

- fix regression introduced from 4e9a760123c for siptrace(), sip_trace_mode()
- it was not working properly without destination uri in non-HEP mode

Henning Westerholt authored on 05/06/2020 09:25:04
Showing 1 changed files
... ...
@@ -562,7 +562,8 @@ static int sip_trace_store(siptrace_data_t *sto, dest_info_t *dst,
562 562
 		trace_send_hep_duplicate(
563 563
 				&sto->body, &sto->fromip, &sto->toip, dst, correlation_id_str);
564 564
 	} else {
565
-		if(dst) {
565
+		/* sip_trace_mode() will not set a destination, uses duplicate_uri */
566
+		if(dst || trace_to_database == 0) {
566 567
 			trace_send_duplicate(sto->body.s, sto->body.len, dst);
567 568
 		}
568 569
 	}
... ...
@@ -1070,10 +1071,13 @@ static int w_sip_trace3(sip_msg_t *msg, char *dest, char *correlation_id, char *
1070 1071
 	dest_info_t dest_info;
1071 1072
 	enum siptrace_type_t trace_type;
1072 1073
 
1073
-	if (dest) {
1074
-		if(fixup_get_svalue(msg, (gparam_t *)dest, &dup_uri_param_str) != 0) {
1075
-			LM_ERR("unable to parse the dest URI string\n");
1076
-			return -1;
1074
+	/* to support tracing to database without destination parameter - old mode */
1075
+	if (dest || trace_to_database == 0) {
1076
+		if (dest) {
1077
+			if(fixup_get_svalue(msg, (gparam_t *)dest, &dup_uri_param_str) != 0) {
1078
+				LM_ERR("unable to parse the dest URI string\n");
1079
+				return -1;
1080
+			}
1077 1081
 		}
1078 1082
 
1079 1083
 		if (dup_uri_param_str.s == 0 || (is_null_pv(dup_uri_param_str))) {