We propose and analyze a scheme for controlling coherent photon transmission and reflection in a cavity-quantum-electrodynamics (CQED) system consisting of an optical resonator coupled with three-level atoms coherently prepared by a control laser from free space. When the control laser is off and the cavity is excited by two identical light fields from two ends of the cavity, the two input light fields can be completely absorbed by the CQED system and the light energy is converted into the excitation of the polariton states, but no light can escape from the cavity. Two distinct cases of controlling the perfect photon absorption are analyzed: (a) when the control laser is tuned to the atomic resonance and creates electromagnetically induced transparency, the prefect photon absorption is suppressed and the input light fields are nearly completely transmitted through the cavity; (b) when the control laser is tuned to the polariton state resonance and inhibits the polariton state excitation, the perfect photon absorption is again suppressed and the input light fields are nearly completely reflected from the cavity. Thus, the CQED system can act as a perfect absorber or near perfect transmitter/reflector by simply turning off or on of the control laser. Such interference control of the coherent photon-atom interaction in the CQED system should be useful for a variety of applications in optical logical devices.