Module: kamailio
Branch: master
Commit: 4e5c1ddd996d60382fd6a2d549cb18e2a1657b0d
URL:
https://github.com/kamailio/kamailio/commit/4e5c1ddd996d60382fd6a2d549cb18e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-08-09T20:54:32+02:00
textopsx: kemi functions to get body line iterator value
---
Modified: src/modules/textopsx/textopsx.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4e5c1ddd996d60382fd6a2d549cb18e…
Patch:
https://github.com/kamailio/kamailio/commit/4e5c1ddd996d60382fd6a2d549cb18e…
---
diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c
index 8d106a0704..5e62546fcd 100644
--- a/src/modules/textopsx/textopsx.c
+++ b/src/modules/textopsx/textopsx.c
@@ -2718,6 +2718,32 @@ static int w_bl_iterator_insert(sip_msg_t *msg, char *piname, char
*ptext)
return ki_bl_iterator_insert(msg, &iname, &text);
}
+/**
+ *
+ */
+static sr_kemi_xval_t _sr_kemi_bl_iterator_xval = {0};
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_bl_iterator_value(sip_msg_t *msg, str *iname)
+{
+ int k;
+
+ memset(&_sr_kemi_bl_iterator_xval, 0, sizeof(sr_kemi_xval_t));
+ k = ki_bl_iterator_index(msg, iname);
+ if(k<0 || _bl_iterators[k].it.s==NULL || _bl_iterators[k].it.len<=0) {
+ sr_kemi_xval_null(&_sr_kemi_bl_iterator_xval, 0);
+ return &_sr_kemi_bl_iterator_xval;
+ }
+ if(_bl_iterators[k].it.s==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_bl_iterator_xval, 0);
+ return &_sr_kemi_bl_iterator_xval;
+ }
+ _sr_kemi_bl_iterator_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_bl_iterator_xval.v.s = _bl_iterators[k].it;
+ return &_sr_kemi_bl_iterator_xval;
+}
/**
*
@@ -3351,6 +3377,11 @@ 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("bl_iterator_value"),
+ SR_KEMIP_XVAL, ki_bl_iterator_value,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};