If the cavity is involving pulp(inner tissue) and if you have intolerable pain during night or pus discharge since a long time with on and off history, Radiological involvement of pulp then you are suffering with Chronic irreversible pulpitis which needs RCT . It is really imp which tooth is affected as treatment varies.
Next Steps
Please take a Intra oral Perapical Radiograph
Health Tips
Consult and Take prescription for temporary relief of pain if you are symptomatic. Lest all it may need is a filling.