fix: demote RTP debug logs to DEBUG and isolate web sessions

- Change RTP packet logging from INFO to DEBUG level to reduce noise
  (SPEAKING events remain at INFO as they are important lifecycle events)
- Use per-session chat_id (web_{session_id}) instead of shared "web"
  to isolate conversation context between simultaneous web users
This commit is contained in:
0xbyt4 2026-03-13 17:31:00 +03:00
parent fa2c825e2f
commit c433c89d7d
2 changed files with 5 additions and 5 deletions

View file

@ -199,7 +199,7 @@ class VoiceReceiver:
# Log first few raw packets for debugging
self._packet_debug_count += 1
if self._packet_debug_count <= 5:
logger.info(
logger.debug(
"Raw UDP packet: len=%d, first_bytes=%s",
len(data), data[:4].hex() if len(data) >= 4 else "short",
)
@ -212,7 +212,7 @@ class VoiceReceiver:
# Payload type (byte 1 lower 7 bits) = 0x78 (120) for voice.
if (data[0] >> 6) != 2 or (data[1] & 0x7F) != 0x78:
if self._packet_debug_count <= 5:
logger.info("Skipped non-RTP: byte0=0x%02x byte1=0x%02x", data[0], data[1])
logger.debug("Skipped non-RTP: byte0=0x%02x byte1=0x%02x", data[0], data[1])
return
first_byte = data[0]
@ -240,7 +240,7 @@ class VoiceReceiver:
if self._packet_debug_count <= 10:
with self._lock:
known_user = self._ssrc_to_user.get(ssrc, "unknown")
logger.info(
logger.debug(
"RTP packet: ssrc=%d, seq=%d, user=%s, hdr=%d, ext_data=%d",
ssrc, seq, known_user, header_size, ext_data_len,
)

View file

@ -408,7 +408,7 @@ class WebAdapter(BasePlatformAdapter):
msg_type = MessageType.COMMAND if text.startswith("/") else MessageType.TEXT
source = self.build_source(
chat_id="web",
chat_id=f"web_{session_id}",
chat_name="Web Chat",
chat_type="dm",
user_id=session_id,
@ -466,7 +466,7 @@ class WebAdapter(BasePlatformAdapter):
# Process as voice message
source = self.build_source(
chat_id="web",
chat_id=f"web_{session_id}",
chat_name="Web Chat",
chat_type="dm",
user_id=session_id,