[sr-dev] git:master:66582c49: rr: exported record_route_advertised_address() to kemi

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 8 08:51:01 CEST 2020


Module: kamailio
Branch: master
Commit: 66582c49ee16a15a6859bfb094c2faaed7960d4d
URL: https://github.com/kamailio/kamailio/commit/66582c49ee16a15a6859bfb094c2faaed7960d4d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-04-08T08:49:29+02:00

rr: exported record_route_advertised_address() to kemi

---

Modified: src/modules/rr/rr_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/66582c49ee16a15a6859bfb094c2faaed7960d4d.diff
Patch: https://github.com/kamailio/kamailio/commit/66582c49ee16a15a6859bfb094c2faaed7960d4d.patch

---

diff --git a/src/modules/rr/rr_mod.c b/src/modules/rr/rr_mod.c
index b7b979f25e..236373a288 100644
--- a/src/modules/rr/rr_mod.c
+++ b/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,




More information about the sr-dev mailing list