Asymptotic stability of the Wonham filter: ergodic and nonergodic signals