We consider the solution of the Helmholtz equation −∆u(x)−n(x)^{2}ω^{2}u(x) = f(x), x = (x,y), in a domain Ω which is infinite in x and bounded in y. We assume that f(x) is supported in Ω^{0} := {x ∈ Ω |a^{−} < x < a^{+}} and that n(x) is x-periodic in Ω\Ω^{0}. We show how to obtain exact boundary conditions on the vertical segments, Γ^{−} := {x ∈ Ω |x = a^{−}} and Γ^{+} := {x ∈ Ω |x = a^{+}}, that will enable us to find the solution on Ω^{0} ∪Γ^{+} ∪Γ^{−}. Then the solution can be extended in Ω in a straightforward manner from the values on Γ^{−} and Γ^{+}. The exact boundary conditions as well as the extension operators are computed by solving local problems on a single periodicity cell.