Browse code

mtree: number of matched records for tree type=1 stored in pv_count

Daniel-Constantin Mierla authored on 28/05/2021 12:55:42
Showing 1 changed files
... ...
@@ -44,6 +44,7 @@ extern pv_spec_t pv_value;
44 44
 extern pv_spec_t pv_values;
45 45
 extern pv_spec_t pv_dstid;
46 46
 extern pv_spec_t pv_weight;
47
+extern pv_spec_t pv_count;
47 48
 extern int _mt_tree_type;
48 49
 extern int _mt_ignore_duplicates;
49 50
 extern int _mt_allow_duplicates;
... ...
@@ -599,6 +600,13 @@ int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
599 600
 			add_avp(dstid_name_type, dstid_avp_name, avp_value);
600 601
 		}
601 602
 	}
603
+	memset(&val, 0, sizeof(pv_value_t));
604
+	val.flags = PV_VAL_INT;
605
+	val.ri = n;
606
+	if(pv_value.setf(msg, &pv_count.pvp, (int)EQ_T, &val)<0) {
607
+		LM_ERR("setting PV count failed\n");
608
+		return -2;
609
+	}
602 610
 
603 611
 	return 0;
604 612
 }