Fermentation of sludge for phosphorus recovery