Sometimes you can get some grit stuck in the microswitch...
Push in and pull out the plug several times to see if that clears it.
Next trick would be to blow some compressed air (low pressure, not garage).
Failing that, take it to a phone repair place where the tech can disassemble it and check /repair/"replace switch.