Sometimes iPhone gets stuck in Headphones mode preventing you from hearing the sound. The problem is that iPhone mistakenly acts as if headphones are plugged in.
Unplug your Headphones
If you see the icon below when you adjust the volume buttons, there may be debris in the headset port. To remove, unplug then re-plug headphones several times (at least 7-8 times).
Some users have reported that they fixed this problem succesfully by using a hair dryer or sucking (hard) on the headphone port. You may also want to use a toothpick and clean the port to remove any remaining dirt / particles.
Blow into the headphone jack
Before you actually use a compressed air machine to blow it into your iPhone’s headphone jack, get out a flashlgith and see if there is anything stuck inside. If something is noticeable, take it out. Now, carefully and gently blow air right into the headphone’s jack. That should remove any small particles.
Reset your iPhone
Some users found it helpful to turn off their iOS device and then turn it back On. If those solutions doesn’t work out for you, this method might actually help. Give it a try and let us know what’s going on. If you are still having this problem, contact Apple support.