Using femtosecond laser machining, we fabricated a terahertz resonant cavity in LiNbO3. Optical pulse sequences with variable repetition rates, generated through a novel pulse-shaping method, are used for characterization of the cavity resonances and for amplification of terahertz phonon-polaritons in the cavity.