Skip to content

Fix missing HEP/SIP trace records for retransmissions for in-dialog OPTIONS - #4227

Open
digipigeon wants to merge 1 commit into
OpenSIPS:masterfrom
connexcs:tracer-local-retransmit-master
Open

Fix missing HEP/SIP trace records for retransmissions for in-dialog OPTIONS#4227
digipigeon wants to merge 1 commit into
OpenSIPS:masterfrom
connexcs:tracer-local-retransmit-master

Conversation

@digipigeon

Copy link
Copy Markdown

Summary

Fix missing HEP/SIP trace records for retransmissions of locally generated stateful requests, including in-dialog OPTIONS pings generated by the dialog module.

Details

This is a bug fix for the tracer module.

Locally generated requests sent through TM are stateful and, when using an unreliable transport such as UDP, are retransmitted according to the normal TM timers. However, only the initial transmission may appear in SIP captures exported by tracer, while the retransmitted packets are absent.

TM invokes the TMCB_MSG_SENT_OUT callback for each retransmission. For a locally generated transaction, however, there may be no UAS request available, so both ps->req and ps->rpl are NULL. The actual outgoing SIP buffer and destination remain available through ps->extra1 and ps->extra2.

The existing tracer callback only processes the event when ps->req or ps->rpl is set. It therefore silently ignores these outgoing packets even though they were successfully transmitted.

This was observed with in-dialog OPTIONS pings generated by the dialog module. Packet-level captures confirmed the UDP retransmissions were sent, while HEP captures contained only the initial OPTIONS request.

The same callback representation may also be used for other locally generated buffered requests, such as ACK and CANCEL messages.

Solution

When TMCB_MSG_SENT_OUT provides neither a request nor a reply, the tracer now checks whether the transaction is locally generated and whether an outgoing buffer was supplied.

For these events, it:

  • Parses the actual outgoing buffer into a temporary sip_msg.
  • Verifies that the buffer contains a SIP request.
  • Populates the temporary message with the supplied transport and local socket metadata.
  • Passes it through the existing outgoing-request tracing logic.
  • Preserves the existing caller/callee direction handling.
  • Frees the temporary message after tracing.

Because the actual outgoing buffer is parsed, OPTIONS, ACK, and CANCEL messages retain their correct SIP methods and contents in the resulting trace.

Parsing is performed only when tracing callbacks are installed and TM has not already supplied a parsed request. There is therefore no additional processing for untraced transactions or for the usual callback path where ps->req is available.

Compatibility

The change does not modify SIP transmission, transaction handling, retransmission timers, or dialog behavior. It only makes previously omitted outgoing packets visible to configured tracer destinations, including HEP collectors.

No configuration changes or migration steps are required.

Existing captures may contain additional records for locally generated retransmissions, ACKs, or CANCELs that were previously omitted. This is the intended behavior and makes tracer output correspond more closely to the packets transmitted on the network.

Closing issues

No associated issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant