Spectroscopic constraints on the properties of dust in active galactic nuclei