Strange fix for my iPhone 4s. Volume control was not working. Music playback and apps had no sound and ringer was silent.
Tried restoring to latest firmware and still had the issue.
Finally tried this tip as someone else mentioned and phone ironically is issue free now. Basically lint/dirt get packed into the iPod cable port and the phone thinks its plugged into a device such as a docking station and turns the sound off to the phone.
IF YOU CAN'T HEAR MY VIDEO DO THE FOLLOWING:
1) Take a toothpic or a 1/2" strip of a business card like you see in my video
2) Swipe above and below the white contact terminal you see in the charging port to remove lint/dirt/buildup
3) Some people have reported having to do it several times for it to work or also a bit of rubbing alcohol.