Control the outbound SIP INVITE codec offer (avoid G.722) on LiveKit Cloud?

Question: On LiveKit Cloud, can I control the codec offer in LiveKit’s
outbound SIP INVITE — e.g. offer PCMU/PCMA only, or reorder so G.722 isn’t
first? Is there a SIPOutboundTrunk / dispatch / project-level setting, or is
this Cloud-side (dashboard/support)?

I’ve read the codecs-negotiation docs
(docs.livekit.io/reference/telephony/codecs-negotiation): LiveKit uses early
offers and supports PCMU/PCMA/G.722 — but the docs don’t describe how to
restrict or reorder the offer.

Why: Outbound calls (LiveKit Cloud → Telnyx SIP trunk, LiveKit Agents +
ElevenLabs TTS @ pcm_16000) negotiate G.722, and there’s a short broadband
click/pop at the onset of every agent talkspurt (TTS egress). We traced it
(PCAP) to G.722 sub-band ADPCM — the predictor cold-starts at each talkspurt
onset. It’s the codec leg, not TTS (TTS renders clean, all 200s).

Codec negotiation (from PCAP — SDP offer/answer available on request):

  • LiveKit outbound INVITE offers 9 0 8 (G722 / PCMU / PCMA)
  • Telnyx answers 9 (G722) only

So forcing G.711 would mean changing LiveKit’s offer (or its ordering).

Already tried / ruled out (tenant-side):

  • Comfort-noise off — no effect
  • Leading-silence padding (30 ms, 120 ms) — click persists
  • Telnyx SIP Connection inbound codec list / Outbound Voice Profile — no
    outbound-offer codec field
  • livekit-api 1.1.0 CreateSIPOutboundTrunk — exposes only
    media_encryption; audio_codec is read-only — no codec-order knob

Environment: LiveKit Cloud (project zodiac-mdg-voice), outbound trunk
ST_FzgDPd7sDTZX, Telnyx SIP trunk.

Related: livekit/livekit#4106 (open: “restrict codec to G.711”),
livekit/sip#122 (“no way to set codecs”), livekit/sip#238 (LiveKit outbound
INVITE shows the same RTP/AVP 9 0 8 G722-first offer), livekit/sip#608 / forum
thread #512 (same Telnyx outbound carrier artifacts, @ebilaly @ebilal).

Is offer-side codec control possible today, or is it a feature request? Thanks!

There is not a way to reorder the offer, but from the code it looks like there is an undocumented feature to restrict what codecs are offered, i.e. in your trunk configuration

{
  "sip_trunk_id": "<your-trunk-id>",
  "sip_call_to": "<phone-number-to-dial>",
  "room_name": "my-sip-room",
  "participant_identity": "sip-test",
  "participant_name": "Test Caller",
  "wait_until_answered": true,
  "media": {
    "only_listed_codecs": true,
    "codecs": [
      {"name": "PCMU", "rate": 8000},
      {"name": "PCMA", "rate": 8000}
    ],
  }
}