As mentioned in this post, Asterisk now supports the use of RFC4733 digits in common bitrates beyond 8kHz. At the end of the post, we mention the use of a preferred codec to help determine what bitrate digits to use when no audio frames had yet been sent. Turns out, the method mentioned there wasn’t quite right. Here’s why…
It turns out many folks had been using a work-around to allow VoIP platforms to use RFC4733 digits with non 8kHz RTP streams. You can do this by sending or accepting an offer for 8kHz digits with your Opus (or any other non 8kHz) audio stream. That looks like this…
Offer:
m=audio 10768 RTP/AVP 107 0 8 101 102
a=rtpmap:107 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/48000
a=fmtp:101 0-16
a=rtpmap:102 telephone-event/8000
a=fmtp:102 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
Response:
m=audio 9000 RTP/AVP 96 102
a=sendrecv
a=rtpmap:96 opus/48000/2
a=rtpmap:102 telephone-event/8000
a=fmtp:102 0-16
Usually you would want to offer a matching pair, ie;
m=audio 9000 RTP/AVP 96 102
a=sendrecv
a=rtpmap:96 opus/48000/2
a=rtpmap:101 telephone-event/48000
a=fmtp:101 0-16
…but in many cases this mismatch was used and accepted. After the changes for this feature, Asterisk would only use DTMF offers that matched the bitrate of the in-use or preferred audio codec. The specification doesn’t really get into this scenario so we have to assume it is valid.
To accept this scenario, Asterisk now keeps track of the remote end’s DTMF preference based on SDP offer order. If there is a DTMF offer that matches the in-use/preferred audio codec Asterisk will first try to use that. If the negotiation doesn’t include a match, then Asterisk will see what the remote end’s preferred DTMF offer is and try that. If all else fails, Asterisk will then try for 8kHz as a default, essentially acting as it did previously.
We’ve written a number of tests in the testsuite to try and cover as many of the possible scenarios. We encourage you to take a look at what we have covered and please let us know if there are any you think we should add!
The post The Vagaries of DTMF Payload Negotiation appeared first on Asterisk.
No Comment! Be the first one.