PJSIP Configuration & Codec Transcoding Secrets
Optimizing pjsip.conf parameters for flawless G.711u to Opus conversion under high-throughput concurrent call loads.
Codec Negotiation Order
List the codec your PBX actually terminates first — allow=g711u before allow=opus on the PBX-facing endpoint — so the negotiated media leg never round-trips through a third format you didn't ask for:
[pbx-facing]
type=endpoint
transport=transport-udp
context=pbx-inbound
disallow=all
allow=g711u
allow=opus
dtmf_mode=rfc4733
Concurrency Tuning
Transcoding is CPU-bound, not bandwidth-bound, so the parameter that actually caps concurrent call capacity is the transcoding worker's own stream limit, not anything in pjsip.conf itself. Every call that mixes G.711u and Opus on the same leg holds one transcode session for its full duration.
The One Setting Everyone Forgets
direct_media=no has to be set on both endpoints of a transcoded bridge, not just one. The asymmetric case is the one that passes testing with a single call and then drops audio only once the media path has to route through the transcoder under load.
About WhatsMCP Engineering
Engineering Team at WhatsMCP. The team building WhatsMCP's MCP server and SIP bridge — the people who wrote the code these posts describe.