That's Apple quality. If you look at how may faulty devices they make, I can't say that they are a cut above. That's why samsung has taken over Apple as the leader. You may want to try a samsung galaxy II. Anyway, to answer your question, you could try upgrading your phone to iOS 5 to fix the problem. Likely however, its a hardware issue, but it can be worked around by going into settings<sounds and then under the ring heading, slide the slider to the desired sound level. Hope this helps.
Hi Paul, I am experiencing the same problem. Not software hardware problem. The problem is that when you remove your headphone jack that it not disconnecting properly or something like that so that your phone is in limbo between speaker or headphone mode. To fix the problem insert and remove the headset jack several times and it should function properly. As it is a "headphone jack" problem it will not probably go away and you will find yourself wiggling your jack in and out to make it work. If you could be stuffed send it to apple to fix or you local phone repair shop.