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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2023-06-19T13:18:59+02:00

core: kemi - propagate bool as a return value type

- some scripting languages differentiate bool false|true vs int 0|1 values

---

Modified: src/core/kemiexec.c

---

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

---

diff --git a/src/core/kemiexec.c b/src/core/kemiexec.c
index 8e3b096e18..581e174c93 100644
--- a/src/core/kemiexec.c
+++ b/src/core/kemiexec.c
@@ -40,12 +40,16 @@ static sr_kemi_xval_t _sr_kemi_core_exec_xval;
  */
 static inline sr_kemi_xval_t *sr_kemi_return_int(sr_kemi_t *ket, int ret)
 {
-       _sr_kemi_core_exec_xval.vtype = SR_KEMIP_INT;
-       _sr_kemi_core_exec_xval.v.n = ret;
+       if(ket->rtype & SR_KEMIP_BOOL) {
+               _sr_kemi_core_exec_xval.vtype = SR_KEMIP_BOOL;
+               _sr_kemi_core_exec_xval.v.n = ret;
+       } else {
+               _sr_kemi_core_exec_xval.vtype = SR_KEMIP_INT;
+               _sr_kemi_core_exec_xval.v.n = ret;
+       }
        return &_sr_kemi_core_exec_xval;
 }
 
-
 /**
  *
  */

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to