Fix FreeSWITCH 488 INCOMPATIBLE_DESTINATION on WebRTC Calls
calricon / field note
WebRTC browser calls bridged through FreeSWITCH mod_sofia to PSTN
Fix FreeSWITCH 488 INCOMPATIBLE_DESTINATION on WebRTC Calls
When a browser WebRTC client (such as JsSIP or SIP over WebSocket) places a call through FreeSWITCH to a PSTN SIP trunk and immediately fails with SIP/2.0 488 Not Acceptable Here and hangup cause INCOMPATIBLE_DESTINATION (Q.850 code 88), SIP signaling is healthy while SDP media negotiation is failing.
Browser endpoints mandate UDP/TLS/RTP/SAVPF with DTLS-SRTP (a=fingerprint) and ICE candidates, whereas standard PSTN carriers expect unencrypted RTP/AVP with G.711 (PCMU/PCMA). Resolving INCOMPATIBLE_DESTINATION requires keeping FreeSWITCH in full media path mode, scoping rtp_secure_media strictly away from plain RTP trunks, and aligning codec negotiation.
Problem Diagnosis & Root Cause Architecture
FreeSWITCH mod_sofia evaluates transport security, media path flags, and codec intersection independently on the inbound A-leg and outbound B-leg:
- Exported rtp_secure_media Collision: Exporting
rtp_secure_media=trueormandatoryin the dialplan forces SDES SRTP (a=crypto) onto the outbound SIP trunk. If the carrier only accepts plainRTP/AVP, the B-leg rejects the call with488. Conversely, WebRTC DTLS-SRTP does not usertp_secure_mediaat all—FreeSWITCH activates DTLS-SRTP automatically whenevera=fingerprintappears in the browser SDP. - Bypass or Proxy Media Mode Enabled: When
inbound-proxy-mediaorinbound-bypass-mediais active on the Sofia profile (or via channel variables), FreeSWITCH cannot terminate DTLS-SRTP on the WebRTC leg and re-originate plain RTP on the carrier leg, triggering immediate media incompatibility. - Codec Intersection and Transcoding Blocks: Setting
disable-transcoding=trueon the Sofia profile or omittingmod_opusand G.711 (PCMU,PCMA) fromglobal_codec_prefsprevents FreeSWITCH from bridging Opus-preferring browsers to G.711-only trunks.
Never set rtp_secure_media=true globally or export it to PSTN trunks for WebRTC calls. FreeSWITCH enables DTLS-SRTP automatically on browser offers containing a=fingerprint without needing SDES crypto attributes.
Why Standard Implementations Fail
Forcing SDES SRTP Across Both Call Legs
Administrators often add <action application="export" data="rtp_secure_media=true"/> assuming WebRTC requires it. Because export propagates the variable to the B-leg, outbound carrier trunks that do not support RFC 4568 SDES immediately return 488 Not Acceptable Here.
Using disable-transcoding on Mixed WebRTC Profiles
Profiles tuned for pure SIP-to-SIP passthrough frequently enable disable-transcoding=true to save CPU. When a browser offers opus with UDP/TLS/RTP/SAVPF and the carrier only accepts PCMU, FreeSWITCH refuses to transcode and drops the call with CODEC NEGOTIATION ERROR.
Missing DTLS Certificate or Unloaded mod_opus
If dtls-srtp.pem in $${certs_dir} is unreadable by the freeswitch user, or if mod_opus is commented out in modules.conf.xml, WebRTC offers fail media initialization before reaching the bridge action.
Step-by-Step Resolution Playbook
Step 1: Capture the Hangup Cause and SDP Negotiation Trace
Open fs_cli and enable SIP and media debug logging to confirm whether the 488 originates on the A-leg (WebRTC) or B-leg (PSTN trunk):
fs_cli -x "sofia global siptrace on"
fs_cli -x "console loglevel debug"Place a test call and check whether FreeSWITCH logs CODEC NEGOTIATION ERROR or rejects the B-leg due to SAVP/crypto mismatch. Turn tracing off afterward with fs_cli -x "sofia global siptrace off".
Step 2: Configure the Sofia Profile for Full Media Bridging
Verify your internal WebRTC Sofia profile (typically /etc/freeswitch/sip_profiles/internal.xml) disables proxy/bypass media and transcoding locks while enabling WSS and NAT traversal:
<!-- /etc/freeswitch/sip_profiles/internal.xml -->
<param name="wss-binding" value=":7443"/>
<param name="inbound-proxy-media" value="false"/>
<param name="inbound-bypass-media" value="false"/>
<param name="disable-transcoding" value="false"/>
<param name="inbound-late-negotiation" value="true"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>Step 3: Align Codec Preferences in vars.xml and Load mod_opus
Ensure /etc/freeswitch/vars.xml includes both OPUS and fixed-rate G.711 codecs (PCMU, PCMA) for seamless WebRTC-to-PSTN bridging:
<!-- /etc/freeswitch/vars.xml -->
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,PCMU,PCMA,G722"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,OPUS"/>Confirm mod_opus is loaded in fs_cli:
fs_cli -x "module_exists mod_opus"
fs_cli -x "load mod_opus"Step 4: Scope rtp_secure_media Strictly in the Dialplan
Remove any global rtp_secure_media=true export before bridging to plain RTP trunks. Explicitly set rtp_secure_media=false on the outbound bridge leg when calling unencrypted PSTN gateways:
<!-- /etc/freeswitch/dialplan/default.xml -->
<extension name="webrtc_to_pstn">
<condition field="destination_number" expression="^(\+?1?\d{10,15})$">
<action application="set" data="bypass_media=false"/>
<action application="set" data="proxy_media=false"/>
<action application="bridge" data="{rtp_secure_media=false}sofia/gateway/pstn_trunk/$1"/>
</condition>
</extension>Step 5: Reload Sofia and Verify DTLS-SRTP and Bridge State
Reload the XML configuration and restart the Sofia profile to apply changes, then verify DTLS certificate permissions and active bridged media:
fs_cli -x "reloadxml"
fs_cli -x "sofia profile internal restart"
# Verify DTLS-SRTP certificate exists and is readable
ls -l /etc/freeswitch/tls/dtls-srtp.pem
# During a live test call, inspect active channels and negotiated codecs
fs_cli -x "show channels"Experiencing this issue in your production systems?
Calricon conducts senior-level VoIP, SIP trunking, Asterisk, and cloud infrastructure audits. We review your live configs, identify packet drops or contention bottlenecks, and provide exact remediation runbooks.