whosgonna created an issue (kamailio/kamailio#4510)
### Description
I came across the following behavior when working with data returned from
`rtpengine_query_v()`. Some of the returned data has the `to_tag` and
`from_tag` as the key name, and in some cases there is a `.` in the tag, which
makes this section of the data unavailable using the `json.parse`
transfomration.
Sample data, pretty printed, and most fields removed to make the problem more
visible. Note that the key names are the SIP To: tag and From: tag, so they're
not something that can be controlled in Kamailio.
```
{
"tags": {
"iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3": {
"label": "customer"
},
"rtmeQtNp5vyBF": {
"label": "vendor"
}
}
}
```
The second tag there would be accessible via the `json.parse` transformation
like this:
```
$vn(json) =
'{"tags":{"iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3":{"label":"customer"},"rtmeQtNp5vyBF":{"label":"vendor"}}}';
$vn(ft) = "rtmeQtNp5vyBF";
$vn(ft_path) = "tags." + $vn(ft) + ".label";
$vn(ft_label) = $(vn(json){json.parse, $vn(ft_path) });
xnotice("FT Label ($vn(ft_path)): $vn(ft_label)\n");
## output:
## NOTICE: <script>: FT Label (tags.rtmeQtNp5vyBF.label): vendor
```
However, trying to do the same thing with the first tag that contains a dot
then has a problem:
```
$vn(json) =
'{"tags":{"iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3":{"label":"customer"},"rtmeQtNp5vyBF":{"label":"vendor"}}}';
$vn(tt) = "iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3";
$vn(tt_path) = "tags." + $vn(tt) + ".label";
$vn(tt_label) = $(vn(json){json.parse, $vn(tt_path) });
xnotice("FT Label ($vn(tt_path)): $vn(tt_label)\n");
## output (contains no value):
## NOTICE: <script>: FT Label (tags.iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3.label):
```
The reason for the failure is rather clear: The `.` is being interpolated as
the path separator. I believe that it should be possible to quote this portion
of the JSONPath, either as `tags."iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3".label` or
`tags["iS.PJbHNJtW8jLJjU5Jw5bANj1rQ5Sh3"].label`, but I'm not able to find a
variation that works.
I will concede that the documentation for the transformation does not
explicitly state JSONPath, so perhaps this is a feature add, and not a bug,
however JSONPath seems to otherwise be usable here.
### Troubleshooting
#### Reproduction
Reproducible by example above
### Possible Solutions
Allow JSONPath quoting of the string?
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
# kamailio -v
version: kamailio 6.0.4 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE,
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC,
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES,
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE
262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled on 19:19:24 Nov 24 2025 with cc 14.2.0
```
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->
```
# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.22.2
PRETTY_NAME="Alpine Linux v3.22"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
# uname -a
Linux 456b7c5e5e64 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu
Jun 5 18:30:46 UTC 2025 x86_64 Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4510
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/[email protected]>_______________________________________________
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!