Fix Codec Mismatch (488 Not Acceptable Here)

Resolve SIP 488 errors and codec negotiation failures between Asterisk endpoints, trunks, and providers

What is the 488 Error?

The SIP response 488 Not Acceptable Here means the two sides of a call could not agree on any media parameters — most commonly, they have no codec in common. The call fails before any audio is exchanged.

During SIP call setup, each side advertises its supported codecs in the SDP (Session Description Protocol) body. If there is zero overlap between the caller's and callee's codec lists, Asterisk returns 488.

; Example SDP from caller (only offers G.729):
; m=audio 10000 RTP/AVP 18
; a=rtpmap:18 G729/8000

; Asterisk endpoint only allows ulaw:
; allow=ulaw (payload type 0)

; Result: No common codec -> 488 Not Acceptable Here

Codec Configuration

chan_sip (sip.conf):

[general]
; IMPORTANT: Always disallow all first, then allow specific codecs
disallow=all
allow=ulaw      ; G.711 ulaw (North America)
allow=alaw      ; G.711 alaw (Europe/International)
allow=g722      ; HD voice (wideband)
allow=g729      ; Low bandwidth (requires codec module)

; The ORDER matters! First codec listed = preferred codec.
; Asterisk will try to use the first common codec.

; Per-peer codec override:
[internal-phone]
type=friend
disallow=all
allow=g722      ; Prefer HD voice for internal calls
allow=ulaw
allow=alaw

[my-trunk]
type=peer
disallow=all
allow=ulaw      ; Match what the provider supports
allow=alaw
allow=g729

PJSIP (pjsip.conf):

[my-endpoint]
type=endpoint
disallow=all
allow=ulaw
allow=alaw
allow=g722
allow=opus      ; For WebRTC endpoints

; Control codec negotiation preference:
; prefer_codec_over_sdp=yes  ; Use Asterisk's preference order
; (default: remote side's preference order is used)
Common Mistake: Forgetting disallow=all before allow=. Without it, Asterisk's default codecs remain active, and the allow directive just adds to the list instead of replacing it.

SDP Payload Type Reference

Payload TypeCodecAsterisk NameBitrateSample Rate
0PCMUulaw64 kbps8000 Hz
3GSMgsm13 kbps8000 Hz
4G723g7236.3 kbps8000 Hz
8PCMAalaw64 kbps8000 Hz
9G722g72264 kbps16000 Hz
18G729g7298 kbps8000 Hz
97iLBCilbc15 kbps8000 Hz
96-127Dynamicopus, vp8, etc.VariesVaries
101telephone-event(DTMF)N/A8000 Hz

Debugging Codec Issues

# Check what codecs Asterisk has loaded
asterisk -rx "core show codecs"

# Show codec translation matrix (what conversions are possible)
asterisk -rx "core show translation"

# Check specific peer's codec configuration
asterisk -rx "sip show peer my-trunk"
# Look for "Codecs:" line

# PJSIP:
asterisk -rx "pjsip show endpoint my-endpoint"
# Look for "Allow:" line

# Enable SIP debug to see the actual SDP exchange
asterisk -rx "sip set debug on"
# or
asterisk -rx "pjsip set logger on"

# In the SIP INVITE, look for:
# m=audio PORT RTP/AVP 0 8 18 101
#                       ^ ^ ^  ^
#                       | | |  DTMF
#                       | | G.729
#                       | alaw
#                       ulaw

# In the 200 OK response, the accepted codec is listed
# If you get 488 instead, the SDP shows no common codec

# Check if G.729 module is loaded (if you need G.729)
asterisk -rx "module show like g729"
asterisk -rx "module show like codec_g729"

G.729 Codec in Asterisk

G.729 is a popular low-bandwidth codec but has licensing considerations:

  • G.729 patents expired in 2017 — the codec is now free to use
  • codec_g729 — Commercial binary module from Digium/Sangoma (was required before patent expiry)
  • codec_g729a (open source) — Free open-source implementations available (Asterisk 16+)
  • Passthrough — If both sides use G.729 natively, Asterisk can pass it through without transcoding (no module needed for passthrough)
# Check if G.729 codec is available
asterisk -rx "core show codecs" | grep -i g729

# If not loaded, install it:
# For Asterisk 18+, the open-source BCG729 codec:
apt-get install asterisk-codec-g729   # Debian/Ubuntu
# or compile from source:
# git clone https://github.com/BelledonneCommunications/bcg729

# Load the module
asterisk -rx "module load codec_g729a.so"

# Allow G.729 passthrough (no transcoding, no module needed):
[my-trunk]
disallow=all
allow=g729    ; Will passthrough if both sides use G.729

Best Practices

  1. Always start with disallow=all then list only the codecs you actually need
  2. Match codecs between endpoints and trunks to avoid transcoding (saves CPU)
  3. List preferred codec first — Asterisk prefers codecs in the order listed
  4. Ask your SIP provider which codecs they support — do not guess
  5. Use G.711 (ulaw/alaw) as fallback — it is universally supported
  6. Enable G.722 for HD voice on internal calls where bandwidth permits
  7. Always include telephone-event (DTMF) — this is automatic when dtmfmode=rfc2833
  8. Test with sip set debug on — inspect the SDP to see exactly what is offered and accepted
← Back to All Asterisk Solutions|Asterisk Complete Guide →