Recovery of phosphorus from chemical sludge