[sr-dev] git:master:92b8d7aa: core: kemi - added KSR.hsr.rmappend(hrm, hadd)

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 18 12:16:29 CEST 2019


Module: kamailio
Branch: master
Commit: 92b8d7aa0bf0cf407ecea1211d7333562657bd5a
URL: https://github.com/kamailio/kamailio/commit/92b8d7aa0bf0cf407ecea1211d7333562657bd5a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-06-18T09:18:01+02:00

core: kemi - added KSR.hsr.rmappend(hrm, hadd)

- helper function to remove and append headers in a single operation

---

Modified: src/core/kemi.c

---

Diff:  https://github.com/kamailio/kamailio/commit/92b8d7aa0bf0cf407ecea1211d7333562657bd5a.diff
Patch: https://github.com/kamailio/kamailio/commit/92b8d7aa0bf0cf407ecea1211d7333562657bd5a.patch

---

diff --git a/src/core/kemi.c b/src/core/kemi.c
index f8c490211d..d95a0a3cea 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1956,6 +1956,20 @@ static int sr_kemi_hdr_insert_before(sip_msg_t *msg, str *txt, str *hname)
 	return 1;
 }
 
+/**
+ *
+ */
+static int sr_kemi_hdr_rmappend(sip_msg_t *msg, str *hrm, str *hadd)
+{
+	int ret;
+
+	ret = sr_kemi_hdr_remove(msg, hrm);
+	if(ret<0) {
+		return ret;
+	}
+	return sr_kemi_hdr_append(msg, hadd);
+}
+
 /**
  *
  */
@@ -2089,6 +2103,11 @@ static sr_kemi_t _sr_kemi_hdr[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("hdr"), str_init("rmappend"),
+		SR_KEMIP_INT, sr_kemi_hdr_rmappend,
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 	{ str_init("hdr"), str_init("is_present"),
 		SR_KEMIP_INT, sr_kemi_hdr_is_present,
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,




More information about the sr-dev mailing list