#### Pre-Submission Checklist - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This is a proposed evolution that adds socket timestamping of received UDP packets (using SO_TIMESTAMPNS). It computes the delay between this timestamp and the time at which the packet is read by Kamailio. This can then be accessed using pv "$TV(RD)" (RD for "receive relay").
Rationale : The Kamailio server is handling traffic that is irregular and can temporarily spike to a point where all children are still busy when new packets are incoming on the network interface. Consequently, these packets have to wait until a worker is available. The client will see a higher response time, that currently cannot be monitored by Kamailio itself. This evolution allows to make this wait time observable by Kamailio, allowing to log or write the information to CDR for example.
If this is possible, I'd like to merge this feature in Kamailio. Of course, I'm ready to discuss the PR and make any necessary changes. All comments and reviews are most welcome.
I've tested this locally on Linux (3.10.0-957.10.1.el7.x86_64) with the latest Kamailio master as of 2023/03/23.
Thanks! You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3404
-- Commit Summary --
* core: add socket timestamp of received packets and keep track of receive delay * pv: add $TV(RD) to get the new information "receive delay"
-- File Changes --
M src/core/ip_addr.h (1) M src/core/parser/msg_parser.h (1) M src/core/receive.c (8) M src/core/udp_server.c (60) M src/core/ut.h (34) M src/modules/pv/pv_time.c (15)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3404.patch https://github.com/kamailio/kamailio/pull/3404.diff