Solutions are displayed which match your selected specification «HTC».
Make sure you selected all specifications which apply to you.
Clean the device's headphone port
If liquid or dust found their way to the device's headphone port, they will be deceiving your device that headphones are plugged in it, which would explain why it doesn't ring. If you see a headphones icon near the battery icon, you are definitely facing this issue, popularly known as "stuck into headphone mode".
In order to clean the device's headphone port you will need a cotton bud and an isopropyl alcohol (90-100%), due to its evaporating property. Put a small amount of the alcohol on the bud and then place and rotate the bud into the headphone port, gently.
Check the video below to see how to clean the headphone port:
If you have turned down the device's volume, your device won't ring. Press the volume (+) up button to turn up the volume and check if your device starts ringing, by calling it from another device, sending an SMS, etc.