fix: Robust parsing of SIP messages from tcpdump output containing raw header artifacts

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-19 15:35:13 +01:00
parent 4fa44fb9c7
commit 2d99d8ddc4
3 changed files with 36 additions and 14 deletions

View File

@@ -139,8 +139,11 @@ func (c *LocalCapturer) processStream(r io.Reader) {
// logger.Debug("Stdout: %s", line) // Commented out to reduce noise, enable if needed
// Detect start of SIP message
if isSIPStart(line) {
if idx := findSIPStart(line); idx != -1 {
logger.Debug("SIP Start detected: %s", line)
// Clean the line (remove prefix garbage)
line = line[idx:]
// If we were building a message, parse it
if buffer.Len() > 0 {
c.parseAndEmit(buffer.String())