### Description
We send HEP3 data to the UDP listener in kamailio. In this HEP3 data, there are
SIP requests and replies. We want to route these SIP messages through
`request_route` and `onreply_route`. For this, we use the SipCapture module
with the following settings:
```
modparam("sipcapture", "db_url", DBURL)
modparam("sipcapture", "capture_on", 1)
modparam("sipcapture", "hep_capture_on", 1)
modparam("sipcapture", "insert_retries", 0)
modparam("sipcapture", "insert_retry_timeout", 0)
request_route {
xlog("L_INFO", "Got new request ($ci) $rm: $si => $Ri\n");
}
onreply_route {
xlog("L_INFO", "Got new reply ($ci) $rm: $si => $Ri - Reply Code
$rs\n");
}
```
In the past (version kamailio 5.1.x - 5.4.x), this worked as expected. From the
logs:
```
2(8) INFO: <script>: Got new request (7xkVDrAWegvcZl-ACaUb1HWHwiCYhAJR)
INVITE: 217.116.121.230 => 172.20.21.4
3(9) INFO: <script>: Got new reply (7xkVDrAWegvcZl-ACaUb1HWHwiCYhAJR) INVITE:
172.20.21.4 => 217.116.121.230 - Reply Code 407
```
Starting with kamailio 5.5.x, some pseudo variables are broken. From the logs:
```
1(7) INFO: <script>: Got new request (7xkVDrAWegvcZl-ACaUb1HWHwiCYhAJR)
INVITE: 217.116.121.230 => 217.116.121
2(8) INFO: <script>: Got new reply (7xkVDrAWegvcZl-ACaUb1HWHwiCYhAJR) INVITE:
172.20.21.4 => 172.20.21.4 3(9) INFO: <script>: ...
```
As you can see, the `$Ri` in the request is wrong. It looks like the first
three octets of the `$si` and the fourth octet is missing entirely.
And for the reply:
- The `$Ri` is the `$si`.
- The line is missing the static text `Reply Code`, the actual reply code.
- The next log is on the same line (the new line is gone). (In this case, we
simply sent a third HEP3 message.)
To my untrained eye this looks like possible memory corruption.
### Troubleshooting
#### Reproduction
1. Set up a kamailio 5.8.1 using the attached
[kamailio.cfg](https://github.com/kamailio/kamailio/files/15161868/kamailio.cfg.zip)
`/usr/sbin/kamailio -E -DD -dd -f "/etc/kamailio/kamailio.cfg"`
2. Send the HEP3 data using [heplify](https://github.com/sipcapture/heplify)
`./heplify -t pcap -rf "sipcapture-bug.pcap" -hs localhost:9060 -e
-eof-exit`
#### Debugging Data
#### Log Messages
see above
#### SIP Traffic
see attached
[sipcapture-bug.pcap](https://github.com/kamailio/kamailio/files/15161698/sipcapture-bug.zip)
### Possible Solutions
Use kamailio 5.4.x or earlier versions.
### Additional Information
When setting `nonsip_hook` = `1`, then the `$hep(...)` pseudo variables look
fine. Unfortunately, we don't know how process the SIP messages after that
point.
```
modparam("sipcapture", "nonsip_hook", 1)
...
event_route[sipcapture:request] {
xlog("L_INFO", "version: $hep(version)\n");
xlog("L_INFO", "src_ipv4: $hep(0x003)\n");
xlog("L_INFO", "dst_ipv4: $hep(0x004)\n");
xlog("L_INFO", "src_proto: $hep(0x007)\n");
xlog("L_INFO", "dst_proto: $hep(0x008)\n");
xlog("L_INFO", "proto: $hep(0x00b)\n");
}
```
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.8.1 (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:
compiled with gcc 12.2.0
```
Also tested with same error: 5.5.x, 5.6.x, 5.7.x
* **Operating System**:
```
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3835
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3...@github.com>
_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org