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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-12-10T09:40:15+01:00

json: do not parse transformation parameter for vars if none there

---

Modified: src/modules/json/json_trans.c

---

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

---

diff --git a/src/modules/json/json_trans.c b/src/modules/json/json_trans.c
index ea570cb0ca6..2c44d2d1226 100644
--- a/src/modules/json/json_trans.c
+++ b/src/modules/json/json_trans.c
@@ -280,21 +280,25 @@ int json_tr_eval(
 
 
                        if(tp->type == TR_PARAM_STRING) {
-                               v1 = tp->v.s.s;
-                               if(fixup_spve_null(&v1, 1) != 0) {
-                                       LM_ERR("cannot get spve_value from 
TR_PARAM_STRING : "
-                                                  "%.*s\n",
-                                                       tp->v.s.len, tp->v.s.s);
-                                       pkg_free(pv);
-                                       return -1;
-                               }
-                               if(fixup_get_svalue(msg, (gparam_p)v1, &v2) != 
0) {
-                                       LM_ERR("cannot get value from 
TR_PARAM_STRING\n");
+                               if(str_search_char(&tp->v.s, '$') == NULL) {
+                                       v2 = tp->v.s;
+                               } else {
+                                       v1 = tp->v.s.s;
+                                       if(fixup_spve_null(&v1, 1) != 0) {
+                                               LM_ERR("cannot get spve_value 
from TR_PARAM_STRING : "
+                                                          "%.*s\n",
+                                                               tp->v.s.len, 
tp->v.s.s);
+                                               pkg_free(pv);
+                                               return -1;
+                                       }
+                                       if(fixup_get_svalue(msg, (gparam_p)v1, 
&v2) != 0) {
+                                               LM_ERR("cannot get value from 
TR_PARAM_STRING\n");
+                                               fixup_free_spve_null(&v1, 1);
+                                               pkg_free(pv);
+                                               return -1;
+                                       }
                                        fixup_free_spve_null(&v1, 1);
-                                       pkg_free(pv);
-                                       return -1;
                                }
-                               fixup_free_spve_null(&v1, 1);
                                sv = v2;
                        } else {
                                if(pv_get_spec_value(msg, 
(pv_spec_p)tp->v.data, &v) != 0

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to