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.
How to fix
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.
If the above does not work
Reset your iPhone by pressing down the sleep and home buttons until you see the Apple logo.