  We consider four classes of classical groups over a non-archimedean local
field F: symplectic, (special) orthogonal, general (s)pin and unitary. These
groups need not be quasi-split over F. The main goal of the paper is to obtain
a local Langlands correspondence for any group G of this kind, via Hecke
algebras.
  To each Bernstein block Rep(G)^s in the category of smooth complex
G-representations, an (extended) affine Hecke algebra H(s) can be associated
with the method of Heiermann. On the other hand, to each Bernstein component
$\Phi_e (G)^{s^\vee}$ of the space \Phi_e (G) of enhanced L-parameters for G,
one can also associate an (extended) affine Hecke algebra, say $H (s^\vee)$.
For the supercuspidal representations underlying Rep(G)^s, a local Langlands
correspondence is available via endoscopy, due to Moeglin and Arthur. Using
that we assign to each Rep(G)^s a unique $\Phi_e (G)^{s^\vee}$.
  Our main new result is an algebra isomorphism $H(s)^{op} \to H (s^\vee)$,
canonical up to inner automorphisms. In combination with earlier work, that
provides an injective local Langlands correspondence Irr(G) -> \Phi_e (G) which
satisfies Borel's desiderata. This parametrization map is probably surjective
as well, but we could not show that in all cases.
  Our framework is suitable to (re)prove many results about smooth
G-representations (not necessarily reducible), and to relate them to the
geometry of a space of L-parameters. In particular our Langlands
parametrization yields an independent way to classify discrete series
G-representations in terms of Jordan blocks and supercuspidal representations
of Levi subgroups. We show that it coincides with the classification of the
discrete series obtained twenty years ago by Moeglin and Tadi\'c.
