2
0
Эх сурвалжийг харах

rr: exported record_route_advertised_address() to kemi

Daniel-Constantin Mierla 5 жил өмнө
parent
commit
66582c49ee
1 өөрчлөгдсөн 22 нэмэгдсэн , 0 устгасан
  1. 22 0
      src/modules/rr/rr_mod.c

+ 22 - 0
src/modules/rr/rr_mod.c

@@ -453,6 +453,23 @@ static int w_record_route_advertised_address(struct sip_msg *msg, char *addr, ch
 	return 1;
 }
 
+/**
+ *
+ */
+static int ki_record_route_advertised_address(sip_msg_t *msg, str *addr)
+{
+	if (msg->msg_flags & FL_RR_ADDED) {
+		LM_ERR("Double attempt to record-route\n");
+		return -1;
+	}
+
+	if ( record_route_advertised_address(msg, addr) < 0)
+		return -1;
+
+	msg->msg_flags |= FL_RR_ADDED;
+	return 1;
+}
+
 
 static int w_add_rr_param(struct sip_msg *msg, char *key, char *foo)
 {
@@ -865,6 +882,11 @@ static sr_kemi_t sr_kemi_rr_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("rr"), str_init("record_route_advertised_address"),
+		SR_KEMIP_INT, ki_record_route_advertised_address,
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 	{ str_init("rr"), str_init("next_hop_route"),
 		SR_KEMIP_INT, ki_rr_next_hop_route,
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,