Summary:ASTERISK-02448: waw49 files sometimes get size for data chunk on record
Reporter:z_smurf (z_smurf)Labels:
Date Opened:2004-09-22 09:42:40Date Closed:2008-01-15 15:09:52.000-0600
Versions:Frequency of
Environment:Attachments:( 0) correct.txt
( 1) wav-check.pl
( 2) wavfix.diff.txt
( 3) wrong.txt
Description:Previous asterisk (before 2004-09-01) had an issue on recording wav49 files that made some players to crach. This seems to be partly fixed on CVS 2004-09-20, but it is still not correct.

The .WAV-files contains 1 header and 3 chunks. The size of the the header + the size of the 3 chunk-headers+size must be equal to the file-size. 50% of my tests the 3rd chunk-size is set one bit too short.

This will probably not make any player to crash, but still it is not correct.

I have attached a perl-script to check your .WAV files. The 3 last lines does a calculation of the file-sizes in 3 different ways. They must be equal, or the file is not correct.


I have tried to record my files with the record() command in extensions.conf. I am calling in with SIP.

Attached is the output from the wav-test script when the file is being correct, and when it is not correct.
Comments:By: z_smurf (z_smurf) 2004-09-22 10:14:01

I also found that when you try to convert bad .WAV files with sow, this error shows up:

[root]# sox 2004-09-22_16\:23\:20.WAV new.wav
sox: Overriding output size to bytes for compressed data.
sox: help ! internal inconsistency - data_written 17486 gsmbytecount 17485

By: z_smurf (z_smurf) 2004-09-23 18:09:39

I found today that the WAV file will also be corrupt if you let SOX convert an Asterisk recorded gsm file to .WAV

So the error is maybe located to some routine for making GSM data (which may be the same routine as SOX is using), or the way that both SOX and Asterisk converts gsm data to wav49.

A quick and dirty solution is to add an extra byte to the file at the end if the size does not match the sizes described in the file. This will atleast make Windows Mediaplayer happy.

By: zoa (zoa) 2004-09-24 07:17:01

soxmix also chokes on 50% of the monitored gsm files, because of this bug.

I think this should be fixed in the .c code and not with a perl script, although the perl script is a nice workaround for now.

By: Mark Spencer (markster) 2004-10-09 10:54:24

Fixed in CVS head.

By: Russell Bryant (russell) 2004-10-09 12:31:46

fixed in the 1.0 branch

By: Digium Subversion (svnbot) 2008-01-15 15:09:51.000-0600

Repository: asterisk
Revision: 3962

U   trunk/formats/format_wav_gsm.c

r3962 | markster | 2008-01-15 15:09:51 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix wave file lengths (bug ASTERISK-2448)



By: Digium Subversion (svnbot) 2008-01-15 15:09:52.000-0600

Repository: asterisk
Revision: 3963

U   branches/v1-0/formats/format_wav_gsm.c

r3963 | russell | 2008-01-15 15:09:52 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix wave file lengths (bug ASTERISK-2448)