Transmission and reflection of electromagnetic waves by an obstacle inside a waveguide