Please verify the make and model number of the phone?
Do you hear audio in a set of earphones if you plug them into the phone?
If you do then it may be a problem with the earphone jack.
There is an internal contact in the earphone jack that is operated by the earphone plug when it is inserted. This signals the OS to switch the audio away from the phone’s ear receiver (or the loudspeaker if in hands free mode) and direct it to the earphone socket.
When the earphones are unplugged this contact should release.
Try gently inserting/removing the earphone plug a few times, gently wiggling it from side to side as you’re doing it, to see if doing this releases the contact. You will know if it does as the headphone icon on the screen will disappear.
if it doesn't then the earphone socket will have to be replaced.