I used Chatgpt to get a script to use lame to change the recording to MP3 and it worked for about a half dozen calls and thenit stopped working. I have the sh file in /usr/local/bin with asterisk as the owner (originally had root as owner) There is no error in any log that I can find. Call recording module is 15.0.7.29. Here is the script.
#!/bin/bash
# This script converts WAV recordings to MP3 and deletes the original WAV file
# Get the full path of the recording from FreePBX
REC_FILE=$1
# Check if the file exists
if [ -f "$REC_FILE" ]; then
# Extract the directory, filename, and extension
DIR=$(dirname "$REC_FILE")
BASE=$(basename "$REC_FILE" .wav)
# Convert to MP3 using lame
lame "$REC_FILE" "${DIR}/${BASE}.mp3"
# Check if the conversion was successful
if [ $? -eq 0 ]; then
# Remove the original WAV file
rm "$REC_FILE"
else
echo "Conversion failed for $REC_FILE" >> /var/log/convert_to_mp3.log
fi
else
echo "File $REC_FILE does not exist" >> /var/log/convert_to_mp3.log
fi
Could you change the script and check whether recording has completed before doing any conversion ?
Is the wav file more than xx minutes old ? If no, then leave it alone.
YMMV