Convert G.711a files to WAV or MP3

Christian Kruse,

G.711a files are audio files in the G.711 A-Law format. They are used in telephony, e.g. in H.323 streams as used by PBX systems like Asterisk or the innovaphone IP222.

Recently I needed to record phone calls on the innovaphone IP222. This is described in the innovaphone wiki, unfortunately it is not public accessible.
However, the files created are raw G.711 A-Law files and I needed to decode them to WAV (for permanent storage) and to MP3 (for delivering via HTTP). Since I could not find a solution on the internets I blog how to do it: you can achieve this easily with SOX:

sox -t al -r 8000 -b 8 -c 1 infile.G711a -t mp3 outfile.mp3 -t wav outfile.wav

This will create a correctly decoded WAV and MP3 file.