Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interoperability: Snom #10

Open
traud opened this issue Jan 21, 2017 · 2 comments
Open

Interoperability: Snom #10

traud opened this issue Jan 21, 2017 · 2 comments

Comments

@traud
Copy link
Owner

traud commented Jan 21, 2017

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-nb and
  • 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.

@traud
Copy link
Owner Author

traud commented Mar 10, 2017

Snom fixed that issue just days after my report: 8.9.3.59…

However, I cannot close this issue yet, because opus-nb still gives no-audio, when there are additional format parameters within the SDP-INVITE, for example Asterisk is configured to use not variable bit-rate but constant bit-rate: a=fmtp:119 maxplaybackrate=8000; cbr=1.

This does not happen, when you use opus-wb. If you face any additional issues with opus-wb, do not hesitate add your comment to this thread. For me, opus-wb works fine.

@traud
Copy link
Owner Author

traud commented Aug 17, 2021

Snom uses opus-wb to send wideband audio (16000 kHz) and opus-nb to send narrowband audio (8000 kHz).

I have to correct myself because those are not about sending but just asking the remote party what to send.
When you specify opus-wb, the Snom adds the following format parameters to SDP:

a=fmtp:119 maxplaybackrate=16000;sprop-maxcapturerate=16000;maxaveragebitrate=20000;useinbandfec=1

When you specify opus-nb, the Snom adds the following format parameters to SDP:

a=fmtp:118 maxplaybackrate=8000;sprop-maxcapturerate=8000;maxaveragebitrate=12000;useinbandfec=1

When you specify just opus, no format parameters are added to SDP, allowing the remote party to send anything. In all cases, the Snom itself sends just Opus-NB (SiLK-only Narrowband 20ms; ToC 0x08). I found no way via Phone, Web, or Provisioning interface nor SDP fmtp, to trigger higher bands like Opus-WB. This was reported …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant