I have exactly the same issue on my 3GS : no sound at all. It happened suddenly, after connecting the 3GS on an audio device with a dock for iPhone. Now:
- No ring, no noise from keyboard, no voice during call, no music in iTunes, no sound from videos... and all this happens while listening from the internal speaker as well listening from the headphones. (it works with external bluetooth audio devices, however)
- The volume bar still appears when I use the sound buttons on the left side of the iPhone.
- The iPhone detects as expected the headphones when they are plugged in the jack port (I see this because the text is not the same on the volume notification when the headphones are plugged in). So, it's NOT because of a faulty jack.
- Regarding the dock connector, after cleaning it (it did NOTHING), I bought a new spare connector and replace the original one with the new part : the sound problem is STILL exactly the same as before. So it's NOT from a faulty dock connector not a faulty internal speaker (that piece in 3GS has dock connector+microphone+speaker, so they are all new).
- I reseted every data on the phone (General/reset...), I restored the device in iTunes... NOTHING worked.
- some people say the iPhone must be jailbroken, the "com.apple.iapd.plist" file must be deleted. But, in 2017, the jailbreaking tools for a 3GS with iOS 6.1.6 (Redsn0w and P0sixpwn) don't work anymore with recent Windows/MacOSX/iTunes versions ("exploit failed" and other errors are occurring). And, yes, I tried to jailbreak from 3 different Mac, from a PC, and even from a virtual Windows XP machine in Virtualbox with several old iTunes 10 or 11 versions.
So, who has a REAL solution to this issue, please?