Sorry - It's a bit vague now as it's been so long since I did this. To my best recollection u-law encoding didn't work in sipp so I encoded the file as a-law using this script I built. I noted there were some nuances to the conversion using sox. In my opinion you either have a mismatched SDP, or are incorrectly encoding the file, make sure you only use one channel. Try the methods and code I posted below.
The file header should read
File Size: 54.7k Bit Rate: 64.1k
Encoding: A-law
Channels: 1 @ 13-bit
Samplerate: 8000Hz
Replaygain: off
Duration: 00:00:06.83
or
File Size: 54.7k Bit Rate: 64.1k
Encoding: u-law
Channels: 1 @ 14-bit
Samplerate: 8000Hz
Replaygain: off
Duration: 00:00:06.83
./wav_to_gsm.sh sorry_dave.wav sorry_dave_alaw.wav sox alaw
#!/bin/bash
if [ -z "$4" ];then
echo "usage: $0 [input.wav] [output.gsm] [sox|gst] [alaw|ulaw]"
exit
fi
IN=$1
OUT=$2
TOOL=$3
ENC=$4
function conv1()
{
if [ $ENC == "alaw" ];then
sox $IN -r 8000 -c 1 -e a-law $OUT resample -ql
else
sox $IN -r 8000 -c 1 -e u-law $OUT resample -ql #default
fi
#notes:
#the output file extension (wav or gsm) will change how sox performs the encoding
#use .wav for sipp RTP
Encoding: u-law Encoding: A-law
Channels: 1 @ 14-bit Channels: 1 @ 13-bit
#use .gsm for asterisk music on hold
Encoding: GSM
Channels: 1 @ 16-bit
}
function conv2()
{
if [ $ENC == "alaw" ];then
gst-launch filesrc location=$IN \
! wavparse \
! audioconvert \
! audioresample \
! alawenc \
! audio/x-alaw, rate=8000, channels=1 \
! wavenc \
! filesink location=$OUT
else
gst-launch filesrc location=$IN \
! wavparse \
! audioconvert \
! audioresample \
! mulawenc \
! audio/x-mulaw, rate=8000, channels=1 \
! wavenc \
! filesink location=$OUT
fi
# notes:
# file output extension of wav and gsm are interchangeable in the converted format
}
if [ $3 == "gst" ];then
conv2
else
conv1
fi