[Home]

Summary:ASTERISK-29275: Support of MIME-type for wav16
Reporter:Boris P. Korzun (drtr0jan)Labels:patch
Date Opened:2021-02-02 02:30:11.000-0600Date Closed:2021-09-21 13:05:25
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Formats/format_wav
Versions:16.16.0 18.2.0 Frequency of
Occurrence
Related
Issues:
Environment:FreeBSD 12.2, Asterisk 18.2Attachments:( 0) 0001-res_http_media_cache.c-Compare-unaltered-MIME-types.patch
Description:Suggested patch provides a support of a MIME-type for wav16 as {{audio/x-wav;codec=pcm;bit=16;rate=16000}}. Also *adds* a MIME-type for classic wav as {{audio/x-wav;codec=pcm;bit=16;rate=8000}}.
Comments:By: Asterisk Team (asteriskteam) 2021-02-02 02:30:17.419-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2021-02-12 07:22:48.964-0600

Change 15391 merged by George Joseph:
format_wav: Support of MIME-type for wav16

[https://gerrit.asterisk.org/c/asterisk/+/15391|https://gerrit.asterisk.org/c/asterisk/+/15391]

By: Friendly Automation (friendly-automation) 2021-02-12 07:22:59.466-0600

Change 15415 merged by George Joseph:
format_wav: Support of MIME-type for wav16

[https://gerrit.asterisk.org/c/asterisk/+/15415|https://gerrit.asterisk.org/c/asterisk/+/15415]

By: Friendly Automation (friendly-automation) 2021-02-12 07:23:18.316-0600

Change 15414 merged by George Joseph:
format_wav: Support of MIME-type for wav16

[https://gerrit.asterisk.org/c/asterisk/+/15414|https://gerrit.asterisk.org/c/asterisk/+/15414]

By: Sean Bright (seanbright) 2021-09-10 08:59:24.566-0500

This was apparently broken by [this review|https://gerrit.asterisk.org/c/asterisk/+/16143] but I am dubious that it would have worked in the first place.

[~drtr0jan] - can you please test Asterisk from before my patch(es) against an HTTP response that contains the wav16 MIME type parameters and attach a console log that shows the file being identified as wav16?

By: Boris P. Korzun (drtr0jan) 2021-09-10 09:28:18.321-0500

Yeap, you are right.
It worked for me before ASTERISK-27871 because file had being identified by extension at first (my extension was correct). After ASTERISK-29527 file was identified by content-type at first. And {{normalize_content_type_header()}} has broken identifying.
But content-type identifying without {{normalize_content_type_header()}} works fine.

By: Sean Bright (seanbright) 2021-09-10 09:48:08.406-0500

[~drtr0jan] - can you try [the attached patch|^0001-res_http_media_cache.c-Compare-unaltered-MIME-types.patch] and let us know if that fixes the problem for you?

By: Sean Bright (seanbright) 2021-09-10 09:53:45.510-0500

bq. But content-type identifying without {{normalize_content_type_header()}} works fine.

It may work, but comparing MIME types is not as simple as just comparing strings. The wav16 MIME type in {{format_wav.c}} is:

{noformat}
audio/x-wav;codec=pcm;bit=16;rate=8000
{noformat}

But will not match the perfectly valid - and arguably idiomatic:

{noformat}
audio/x-wav; codec=pcm; bit=16; rate=8000
{noformat}

By: Boris P. Korzun (drtr0jan) 2021-09-13 14:37:28.527-0500

Hi, [~seanbright]. Thx for the patch. It looks like as a fix for me. But I need more time for investigate the problem.

By: Boris P. Korzun (drtr0jan) 2021-09-14 11:05:36.802-0500

Hi [~seanbright].
It could be used {{ast_strdupa()}} instead {{ast_strdup()}} for allocating memory for short strings in {{derive_extension_from_mime_type()}}. What do you think about it?

By: Sean Bright (seanbright) 2021-09-14 11:19:24.036-0500

[~drtr0jan], good idea. I've updated the attached patch.

By: Boris P. Korzun (drtr0jan) 2021-09-16 07:40:02.268-0500

Hi [~seanbright]. It works great! Thx.

By: Friendly Automation (friendly-automation) 2021-09-21 13:05:27.251-0500

Change 16506 merged by Friendly Automation:
res_http_media_cache.c: Compare unaltered MIME types.

[https://gerrit.asterisk.org/c/asterisk/+/16506|https://gerrit.asterisk.org/c/asterisk/+/16506]

By: Friendly Automation (friendly-automation) 2021-09-21 13:08:06.991-0500

Change 16505 merged by Friendly Automation:
res_http_media_cache.c: Compare unaltered MIME types.

[https://gerrit.asterisk.org/c/asterisk/+/16505|https://gerrit.asterisk.org/c/asterisk/+/16505]

By: Friendly Automation (friendly-automation) 2021-09-21 13:10:38.911-0500

Change 16487 merged by Friendly Automation:
res_http_media_cache.c: Compare unaltered MIME types.

[https://gerrit.asterisk.org/c/asterisk/+/16487|https://gerrit.asterisk.org/c/asterisk/+/16487]

By: Friendly Automation (friendly-automation) 2021-09-21 13:11:20.457-0500

Change 16504 merged by Friendly Automation:
res_http_media_cache.c: Compare unaltered MIME types.

[https://gerrit.asterisk.org/c/asterisk/+/16504|https://gerrit.asterisk.org/c/asterisk/+/16504]