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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-11-25T10:59:17+01:00

pv: new transformation {s.intv}

- convert the string representation from the int value
- related to GH #4450

---

Modified: src/modules/pv/pv_trans.c
Modified: src/modules/pv/pv_trans.h

---

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

---

diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c
index 26d5001e33d..14c0567bdc0 100644
--- a/src/modules/pv/pv_trans.c
+++ b/src/modules/pv/pv_trans.c
@@ -227,6 +227,16 @@ int tr_eval_string(
                                        val->rs.s = int2str(val->ri, 
&val->rs.len);
                        }
 
+                       val->flags = PV_TYPE_INT | PV_VAL_INT | PV_VAL_STR;
+                       break;
+               case TR_S_INTV:
+                       if(!(val->flags & PV_VAL_INT)) {
+                               if(str2slong(&val->rs, &val->ri) != 0)
+                                       return -1;
+                       } else {
+                               val->rs.s = int2str(val->ri, &val->rs.len);
+                       }
+
                        val->flags = PV_TYPE_INT | PV_VAL_INT | PV_VAL_STR;
                        break;
                case TR_S_RMWS:
@@ -2944,6 +2954,9 @@ char *tr_parse_string(str *in, trans_t *t)
        } else if(name.len == 3 && strncasecmp(name.s, "int", 3) == 0) {
                t->subtype = TR_S_INT;
                goto done;
+       } else if(name.len == 4 && strncasecmp(name.s, "intv", 4) == 0) {
+               t->subtype = TR_S_INTV;
+               goto done;
        } else if(name.len == 3 && strncasecmp(name.s, "md5", 3) == 0) {
                t->subtype = TR_S_MD5;
                goto done;
diff --git a/src/modules/pv/pv_trans.h b/src/modules/pv/pv_trans.h
index 501199af273..10712198d60 100644
--- a/src/modules/pv/pv_trans.h
+++ b/src/modules/pv/pv_trans.h
@@ -49,6 +49,7 @@ enum _tr_s_subtype
        TR_S_NONE = 0,
        TR_S_LEN,
        TR_S_INT,
+       TR_S_INTV,
        TR_S_MD5,
        TR_S_SHA1,
        TR_S_SHA256,

_______________________________________________
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