DTMF RTP-Events and 16kHz Codecs

Hello we’re currently working with a vendor to add a 16kHz sampled codec to their hardware, but we’re experiencing duplicate DTMF digits when used in conjunction with asterisk 13. Looking at the relevant code they appear to be interpreted as “new” digits here , and removing that code works around the issue.

Having examined the RTP events they’re being sent with a duration of 160ms, however as they share the SSRC with the RTP stream I’d expect them to share the same clocking with a 16kHz sample rate and a duration of 320ms. The vendor is insisting that they’re compliant with the RFC, but my interpretation is they should be offering and using rtp-events with a 16khz sample rate - this is how endpoints from other vendors are handling it.

Does anyone have any experience with this kind of issue, or input on how the RFC should be interpreted?

INVITE:

v=0
o=FOO_V001 562827048 562827048 IN IP4 192.168.255.100
s=-
c=IN IP4 192.168.255.100
t=0 0
m=audio 50060 RTP/AVP 110 8 101
a=rtpmap:110 BV32/16000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=maxptime:80
a=sendrecv
a=rtcp:50061

200

v=0
o=- 562827048 562827050 IN IP4 192.168.255.200
s=Asterisk
c=IN IP4 192.168.255.200
t=0 0
m=audio 19978 RTP/AVP 110 8 101
a=rtpmap:110 BV32/16000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

RTP

There is supposed to be 8kHz and 16kHz in the SDP, and then depending on which codec is in use the respective one is used for DTMF. Asterisk 13, and chan_sip, have no such support. It was somewhat recently added to chan_pjsip[1].

[1] Asterisk and RFC 4733 ⋆ Asterisk

Thanks jcolp

There is supposed to be 8kHz and 16kHz in the SDP, and then depending on which codec is in use the respective one is used for DTMF.

Is this written in an RFC or somewhere authoritative so I can point the vendor to it?

The RFC we follow is RFC4733[1]. It states:

   Named telephone events are carried as part of the audio stream and
   MUST use the same sequence number and timestamp base as the regular
   audio channel to simplify the generation of audio waveforms at a
   gateway.  The named telephone-event payload type can be considered to
   be a very highly-compressed audio codec and is treated the same as
   other codecs.

If you want further details I’ll have to ask the person who did the work when they return next week, or you can dig through the RFC and comments online sooner.

[1] RFC 4733: RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals

My interpretation of the RFC is the same but the vendor is arguing otherwise.

If you could ask the person that made the recent changes that would be appreciated.

Thanks

Hi @marrold

On my first pass at adding multi-rate dtmf to Asterisk, (current Asterisk versions, pjsip only as @jcolp indicated) I read the specification as not allowing a mismatch in bit rates between the audio and dtmf - so in your example, RTP event digits would only be used if the negotiation settled on the matching PCMA.

However, we found that a number of folks had been using 8K digits with non 8K codecs as a de-facto standard due to so many SIP UAs not supporting non-8K digits. This lead to a change to allow that as a fall back if there were no matching offers.

In practice what it actually looks like to send different rate packets within the same stream isn’t really clear… but after that change the reporter(s) indicated it resolved their issue.

If possible, I would try using the latest Asterisk 20 (or newer) release with pjsip to see if this works with the vendor implementation. If it doesn’t, if you can supply a pcap with the mixed rtp stream we can test it locally and figure out where to go from there.

Hey @mbradeen, thank you for the insight.

I’ve upgraded to Asterisk 22.1.1 with PJSIP version 2.14.1 but I’m still seeing the duplicate digits.

This is an inbound call into Asterisk, offering a 16kHz codec and telephone-event/8000. The offer/answer look the same as prior to upgrading.

Would you mind if I DM you a pcap?

Thanks

Sure thing, it will be helpful for us to take a look.