Module: kamailio Branch: master Commit: 802fc969a07d275bd5bac0d0107879b01a6d875f URL: https://github.com/kamailio/kamailio/commit/802fc969a07d275bd5bac0d0107879b0...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-12-07T14:43:49+01:00
app_python: support executing kemi functions with (str*, str*, int, int, str*) params
---
Modified: src/modules/app_python/apy_kemi.c
---
Diff: https://github.com/kamailio/kamailio/commit/802fc969a07d275bd5bac0d0107879b0... Patch: https://github.com/kamailio/kamailio/commit/802fc969a07d275bd5bac0d0107879b0...
---
diff --git a/src/modules/app_python/apy_kemi.c b/src/modules/app_python/apy_kemi.c index 1de3b3b3fe..bcccbaa261 100644 --- a/src/modules/app_python/apy_kemi.c +++ b/src/modules/app_python/apy_kemi.c @@ -394,6 +394,25 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) fname.len, fname.s, vps[0].s.len, vps[0].s.s, vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].s.len, vps[3].s.s, vps[4].s.len, vps[4].s.s); + } else if(ket->ptypes[0]==SR_KEMIP_STR + || ket->ptypes[1]==SR_KEMIP_STR + || ket->ptypes[2]==SR_KEMIP_INT + || ket->ptypes[3]==SR_KEMIP_INT + || ket->ptypes[4]==SR_KEMIP_STR) { + if(!PyArg_ParseTuple(args, "ssiis:kemi-param-ssnns", + &vps[0].s.s, &vps[1].s.s, &vps[2].n, &vps[3].n, + &vps[4].s.s)) { + LM_ERR("unable to retrieve str-str-int-int-str params %d\n", i); + return sr_kemi_apy_return_false(); + } + vps[0].s.len = strlen(vps[0].s.s); + vps[1].s.len = strlen(vps[1].s.s); + vps[4].s.len = strlen(vps[4].s.s); + LM_DBG("params[%d] for: %.*s are str: [%.*s] [%.*s]" + " [%d] [%d] [%.*s]\n", i, + fname.len, fname.s, vps[0].s.len, vps[0].s.s, + vps[1].s.len, vps[1].s.s, vps[2].n, vps[3].n, + vps[4].s.len, vps[4].s.s); } else { LM_ERR("not implemented yet\n"); return sr_kemi_apy_return_false(); @@ -640,6 +659,16 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) &vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s); return sr_kemi_apy_return_int(ket, ret); + } else if(ket->ptypes[0]==SR_KEMIP_STR + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_INT + && ket->ptypes[3]==SR_KEMIP_INT + && ket->ptypes[4]==SR_KEMIP_STR) { + /* sssss */ + ret = ((sr_kemi_fmssnns_f)(ket->func))(lmsg, + &vps[0].s, &vps[1].s, vps[2].n, vps[3].n, + &vps[4].s); + return sr_kemi_apy_return_int(ket, ret); } else { LM_ERR("invalid parameters for: %.*s\n", fname.len, fname.s);