Factorized scattering in the presence of reflecting boundaries