Inverse scattering in 1-D nonhomogeneous media and recovery of the wavespeed