it's a hardware issue you can read other users experiences with what may cure it here
iPhone stuck in "headphones" mode
if you feel confidant that you can show that the issue is because of a production issue rather then user handling you can at any time return it under normal warranty