Module: kamailio
Branch: master
Commit: bb66d054b2eb0d7bd8c4d8a3040b790ce4a03918
URL:
https://github.com/kamailio/kamailio/commit/bb66d054b2eb0d7bd8c4d8a3040b790…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-06-18T14:22:52+02:00
core: kemi - added KSR.hsr.rminsert(hrm, hadd)
- helper function to remove and insert headers in a single operation
---
Modified: src/core/kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bb66d054b2eb0d7bd8c4d8a3040b790…
Patch:
https://github.com/kamailio/kamailio/commit/bb66d054b2eb0d7bd8c4d8a3040b790…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index d95a0a3cea..3ca2e9065f 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1970,6 +1970,21 @@ static int sr_kemi_hdr_rmappend(sip_msg_t *msg, str *hrm, str
*hadd)
return sr_kemi_hdr_append(msg, hadd);
}
+/**
+ *
+ */
+static int sr_kemi_hdr_rminsert(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_insert(msg, hadd);
+}
+
+
/**
*
*/
@@ -2108,6 +2123,11 @@ static sr_kemi_t _sr_kemi_hdr[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("hdr"), str_init("rminsert"),
+ SR_KEMIP_INT, sr_kemi_hdr_rminsert,
+ { 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,