Skip to content

ThatRex/asterisk-extensibles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asterisk Extensibles

Important

Basic terminal and PBX management skills are assumed.

Extensible apps for asterisk: Talk BotMusic Player

Conversion Script

This script will convert any MP3, WAV or FLAC files to Mono 8kHz PCM WAV files suitable for Asterisk. Converted files will be placed in a subdirectory named converted.

  1. Ensure FFmpeg is installed on your system.
  2. Open your terminal, then navigate to the directory containing the audio files to be converted.
  3. Copy and paste the appropriate script for your OS into your terminal.

Windows (PowerShell)

$output = "converted"
New-Item -Path $output -ItemType Directory -Force
Get-ChildItem | where {$_.extension -in ".mp3",".wav",".flac"} | ForEach-Object {
   $name = "$output/$($_.BaseName).wav"
   & ffmpeg -i $_.Name -ar 8000 -ac 1 -acodec pcm_s16le -f wav $name
}

Linux (Bash)

output="converted"
mkdir -p $output
for file in *.mp3 *.wav *.flac; do
  name="$output/${file%.${file##*.}}.wav"
  ffmpeg -i "$file" -ar 8000 -ac 1 -acodec pcm_s16le -f wav "$name";
done