feat(agent-call): implement remediation plan

This commit is contained in:
2026-09-13 19:20:28 +08:00
parent d30314c7d1
commit b95d2aee81
25 changed files with 3159 additions and 535 deletions
+40 -3
View File
@@ -6,6 +6,7 @@ ARI, RTP, AI-stream, or OSS integration.
from __future__ import annotations
import hashlib
import json
import threading
from pathlib import Path
@@ -82,9 +83,23 @@ class MockRTP:
def __init__(self, journal: ProtocolJournal) -> None:
self.journal = journal
def packet(self, call_id: str, direction: str, sequence: int) -> None:
def packet(
self,
call_id: str,
direction: str,
sequence: int,
payload: bytes | None = None,
) -> None:
payload = payload if payload is not None else b"\x01\x02" * 160
self.journal.append(
"rtp", "packet", call_id=call_id, direction=direction, sequence=sequence
"rtp",
"packet",
call_id=call_id,
direction=direction,
sequence=sequence,
payload_bytes=len(payload),
payload_sha256=hashlib.sha256(payload).hexdigest(),
non_silent=any(payload),
)
@@ -93,7 +108,12 @@ class MockAI:
self.journal = journal
def turn(
self, call_id: str, turn_index: int, speaker: str, playback_state: str
self,
call_id: str,
turn_index: int,
speaker: str,
playback_state: str,
text: str | None = None,
) -> None:
self.journal.append(
"ai",
@@ -102,4 +122,21 @@ class MockAI:
turn_index=turn_index,
speaker=speaker,
playback_state=playback_state,
text=text or f"mock-{speaker}-turn-{turn_index}",
)
self.journal.append(
"ai",
"playback",
call_id=call_id,
turn_index=turn_index,
state="sent",
)
self.journal.append(
"ai",
"playback",
call_id=call_id,
turn_index=turn_index,
state=playback_state
if playback_state in {"confirmed", "playback_confirmed", "unknown"}
else "unknown",
)