enhance message sending with buffer capture for tracing - #4228
Open
digipigeon wants to merge 2 commits into
Open
enhance message sending with buffer capture for tracing#4228digipigeon wants to merge 2 commits into
digipigeon wants to merge 2 commits into
Conversation
…fy buffer ownership and processing details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix stateful TM SIP tracing so outgoing HEP payloads contain the final plaintext SIP message after
POST_RAW_PROCESSINGtransformations.This ensures that the SIP payload recorded by
tracermatches the message sent to the peer, including Call-ID changes made bytopology_hiding.Details
This is a bug fix for stateful transaction tracing.
Modules such as
topology_hidingmodify outgoing SIP messages using aPOST_RAW_PROCESSINGcallback. These callbacks run insidemsg_send(), after TM has prepared and stored its retransmission buffer.The transformed buffer is passed to the transport and is therefore what the remote peer receives. However, after sending,
TMCB_MSG_SENT_OUTcallbacks were given the original TM buffer instead of the transformed buffer.Consequently,
tracerexported a HEP payload that did not always match the SIP message sent on the wire. For example, whentopology_hiding("C")encoded the Call-ID:This is particularly important for TLS and WebSocket transports. Capturing at the network level would expose encrypted or transport-framed data, while SIP tracing needs the final plaintext SIP message immediately before transport processing.
Other modules using
POST_RAW_PROCESSING, such ascompression, may have been affected by the same discrepancy.The scope of this change is stateful TM tracing through
TMCB_MSG_SENT_OUT. Stateless SL tracing does not use these callbacks and is not changed by this PR.Solution
The send API can now optionally return the final outgoing plaintext buffer after all
POST_RAW_PROCESSINGcallbacks have completed, but before transport framing or encryption.TM requests this buffer when a
TMCB_MSG_SENT_OUTobserver is registered and supplies it to the callback for:The implementation avoids copying every traced SIP message:
This avoids an additional allocation and full-message copy for every traced send. It also avoids an out-of-memory fallback that could otherwise cause tracing to use the incorrect pre-transformation payload.
HEP correlation remains based on the original transaction Call-ID. Only the captured SIP payload reflects the final Call-ID sent to the peer. This preserves transaction-level grouping while ensuring the displayed SIP message matches the outgoing plaintext message.
The change was tested with
topology_hiding("C")and transaction tracing:Compatibility
No configuration or script migration is required.
There are no intended SIP interoperability changes. The SIP message sent to the remote peer is unchanged; this PR only corrects the buffer exposed to post-send TM observers.
Consumers of
TMCB_MSG_SENT_OUTwill now receive the actual post-raw-processing plaintext payload. This is an intentional behavior correction. A consumer that previously relied on the callback receiving the stale pre-transformation buffer may observe different payload content when modules such astopology_hidingorcompressionmodify the message.The HEP correlation identifier remains unchanged, preserving existing transaction correlation behavior.
Stateless SL tracing remains outside the scope of this change.
Closing issues
Closes #459