Module: kamailio Branch: master Commit: 92b8d7aa0bf0cf407ecea1211d7333562657bd5a URL: https://github.com/kamailio/kamailio/commit/92b8d7aa0bf0cf407ecea1211d733356...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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/92b8d7aa0bf0cf407ecea1211d733356... Patch: https://github.com/kamailio/kamailio/commit/92b8d7aa0bf0cf407ecea1211d733356...
---
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,