Skip to content

Refine codec negotiation and telephone-event/8000 passthrough#147

Merged
shenjinti merged 2 commits intorestsend:mainfrom
yeoleobun:codec-negotiation-preserve-caller
Mar 1, 2026
Merged

Refine codec negotiation and telephone-event/8000 passthrough#147
shenjinti merged 2 commits intorestsend:mainfrom
yeoleobun:codec-negotiation-preserve-caller

Conversation

@yeoleobun
Copy link
Collaborator

Summary

  • preserve caller codec ordering when building the outbound offer to leg B
  • prefer the codec selected by leg B when generating the answer for leg A
  • preserve telephone-event/8000 separately from normal audio codec ordering and keep bridge-side DTMF PT rewriting

Details

  • build leg B offer from caller codecs first, filtered by allow_codecs, then append remaining allowed codecs
  • avoid dynamic PT conflicts that could hide Opus from leg B
  • derive leg B codec from the callee answer instead of re-ranking answer codecs by PBX preference
  • derive leg A codec by preferring leg B's selected codec when available, otherwise falling back to caller-side ordering
  • preserve caller telephone-event/8000 in the offer to leg B and use negotiated DTMF PTs when creating the media bridge

Scope

  • fixes unnecessary transcoding caused by allow_codecs-driven reordering
  • fixes Opus loss caused by dynamic PT conflicts when appending extra codecs
  • minimally supports telephone-event/8000 passthrough and PT rewriting
  • does not add support for telephone-event/48000 or broader mid-call re-INVITE/UPDATE renegotiation changes

@shenjinti shenjinti merged commit 720b4e3 into restsend:main Mar 1, 2026
1 check passed
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.

2 participants