Not able to play wav files in asterisk
Tags: application root, audio pcm, format wav, wave audio
Hello all,
I am trying to play .wav file using asterisk 1.8.7.1. I tried playing the wav files having different properties.
The properties of the file can be seen using ‘file’ command or ‘ffmpeg -i
1. Filname: miss_audio.wav
[root@localhost en]# file miss_audio.wav
miss_audio.wav: RIFF (little-endian) data, WAVE audio, ITU G.711 mu-law, mono 8000 Hz
[root@localhost en]# ffmpeg -i miss_audio.wav
Stream #0:0: Audio: pcm_mulaw ([7][0][0][0] / 0×0007), 8000 Hz, 1 channels, s16, 64 kb/s
I am getting the following warning in this case.
[Dec 24 15:08:47] WARNING[26513]: format_wav.c:92 check_header_fmt: Not a wav file 7
[Dec 24 15:08:47] WARNING[26513]: file.c:376 fn_wrapper: Unable to open format wav
2. Filename: msg0000.wav
This file is recorded using asterisk voicemail() application .
[root@localhost en]# file msg0000.wav
msg0000.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz
[root@localhost en]# ffmpeg -i msg0000.wav
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0×0001), 8000 Hz, 1 channels, s16, 128 kb/s
And in this case asterisk is trying to play the file in slin format.
—
[Dec 24 15:14:10] WARNING[26566]: app_playback.c:475 playback_exec: ast_streamfile failed on SIP/phone1-00000000 for msg0000
— Auto fallthrough, channel ‘SIP/phone1-00000000′ status is ‘UNKNOWN’
[Dec 24 15:14:10] DEBUG[26566]: channel.c:2679 ast_softhangup_nolock: Soft-Hanging up channel ‘SIP/phone1-00000000′
Why does asterisk start playing the file in slin format.
I would be thankful if someone can guide me to the steps for playing the wav file in asterisk.
Regards,
Shalu
Israel Gottlieb said:
Dec 26, 11 at 8:13 amthat might be but if you take a pcm “ulaw” encoded file and name it “.wav”
asterisk will throw that error
I think asterisk should get smarter and read the header to get the format
or whatever else is needed and not only the extension of the filename
amit anand said:
Dec 26, 11 at 8:05 amHi
File format is incorrect. First correct the format to 8000Hz, 16 bit mono
PCM uncompressed. you can use wav pad sound editor to do the conversion.
Steve Edwards said:
Dec 26, 11 at 3:03 amVery bad advice.
Tzafrir Cohen said:
Dec 26, 11 at 5:52 amAsterisk prefers the payload to be signed-linear rather than mu-law.
This message is, indeed, misleading.
But this one is correct.
I wonder if something along the lines of:
sox orig.wav new.wav -s
would do.
Anonymous said:
Dec 26, 11 at 2:32 amRename the wav to ulaw
Miss_audio.ulaw