Here is alot of info about asterisk file conversion.
http://www.voip-info.org/wiki/view/Asterisk+sound+files
And for sure you can use asterisk(if it compiled with mp3 support)
asterisk -rx "file convert filename.mp3 filename.gsm"
If you want convert using sox, you have recompile sox with libmad support. Here is script:
cd /usr/src/
wget -c "http://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0"
wget -c 'http://downloads.sourceforge.net/mad/libid3tag-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0'
wget -c "http://sourceforge.net/projects/sox/files/sox/14.3.2/sox-14.3.2.tar.gz/download"
wget -c http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget -c "http://downloads.sourceforge.net/mad/madplay-0.15.2b.tar.gz?modtime=1077580800&big_mirror=0"
CPU=4
for i in libid3tag libmad madplay lame sox
do
cd /usr/src/
tar -xzf $i-*.gz
cd /usr/src/$i*
./configure;
make -j $CPU
make install
done;
echo /usr/local/lib/ >>/etc/ld.so.conf
ldconfig
sox
ln -s /usr/local/bin/sox /usr/bin/sox