[Home]

Summary:ASTERISK-26520: codec_opus: Generated fmtp line has no content
Reporter:Sebastian Gutierrez (sum)Labels:
Date Opened:2016-10-29 08:28:10Date Closed:2016-11-16 22:40:40.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Codecs/codec_opus
Versions:13.12.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) fullverboselog.txt
( 1) LogSIPDEBUG.txt
( 2) newSDPs.txt
( 3) OSSDP.txt
Description:As reported at https://github.com/eface2face/rtcninja.js/issues/35 we somehow generated an fmtp line with no attributes. We should not do that.
Comments:By: Sebastian Gutierrez (sum) 2016-10-29 10:19:23.174-0500

attached logs with sip debug, where you can see the SDP and all

By: Joshua C. Colp (jcolp) 2016-10-29 10:20:26.186-0500

What is the scenario? Are you calling through Asterisk? Originating a call out using AMI/originate?

By: Sebastian Gutierrez (sum) 2016-10-29 10:23:25.948-0500

using the jssip directly through asterisk, is I use the Open Source version of the codec_opus works ok

By: Sebastian Gutierrez (sum) 2016-10-29 10:24:25.932-0500

attach a sdp generated with asterisk 13.10 and the open source opus

By: Joshua C. Colp (jcolp) 2016-10-29 10:26:04.769-0500

We need a console log with verbose enabled and a description of the exact scenario. The SDP does clearly show this, but it doesn't provide any information that would help understand as to how it happened.

By: Sebastian Gutierrez (sum) 2016-10-29 10:32:04.939-0500

Scenario: Asterisk 13.12.0
               chan_sip
                2 jssip peers webrtc (only opus codec enabled)
                basic call between them (Dial)
At the momento of answer I get a Bad Media description due to the missing field in fmtp

Attached full verbose and debug for the call

By: Sebastian Gutierrez (sum) 2016-10-30 13:56:02.633-0500

maybe you can point me in the right direction where to look at the code to see if I can try to help fixing this.

thanks

By: Joshua C. Colp (jcolp) 2016-10-30 13:59:28.604-0500

The res/res_format_attr_opus.c code handles the format attributes. The code for the codec itself is not available.

By: Alexander Traud (traud) 2016-11-02 15:32:40.711-0500

Have a look at {{opus_generate_sdp_fmtp}}, the variable {{size}}, and the condition {{size == ast_str_strlen(*str)}}.
* What is the value of {{size}}?
* Is {{ast_str_reset}} executed in your case?

I doubt this is ever executed, because the initial {{str}} is never empty but comes with previous SDP data. In the old version, the logic worked. Anyway, please, double-check the values of {{CODEC_OPUS_DEFAULT_FEC}} and {{attr->fec}} as well. I wonder why that case is not matched in your scenario.

By: Sebastian Gutierrez (sum) 2016-11-08 07:08:35.016-0600

I'll put some debug on that function and let you know

By: Sebastian Gutierrez (sum) 2016-11-08 09:43:10.446-0600

tests:

  size = ast_str_append(str, 0, "a=fmtp:%u ", payload);
  ast_log(LOG_WARNING, "(%i) TAMANO SIZE\n", size);

-->  opus_generate_sdp_fmtp: (11) TAMANO SIZE


and this:
ast_log(LOG_WARNING, "STRLEN SIZE(%i)\n", ast_str_strlen(*str));
if (size == ast_str_strlen(*str)) {
               ast_str_reset(*str);
       } else {
               ast_str_truncate(*str, -1);
               ast_str_append(str, 0, "\r\n");
       }

--> opus_generate_sdp_fmtp: STRLEN SIZE(38)


Never enters to ast_str_reset.


Other thing is no matter what I use in codecs.conf for  bitrate etc I get:

m=audio 18568 RTP/SAVPF 107 101
a=rtpmap:107 opus/48000/2
a=fmtp:107
a=rtpmap:101 telephone-event/8000




By: Mark Michelson (mmichelson) 2016-11-16 15:42:02.481-0600

I've discovered the reason why the empty fmtp line is there. The Opus format attribute module is assuming that it is being given an empty string into which to place format attributes. However, chan_sip gives it the entire SDP it has built so far. When the format attribute module attempts to determine if it added any attributes, it does not properly calculate what it did, and so it ends up leaving the empty fmtp line in the SDP.

Regarding your codecs.conf issue, there is a bug in codec_opus where if you name the section in codecs.conf "opus", your options will end up getting overwritten by the default attributes for Opus. You can instead name the section something like "myopus", and then in your sip.conf, you can set "allow=myopus" in order to use those attributes.

By: Friendly Automation (friendly-automation) 2016-11-16 22:40:41.098-0600

Change 4461 merged by George Joseph:
res_format_attr_opus: Fix fmtp generation.

[https://gerrit.asterisk.org/4461|https://gerrit.asterisk.org/4461]

By: Friendly Automation (friendly-automation) 2016-11-16 22:41:29.443-0600

Change 4460 merged by George Joseph:
res_format_attr_opus: Fix fmtp generation.

[https://gerrit.asterisk.org/4460|https://gerrit.asterisk.org/4460]

By: Friendly Automation (friendly-automation) 2016-11-16 23:20:36.548-0600

Change 4462 merged by zuul:
res_format_attr_opus: Fix fmtp generation.

[https://gerrit.asterisk.org/4462|https://gerrit.asterisk.org/4462]