[sr-dev] git:master:21338195: siptrace: fix regression introduced from 4e9a760123c for siptrace(), sip_trace_mode()

Henning Westerholt hw at skalatan.de
Fri Jun 5 12:26:10 CEST 2020


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

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-06-05T10:25:46Z

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

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 6cc3471fcf..1368e954a6 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -562,7 +562,8 @@ static int sip_trace_store(siptrace_data_t *sto, dest_info_t *dst,
 		trace_send_hep_duplicate(
 				&sto->body, &sto->fromip, &sto->toip, dst, correlation_id_str);
 	} else {
-		if(dst) {
+		/* sip_trace_mode() will not set a destination, uses duplicate_uri */
+		if(dst || trace_to_database == 0) {
 			trace_send_duplicate(sto->body.s, sto->body.len, dst);
 		}
 	}
@@ -1070,10 +1071,13 @@ static int w_sip_trace3(sip_msg_t *msg, char *dest, char *correlation_id, char *
 	dest_info_t dest_info;
 	enum siptrace_type_t trace_type;
 
-	if (dest) {
-		if(fixup_get_svalue(msg, (gparam_t *)dest, &dup_uri_param_str) != 0) {
-			LM_ERR("unable to parse the dest URI string\n");
-			return -1;
+	/* to support tracing to database without destination parameter - old mode */
+	if (dest || trace_to_database == 0) {
+		if (dest) {
+			if(fixup_get_svalue(msg, (gparam_t *)dest, &dup_uri_param_str) != 0) {
+				LM_ERR("unable to parse the dest URI string\n");
+				return -1;
+			}
 		}
 
 		if (dup_uri_param_str.s == 0 || (is_null_pv(dup_uri_param_str))) {




More information about the sr-dev mailing list