iPhone Thinks Headphones are Plugged In

Apparently there are scenarios where the Apple iPhone thinks that the headphones are plugged in.  For example here.

The solution is, as mentioned in many places, to repeatedly plug in and remove the jack.  This will convince the phone that the headphones are not plugged in.  Be sure to have the iPod playing something so you can hear when the phone resets itself.

It would be nice if Apple would determine what the source of the problem is and issue a patch that resolves it.