Configuration

PJSIP Configuration & Codec Transcoding Secrets

WhatsMCP Engineering
Sep 5, 2024 · 5 min read

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.

Related posts

AI Agents
Sep 11, 2026

Designing MCP Servers Agents Actually Use

SIP Trunking
Sep 11, 2026

Bridging WhatsApp and PBX: Low-Latency SIP Trunking Internals