Skip to content

feat(amd): optionally process SIP early media - #6940

Open
swayamg20 wants to merge 1 commit into
livekit:mainfrom
swayamg20:fix/6895-amd-early-media
Open

feat(amd): optionally process SIP early media#6940
swayamg20 wants to merge 1 commit into
livekit:mainfrom
swayamg20:fix/6895-amd-early-media

Conversation

@swayamg20

Copy link
Copy Markdown
Contributor

Summary

  • add wait_until_answered to AMD, defaulting to True
  • when disabled for a SIP participant, start detection timers and process audio and transcripts from track subscription
  • preserve the existing answer-gated behavior by default
  • cover the default, opt-in, and pending-answer cleanup paths

Why

Some carriers deliver voicemail greetings or announcements through 183 Session Progress early media before sip.callStatus becomes active. AMD currently discards that audio while waiting for the answered state.

This gives integrations an explicit opt-in without changing the safer default for calls where early media contains only ringback or dialtone. Callers that need a verdict before answer must also disable wait_until_answered on the SIP participant request.

Testing

  • uv run pytest tests/test_amd_classifier.py -q — 37 passed
  • uv run ruff check livekit-agents/livekit/agents/voice/amd/detector.py tests/test_amd_classifier.py
  • uv run ruff format --check livekit-agents/livekit/agents/voice/amd/detector.py tests/test_amd_classifier.py
  • scoped mypy for livekit.agents — 207 source files passed

Closes #6895

@swayamg20
swayamg20 requested a review from a team as a code owner August 21, 2026 16:05

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

AMD: opt-in to process carrier early-media audio (183 Session Progress + SDP) instead of always deferring to sip.callStatus == "active"

1 participant