-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Snom added the Opus Codec for their Desk Phones in the year 2014. At that time RFC 7587 was not final and the Snom implementation based on a draft from 2012. Therefore, the rtpmap was not opus/48000/2 but without the channel: opus/48000. Furthermore in the year 2012, the fmtp parameter for the bandwidth was called maxcodedaudiobandwidth and not maxplaybackrate.
Recently, those issues got fixed. However, Snom Desk Phones still play choppy audio when the Opus Codec is negotiated and Asterisk transcodes from another audio format to Opus.
Snom uses opus-wb to send wideband audio (16000 kHz) and opus-nb to send narrowband audio (8000 kHz). RFC 7587 Table 2 states that for 20 ms the RTP timestamp should be increased by 960 samples, always. However, Snom increases the timestamp by
- 160 samples with
opus-nband - 320 samples with
opus-wb.
Snom does not only send but expects to receive such timestamps as well. Otherwise the audio is choppy. Asterisk increases by 960. In Asterisk, you can hot fix this by changing res/res_rtp_asterisk.c:ast_rtp_raw_write from
if (frame->frametype == AST_FRAME_VOICE) {
pred = rtp->lastts + frame->samples;
/* Re-calculate last TS */
rtp->lastts = rtp->lastts + ms * rate;
if (ast_tvzero(frame->delivery)) {
…
}
}to
if (frame->frametype == AST_FRAME_VOICE) {
rtp->lastts = rtp->lastts + ms * 16;
}for opus-wb. For opus-nb, instead of 16, you go for 8. That gives clean audio with Snom Desk Phones and proves the correctness of this approach. In the year 2014, a similar mistake was done by CSipSimple.
Currently, these software branches and head versions are affected:
- 8.7.5.35 is the current release version (Nov. 2015).
- 8.7.5.44 is the current beta version (Mar. 2016).
- 8.9.3.57 is the latest version of a new branch (Jan. 2017).
Because Snom has to solve this software bug and I see no way to solve it from within Asterisk, I reported this to Snom. Here, I leave this issue report open until this interoperability issue is fixed by Snom.