Normalize SIP codec preferences for PJSIP enumerations - #77
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| lookup_key = requested_name.lower() | ||
| matched_codec = available_exact.get(lookup_key) | ||
|
|
||
| if not matched_codec: | ||
| base_key = lookup_key.split("/")[0] | ||
| matched_codec = available_base.get(base_key) | ||
|
|
There was a problem hiding this comment.
[P1] Avoid silently aliasing full codec IDs to other variants
The alias fallback in _apply_codec_preferences splits every unmatched request at / and then uses the base token to pick any available codec with that prefix (lines 217‑223). If an operator provides a fully qualified codec identifier such as opus/16000/2 that is not advertised by PJSIP, this code will still match the first opus variant (e.g. opus/48000/2) and apply it without warning. The previous implementation only applied exact matches, so misconfigured or unavailable variants were clearly logged. With the new behaviour the system may negotiate a different sample rate than requested while logging the codec as successfully applied, making configuration mistakes hard to diagnose. Consider limiting the base-name fallback to requests that do not contain /, or emit a warning when a full ID falls back to a different variant.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68ce5780d484832daf06ab4ad9f270cc