Skip to content

fix(sip): keep media settings from JSON when no media flags are set - #1091

Open
pcbeingused333 wants to merge 1 commit into
livekit:mainfrom
pcbeingused333:fix/sip-media-keep-json
Open

pcbeingused333 wants to merge 1 commit into
livekit:mainfrom
pcbeingused333:fix/sip-media-keep-json

Conversation

@pcbeingused333

Copy link
Copy Markdown

lk sip inbound create, lk sip outbound create and lk sip dispatch create accept a JSON request file whose values can be overridden by flags. For the media field this override was unconditional: parseSIPMediaConfig returns nil when no media flags (--media-enc, --codecs) are given, and that nil was assigned to Media on the request, discarding the media config read from the JSON file.

Fix

A small helper, mergeSIPMediaConfig, only replaces the media config when a media flag was actually set, and is used at the three create sites. The update paths build their request from flags only and are unchanged.

Test

cmd/lk/sip_media_test.go checks that media from the JSON request survives when no flags are set and that flags still take effect. The first test fails with the previous unconditional assignment and passes now.

This PR was prepared with the help of an AI assistant (Claude Code).

createSIPInboundTrunk, createSIPOutboundTrunk and createSIPDispatchRule assigned the result of parseSIPMediaConfig to the request unconditionally. Without media flags it is nil, which wiped the media config read from the JSON request file. Only override when a flag was given.
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.

1 participant