Module: kamailio
Branch: master
Commit: 81d517f0a3dcd769dc84ff019c58e248ef7eb466
URL: 
https://github.com/kamailio/kamailio/commit/81d517f0a3dcd769dc84ff019c58e248ef7eb466

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2018-05-25T11:49:25+02:00

app_jsdt: fix for executing kemi functions with 4 or more params

- more combinations for 4 params

---

Modified: src/modules/app_jsdt/app_jsdt_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/81d517f0a3dcd769dc84ff019c58e248ef7eb466.diff
Patch: 
https://github.com/kamailio/kamailio/commit/81d517f0a3dcd769dc84ff019c58e248ef7eb466.patch

---

diff --git a/src/modules/app_jsdt/app_jsdt_api.c 
b/src/modules/app_jsdt/app_jsdt_api.c
index ef86d51165..1b6dba4145 100644
--- a/src/modules/app_jsdt/app_jsdt_api.c
+++ b/src/modules/app_jsdt/app_jsdt_api.c
@@ -1120,19 +1120,33 @@ int sr_kemi_jsdt_exec_func_ex(duk_context *J, sr_kemi_t 
*ket)
                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_J->msg,
                                                &vps[0].s, &vps[1].s, 
&vps[2].s, &vps[3].s);
                                return sr_kemi_jsdt_return_int(J, 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_J->msg,
+                                               &vps[0].s, &vps[1].s, 
&vps[2].s, vps[3].n);
+                               return sr_kemi_jsdt_return_int(J, 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_J->msg,
                                                &vps[0].s, &vps[1].s, vps[2].n, 
vps[3].n);
                                return sr_kemi_jsdt_return_int(J, 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_J->msg,
+                                               vps[0].n, &vps[1].s, &vps[2].s, 
&vps[3].s);
+                               return sr_kemi_jsdt_return_int(J, ket, ret);
                        } else {
                                LM_ERR("invalid parameters for: %.*s\n",
                                                fname->len, fname->s);
@@ -1141,10 +1155,10 @@ int sr_kemi_jsdt_exec_func_ex(duk_context *J, sr_kemi_t 
*ket)
                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_J->msg,
                                                &vps[0].s, &vps[1].s, 
&vps[2].s, &vps[3].s,
                                                &vps[4].s);
@@ -1157,11 +1171,11 @@ int sr_kemi_jsdt_exec_func_ex(duk_context *J, sr_kemi_t 
*ket)
                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_J->msg,
                                                &vps[0].s, &vps[1].s, 
&vps[2].s, &vps[3].s,
                                                &vps[4].s, &vps[5].s);


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to