I've read a number of fixes for this speaker/headphone issue this morning after my speaker just stopped working; no drop on the floor, no water, just stopped. Ailith, your solution worked straight away for me! Thank you so much.
To recap: I have an iPhone 4S about 10 months old.
1. Speaker wasn't playing sounds from messages, incoming calls etc etc.
2. Headphone socket worked fine and could hear music and sounds through headphones.
3. Volume buttons adjusted volume but automatically defaulted to Headphone Volume as though the phone thought it had headphones in...when it hadn't.
Solved by...
1. Rang voicemail and switched to speaker
2. I could hear the voicemail lady perfectly through the speaker...I thought this was strange.
3. Switched mute button TO mute.
4. Hung up.
5. Played some music and there it was...my speaker worked again.
6. Slid mute button back to UNMUTE and phone seems to be working perfectly.
I have to say...this is the inly problem I have ever encountered with any iPhone. Hopefully it will stay fixed!!
Thanks again, Ailith.