You'd have to know what system calls to use to get the lame encoder to work. For windows you'd just be using the CLI version of Lame and calling something like:
C:\Program Files\LAME\lame.exe -V 9 --mp3input C:\temp\uploaded.mp3 ./download/uploaded_dialup.mp3
So what that would do is use the VBR (variable bit-rate) setting of 9 which is the lowest quality. You'd also let it know that the input is an mp3 input, and then you give it the input file and the output file.
LAME Usage Documentation
That's where I figured out how to convert it. Now, on linux you'd do the same thing, just needing to know where the lame file is supposed to be. Same flags and all.
Hope that helps in some way.