Here we will try to quickly explain how to troubleshoot RTP DTMF problems in Asterisk.
In order to debug problems of incorrectly detected DTMF digits, one needs to figure out whether digits are detected at all and why they are ignored.
First one should detect via tcpdump that DTMF are indeed sent! And if that is the case, one goes further…
To do that certain logging options have to be set:
1. logger.conf has to be modified and full debugging with dtmf option has to be enabled
full => notice,warning,error,debug,verbose,dtmf,fax
2. core set debug 3 or core set debug 4 needs to be set in Asterisk CLI
3. rtp set debug on needs to be enabled in Asterisk CLI
4. logger reload to apply logger details
Since there will be lots of data, I recommend that you enable above quickly and then reset to default settings:
1. core set debug 1 in Asterisk CLI
2. rtp set debug off
3. Disable full in logger.conf and perform logger reload
Once above is enabled full file will be filled with data about RTP packets, try to grep by string DTMF. Once you identify the interesting line what you need to look for is something like this: [Mar 20 09:27:43] VERBOSE res_rtp_asterisk.c: Sent RTP DTMF packet to x.x.x.x:14584 (type 101, seq 052452, ts 411623440, len 000004)
The important piece is in above log message is number 21156 which is thread id to look for. Grep by that number and you will see all relevant messages for that particular thread-id.
In case you see message Sent RTP packet that means that the core bridging is in use. In such case Asterisk will reconstruct each RTP frame differently and this may affect DTMF RTP packets as well.
Here is info on possible RTP bridges (from https://www.reddit.com/r/Asterisk/comments/5936q6/what_is_locally_bridging/):
One can try to enable Packet2Packet bridging, but this will only work if certain conditions are met:
1. Both sides have to be SIP
2. Both sides have to have same audio codecs and same payload size (for instance 20ms)
3. Both sides have to have video support disabled
4. Both sides must not have options for DTMF processing (such as tT, instant recording etc)
5. Dynamic features in Settings > Servers > Edit must be turned off
6. Direct media must be off
7. DTMF settings on both sides must be same (eg RFC2833)
8. Jitterbuffer must be off
9. SRTP encryption must be off
If above conditions are met (and possibly certain other options need to be fiddled with), when you do rtp set debug on you should see something like this: Sent RTP P2P packet to x.x.x.x:15632 (type 101, len 000004).