WebRTC ↔ Gateway Call Fails Due to Codec Negotiation / Transcoding

bisharah

New Member
Oct 2, 2025
1
0
1
36
Environment:


  • FusionPBX (FreeSWITCH backend) running on Hetzner server.
  • WebRTC clients connect via internal-wss profile (port 7443, TLS/WSS).
  • Outbound SIP calls routed through a provider gateway on the external profile.
  • Global codecs set: opus@48000h@20i,PCMU,PCMA,G722,G7221@32000h,G7221@16000h.
  • mod_opus is loaded and available.
  • NAT handled with auto-nat, public IP configured.

What works:


  • Registration of extensions via WebRTC works fine.
  • Outbound calls are established: signaling completes, and both inbound/outbound legs are created.

Problem:


  • WebRTC leg negotiates Opus 48kHz, but the provider only accepts PCMU/PCMA (G.711).
  • Calls consistently show this mismatch:
    • Inbound (WebRTC leg): opus/48000
    • Outbound (Gateway leg): PCMU/8000
  • Because of this, audio does not pass (media stuck / transcoding not happening).
  • Sometimes outbound leg shows CS_CONSUME_MEDIA → meaning no audio is flowing.

What I’ve tried:


  • Verified global_codec_prefs include both Opus and PCMU/PCMA.
  • Updated internal-wss and external SIP profile settings to use ${global_codec_prefs} for inbound/outbound codec prefs.
  • Removed disable-transcoding option (to allow transcoding if needed).
  • Confirmed RTP traffic is received via tcpdump on expected ports.
  • Checked channel variables: remote/local media IP/ports are correct.
  • But FreeSWITCH still does not transcode Opus → PCMU, leaving the call with no usable audio.

Question:


  • Why isn’t FreeSWITCH transcoding between Opus (WebRTC) and PCMU (gateway)?
  • Do I need additional config on internal-wss / external profiles (e.g. proxy-media, inbound-late-negotiation, disable-transcoding)?
  • Or should the SIP.js softphone explicitly restrict codecs to G.711 to match the carrier?
 
Use late negotiation. It will negotiate the codec supported by both sides. They will probably decide on G. 711. No transcoding will be needed and it will free up your CPU.