Module: kamailio
Branch: master
Commit: 155b5d0953cd9f5effff974d2ba9fca44da42059
URL:
https://github.com/kamailio/kamailio/commit/155b5d0953cd9f5effff974d2ba9fca…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-08-18T07:55:06+02:00
textopsx: added kemi functions to return hf iterator name and body
---
Modified: src/modules/textopsx/textopsx.c
---
Diff:
https://github.com/kamailio/kamailio/commit/155b5d0953cd9f5effff974d2ba9fca…
Patch:
https://github.com/kamailio/kamailio/commit/155b5d0953cd9f5effff974d2ba9fca…
---
diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c
index 5e62546fcd..a9a60f9ed8 100644
--- a/src/modules/textopsx/textopsx.c
+++ b/src/modules/textopsx/textopsx.c
@@ -2277,6 +2277,47 @@ static int w_hf_iterator_insert(sip_msg_t *msg, char *piname, char
*phtext)
return ki_hf_iterator_insert(msg, &iname, &htext);
}
+/**
+ *
+ */
+static sr_kemi_xval_t _sr_kemi_hf_iterator_xval = {0};
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_hf_iterator_hname(sip_msg_t *msg, str *iname)
+{
+ int k;
+
+ memset(&_sr_kemi_hf_iterator_xval, 0, sizeof(sr_kemi_xval_t));
+ k = ki_hf_iterator_index(msg, iname);
+ if(k<0 || _hf_iterators[k].it==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_hf_iterator_xval, 0);
+ return &_sr_kemi_hf_iterator_xval;
+ }
+ _sr_kemi_hf_iterator_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_hf_iterator_xval.v.s = _hf_iterators[k].it->name;
+ return &_sr_kemi_hf_iterator_xval;
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_hf_iterator_hbody(sip_msg_t *msg, str *iname)
+{
+ int k;
+
+ memset(&_sr_kemi_hf_iterator_xval, 0, sizeof(sr_kemi_xval_t));
+ k = ki_hf_iterator_index(msg, iname);
+ if(k<0 || _hf_iterators[k].it==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_hf_iterator_xval, 0);
+ return &_sr_kemi_hf_iterator_xval;
+ }
+ _sr_kemi_hf_iterator_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_hf_iterator_xval.v.s = _hf_iterators[k].it->body;
+ return &_sr_kemi_hf_iterator_xval;
+}
+
/**
*
*/
@@ -3347,6 +3388,16 @@ static sr_kemi_t sr_kemi_textopsx_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("textopsx"), str_init("hf_iterator_hname"),
+ SR_KEMIP_XVAL, ki_hf_iterator_hname,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("textopsx"), str_init("hf_iterator_hbody"),
+ SR_KEMIP_XVAL, ki_hf_iterator_hbody,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("textopsx"), str_init("bl_iterator_start"),
SR_KEMIP_INT, ki_bl_iterator_start,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,