For selectively tracing sip messages *sent* by kamailio, we successfully use onsend_route: but this works for forwarded requests/responses only.
For locally generated messages, there does not seem to be a reliable method: – tm:local-request: message is usually not final, not executed for locally generated ACK and CANCEL – tm:local-response: works for responses only (triggered *after* sending) – sl:local-response: works for responses only (triggered *after* sending)
We also tried event_route[network:msg], but sip_trace() does not work there (msg not parsed/available?).
Might it be possible to add a core option "onsend_route_localsrc", that can be enabled to make kamailio trigger onsend_route also for locally generated requests (and also locally generated responses, if "onsend_route_reply" is enabled)?
See sipdump module, it has an event route that might help. If not, then someone has to code a new feature and propose a pull request.
Closed #2933.