SIP Trunk DTMF Not Working in IVR: Find the Broken Leg
When sip trunk dtmf not working in an IVR, the cause is almost always a DTMF method mismatch on one call leg. Read the SDP for telephone-event, align dtmf_mode on trunk and endpoint, then confirm Asterisk logs the digit.
- Check the INVITE and 200 OK SDP for a=rtpmap:101 telephone-event/8000; if either side omits it, RFC 4733 cannot work on that leg.
- Set the same method on trunk and extension: dtmf_mode=rfc4733 in PJSIP, dtmfmode=rfc2833 in chan_sip.
- Inband detection only works reliably with G.711 end to end; G.729 and Opus destroy the tones.
- If the CLI logs the digit but the IVR ignores it, the fault is dialplan or timing, not DTMF.
- Verify with a test call per codec and confirm telephone-event packets carry the end bit.
How do I fix SIP trunk DTMF not working in an IVR by finding the broken leg?
When SIP trunk DTMF is not working in an IVR, the first job is to find which call leg is failing. An IVR call has two legs: carrier to PBX, then PBX to the phone (or to another trunk). The IVR itself only listens on the first leg, so for a caller pressing keys on a mobile or desk phone the path is phone, carrier network, your trunk, Asterisk. A failure in any hop looks the same to the caller: the prompt plays and nothing happens.
Work from the PBX outward. First decide whether Asterisk sees the digit at all. Then decide which method the trunk negotiated. Only then touch settings.
- Call your own DID from a mobile and press a digit during the IVR prompt.
- Watch the Asterisk CLI with core set debug 3 and rtp set debug on. If you see a digit event, DTMF arrives and the problem is IVR logic (see the later section).
- If nothing is logged, run pjsip set logger on and read the INVITE and 200 OK SDP for the trunk.
- If the SDP has telephone-event on both sides, capture RTP and check whether event packets actually arrive.
- If the SDP has no telephone-event, change the trunk to a method the carrier supports (inband or info) or ask the carrier to enable RFC 4733.
How do inband, RFC 4733 and SIP INFO DTMF actually work?
Inband DTMF is real audio: two simultaneous tones mixed into the voice stream. Because it travels as codec-encoded audio, anything that distorts audio distorts the digit. Asterisk's detector needs uncompressed audio (slin) or G.711 ulaw/alaw.
RFC 2833, updated by RFC 4733, sends digits as telephone-event RTP packets in the media stream, usually payload type 101 at 8000 Hz. Each packet carries the event code, volume, duration and an end bit. Digits are signalled separately from audio, so codec choice does not matter.
SIP INFO sends each digit in the signalling channel as a message body, typically application/dtmf-relay with Signal=5 and Duration=250. It depends on both ends supporting it and on the PBX relaying it in the bridge.
Compare the three:
| Method | Where it travels | Survives G.729/Opus | Survives transcoding | Main weakness |
|---|---|---|---|---|
| Inband | Audio in RTP | No | Only G.711 end to end | Packet loss, jitter and compression corrupt tones |
| RFC 4733 (rfc2833) | telephone-event RTP, PT usually 101 | Yes | Yes, Asterisk translates events | Needs telephone-event in both SDPs; PT or SDP rewrites break it |
| SIP INFO | SIP signalling | Yes | Only if both legs support it | Not universal; bridging support varies |
What does a good and a bad SDP look like?
The negotiated mode is visible in the SDP of the INVITE and the 200 OK. Capture it with pjsip set logger on, sngrep, or tcpdump opened in Wireshark.
A healthy offer lists the telephone-event payload type and the events it handles:
# GOOD: both sides carry telephone-event
m=audio 12345 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
# BAD: no telephone-event line anywhere
m=audio 12345 RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
# MISMATCH worth checking: peer uses a different PT
m=audio 40000 RTP/AVP 18 96
a=rtpmap:18 G729/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15How do I set the DTMF mode on the trunk and extension?
Set the method explicitly on each endpoint rather than relying on defaults. In PJSIP the option is dtmf_mode with values rfc4733 (the default), inband, info and auto. In legacy chan_sip the equivalent is dtmfmode=rfc2833 (also inband, info, auto).
auto uses RFC 4733 when the SDP contains telephone-event and falls back to inband when it does not. That fallback hides the mismatch, and then fails once a compressed codec is used.
In FreePBX, open Connectivity > Trunks > your trunk > pjsip tab and set DTMF Mode. Do the same on each extension under Applications > Extensions > Advanced. FreePBX writes the values into pjsip.endpoint.conf equivalents.
; pjsip.conf (custom or generated)
[carrier-trunk]
type=endpoint
transport=transport-udp
context=from-pstn
disallow=all
allow=ulaw,alaw
dtmf_mode=rfc4733
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
; chan_sip equivalent
[carrier-trunk]
type=peer
dtmfmode=rfc2833Why does DTMF fail with payload type mismatches, NAT or transcoding?
Carriers send telephone-event as 96, 100, 101 or others. Asterisk normally follows the type the peer offers, so a different number alone is rarely the problem. Trouble starts when an SBC or a SIP ALG on the router rewrites or strips the SDP, so the line never reaches Asterisk.
Disable SIP ALG or SIP helper on the edge router and compare the SDP seen on the WAN with what Asterisk logs. If they differ, the router is rewriting it.
Transcoding explains the case where DTMF works on a G.711 call and fails on a G.729 or Opus call. Inband tones do not survive the codec conversion, but RFC 4733 events are translated by Asterisk. SIP INFO works only when both legs support it.
Use this table to match symptoms:
| Symptom | Likely cause | Fix |
|---|---|---|
| No digits on any call | No telephone-event in SDP, or mode mismatch | Align dtmf_mode; ask the carrier which method it supports |
| Works on G.711, fails on G.729 or Opus | Inband mode with compressed codec | Switch to rfc4733 |
| Works from some callers only | Caller's network converts DTMF | Test from another carrier; enable inband plus 4733 only if carrier requires it |
| Digits one direction only | Asymmetric NAT or ALG, or one side in different mode | Check rtp_symmetric, external_media_address, disable ALG |
| Doubled digits | Carrier sends inband and 4733, or phone sends 4733 and INFO | Pick one method on each leg |
| Short or clipped digits | Jitter, missing end packets, short duration | Check RTP loss; verify end bit set |
| Digit logged but IVR ignores it | Dialplan or timeout issue | Fix IVR logic, not DTMF |
How can I tell a real DTMF failure from an IVR logic failure?
The Asterisk CLI settles it. With the debug commands enabled, a received RFC 4733 digit appears as a line like Got RTP RFC2833 digit, and the channel shows DTMF begin and DTMF end events.
If those lines appear and the IVR still does nothing, DTMF works. Look at the dialplan: the digit may have no matching extension, so Asterisk sends it to the i (invalid) handler, or the timeout fired and it went to t. In FreePBX IVR settings, check that Direct Dial is enabled if you expect callers to dial extensions, and that the entry exists for the digit pressed.
Timing causes are common. A short Timeout in the IVR, a Background() prompt that is not interruptible, or WaitExten set too low will drop digits that arrive late. Increase the timeout and confirm the prompt allows barge-in.
If no digit lines appear, DTMF is not reaching the PBX and you return to the SDP and capture.
asterisk -rvvv
core set debug 3
rtp set debug on
pjsip set logger on
pjsip show endpoint carrier-trunk
# packet capture for Wireshark
tcpdump -i any -s0 -w /tmp/ivr.pcap udp port 5060 or udp portrange 10000-20000
# live SIP ladder
sngrep What is the test checklist to confirm the fix?
Run the same sequence after every change so you can compare results.
In Wireshark, open Telephony > RTP > RTP Streams to find the event stream, and use the RTP Player to check timing. Digit events should show a start packet, repeats with growing duration, and final packets with the end bit set.
- Call your own DID from a mobile and press each digit 0 to 9, plus * and #.
- Confirm the CLI logs every digit once, not twice and not partially.
- Repeat from an internal extension to the IVR to test the phone leg.
- Test calls that bridge to a phone or another trunk and press digits in both directions.
- Capture the call and confirm telephone-event packets with the end bit set, with the same payload type as the SDP.
- Run one test call per codec you allow (ulaw, alaw, G.729, Opus) to rule out transcoding effects.
Which carrier and phone settings affect DTMF?
Ask the carrier which method it supports. Some do only RFC 2833, others only INFO, and some send inband for specific destinations. Get the answer in writing and match it on the trunk.
On Yealink phones, the setting is under Account > Advanced: DTMF Type (RFC2833, INFO, Inband or combinations) and DTMF Payload Type (typically 101). Polycom has similar fields for DTMF relay and payload. Set the phone to the same type as its endpoint in Asterisk.
Some phones have a Send DTMF option that sends both RFC 2833 and INFO, which produces doubled digits at the PBX. On ATAs, check the DTMF method and the payload type, and disable inband sending if you use RFC 4733.
Common questions
Is RFC 2833 the same as RFC 4733?
RFC 4733 obsoletes RFC 2833 and keeps the same telephone-event packet format for digits. Asterisk and most vendors still label the setting rfc2833 or rfc4733 interchangeably.
Why does DTMF work in only one direction?
One leg is usually using a different method, or NAT or a SIP ALG is blocking or rewriting RTP in one direction. Compare the SDP in both directions and check rtp_symmetric and the external media address.
Should I use inband DTMF on a SIP trunk?
Only as a last resort, because it depends on G.711 end to end and clean audio. Packet loss, jitter or any compressed codec corrupts the tones.
What does dtmf_mode auto do in PJSIP?
It uses RFC 4733 when the SDP includes telephone-event and falls back to inband when it does not. That hides the missing line in the SDP, so set an explicit mode for production trunks.
Why are my digits clipped or too short?
Jitter or lost packets can remove the events or the end packets, so Asterisk sees a short or no digit. Check the RTP stream for loss and confirm the end bit appears in the capture.