Through the headphones or the speakerphone or both? Make sure the mute switch isn't on. Try a hard reset. Press home and power buttons at the same time. Ignore the slide to power off and let go when you see the Apple logo. No data, media or settings will be lost. It's just a longer reboot. Also, try plugging the headphones in and taking them out a couple times if the audio problem occurs only when using headphones.
What he said. Had this happen on my 4 where when I tried turning volume up or down it said "headphones" but no headphones were in the phone. Used a cotton less q tip and cleaned out the headphone jack and got my sound back..phone was splashed with water and I think whatever dust was in there cause it to think headphones were in causing no sound