We consider a solution u(p, g, a, b) to an initial value–boundary value problem for a wave equation: and we discuss an inverse problem of determining a coefficient p(x) and a, b by observations of u(p, g, a, b)(x, t) in a neighbourhood ω of ∂Ω over a time interval (0, T) and ∂itu(p, g, a, b)(x, T0), x ∊ Ω, i = 0, 1, with T0 < T. We prove that if T − T0 and T0 are larger than the diameter of Ω, then we can choose a finite number of Dirichlet boundary inputs g1, …, gN, so that the mapping is uniformly Lipschitz continuous with suitable Sobolev norms provided that {p, aj, bj}1 ⩽ j ⩽ N remains in some bounded set in a suitable Sobolev space. In our inverse problem, initial values are also unknown, and we do not assume any positivity of the initial values. Our key is a Carleman estimate and the exact controllability in a Sobolev space of higher order.