Module: kamailio Branch: master Commit: 52f246fbcc9097f77b6a64d15a4ff74e03577ba8 URL: https://github.com/kamailio/kamailio/commit/52f246fbcc9097f77b6a64d15a4ff74e...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-05-25T11:42:45+02:00
app_lua: fix for running kemi functions with 4 or more parameters
- added new combinations for 4 params case - reported by GH #1544
---
Modified: src/modules/app_lua/app_lua_sr.c
---
Diff: https://github.com/kamailio/kamailio/commit/52f246fbcc9097f77b6a64d15a4ff74e... Patch: https://github.com/kamailio/kamailio/commit/52f246fbcc9097f77b6a64d15a4ff74e...
---
diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c index 6edba5d7a7..c98830da5c 100644 --- a/src/modules/app_lua/app_lua_sr.c +++ b/src/modules/app_lua/app_lua_sr.c @@ -1682,19 +1682,33 @@ int sr_kemi_lua_exec_func_ex(lua_State* L, sr_kemi_t *ket, int pdelta) break; case 4: if(ket->ptypes[0]==SR_KEMIP_STR - || ket->ptypes[1]==SR_KEMIP_STR - || ket->ptypes[2]==SR_KEMIP_STR - || ket->ptypes[3]==SR_KEMIP_STR) { + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_STR) { ret = ((sr_kemi_fmssss_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s); return sr_kemi_lua_return_int(L, 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[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_INT) { + ret = ((sr_kemi_fmsssn_f)(ket->func))(env_L->msg, + &vps[0].s, &vps[1].s, &vps[2].s, vps[3].n); + return sr_kemi_lua_return_int(L, 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) { ret = ((sr_kemi_fmssnn_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s, vps[2].n, vps[3].n); return sr_kemi_lua_return_int(L, ket, ret); + } else if(ket->ptypes[0]==SR_KEMIP_INT + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_STR) { + ret = ((sr_kemi_fmnsss_f)(ket->func))(env_L->msg, + vps[0].n, &vps[1].s, &vps[2].s, &vps[3].s); + return sr_kemi_lua_return_int(L, ket, ret); } else { LM_ERR("invalid parameters for: %.*s\n", fname->len, fname->s); @@ -1703,10 +1717,10 @@ int sr_kemi_lua_exec_func_ex(lua_State* L, sr_kemi_t *ket, int pdelta) break; case 5: if(ket->ptypes[0]==SR_KEMIP_STR - || ket->ptypes[1]==SR_KEMIP_STR - || ket->ptypes[2]==SR_KEMIP_STR - || ket->ptypes[3]==SR_KEMIP_STR - || ket->ptypes[4]==SR_KEMIP_STR) { + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_STR + && ket->ptypes[4]==SR_KEMIP_STR) { ret = ((sr_kemi_fmsssss_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s); @@ -1719,11 +1733,11 @@ int sr_kemi_lua_exec_func_ex(lua_State* L, sr_kemi_t *ket, int pdelta) break; case 6: if(ket->ptypes[0]==SR_KEMIP_STR - || ket->ptypes[1]==SR_KEMIP_STR - || ket->ptypes[2]==SR_KEMIP_STR - || ket->ptypes[3]==SR_KEMIP_STR - || ket->ptypes[4]==SR_KEMIP_STR - || ket->ptypes[5]==SR_KEMIP_STR) { + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_STR + && ket->ptypes[4]==SR_KEMIP_STR + && ket->ptypes[5]==SR_KEMIP_STR) { ret = ((sr_kemi_fmssssss_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s, &vps[5].s);