How to convert audio for Asterisk .wav format

In our example we take "sound.mp3" and convert it to .wav.

Generally Asterisk for its wave needs one audio channel (-ac 1) / mono and 8000hz (-ar 8000) instead of the standard CD/MP3 of 44100hz.

Here is the command to convert into Asterisk .wav format:

 ffmpeg -i sound.mp3 -ac 1 -ar 8000 sound.wav

Errors Asterisk may give you if the format is wrong:

    -- Executing [91781891@cme:3] Playback("SIP/234-00000008", "/var/lib/asterisk/sounds/sound") in new stack
[Sep 26 15:45:32] WARNING[4400][C-00000009]: format_wav.c:111 check_header_fmt: Unexpected frequency mismatch 44100 (expecting 8000)
[Sep 26 15:45:32] WARNING[4400][C-00000009]: file.c:510 fn_wrapper: Unable to open format wav
[Sep 26 15:45:32] WARNING[4400][C-00000009]: file.c:1303 ast_streamfile: Unable to open /var/lib/asterisk/sounds/sound (format (ulaw)): No such file or directory
[Sep 26 15:45:32] WARNING[4400][C-00000009]: app_playback.c:513 playback_exec: Playback failed on SIP/234-00000008 for /var/lib/asterisk/sounds/sound
 

    -- Executing [9132131@cme:3] Playback("SIP/234-00000006", "/var/lib/asterisk/sounds/sound") in new stack
[Sep 26 15:44:18] WARNING[4384][C-00000007]: format_wav.c:102 check_header_fmt: Not in mono 2
[Sep 26 15:44:18] WARNING[4384][C-00000007]: file.c:510 fn_wrapper: Unable to open format wav
[Sep 26 15:44:18] WARNING[4384][C-00000007]: file.c:1303 ast_streamfile: Unable to open /var/lib/asterisk/sounds/sound (format (ulaw)): No such file or directory
[Sep 26 15:44:18] WARNING[4384][C-00000007]: app_playback.c:513 playback_exec: Playback failed on SIP/234-00000006 for /var/lib/asterisk/sounds/sound
 


Tags:

convert, audio, asterisk, wav, formatin, quot, mp, generally, ac, mono, hz, ar, format, ffmpeg, errors, executing, cme, playback, sip, var, lib, stack, sep, format_wav, check_header_fmt, frequency, mismatch, fn_wrapper, unable, ast_streamfile, ulaw, directory, app_playback, playback_exec,

Latest Articles

  • How to combine .txt ACLs without breaking things
  • How to ping all of Googlebot's IPs script
  • 'virtio0' uses a qcow2 feature which is not supported by this qemu version: QCOW version 3
  • Linux bash script to get the IP of a list of hostnames
  • How To Use Camera Webcam in Docker for OBS Studio etc...
  • Computer Server Won't Post Boot Or Enter BIOS Setup After Installing RAID SAS or GPU Card etc..
  • How To Test PHP Scripts from CLI with GET variables/query string
  • apt-cache how to see all available versions of a package in Debian Ubuntu Mint
  • Virtualbox VBox Guest-utils drag and drop files stops working with Windows VMs
  • How To Remove Ubuntu Netplan and Go Back to /etc/network/interfaces
  • How To Force Flash an AMD Instinct GPU To Another Model Using Debian Ubuntu Mint Linux
  • How To compile ollama from source to use unsupported AMD GPU with rocm in Ubuntu Debian
  • QEMU KVM Virtio GPU Windows Cannot Select 1080P
  • Linux Gnome Desktop Ubuntu Mint Debian Gets Slower After Weeks
  • Firefox How to Save Full Page As Screenshot/PDF
  • Nvidia Datacenter Driver Tesla Slow nvidia-smi response and high utilization with 0 usage
  • ffmpeg how to normalize / increase the volume of your audio
  • kdenlive audio blips pops cracks artifacts solution fix
  • haproxy / nginx certbot SSL issues
  • nginx how to see the real IP when behind a CDN