My headphones began to go off (this was wildly infuriating!), I thought that the wire had simply exhausted its resource and wanted to re-solder it, but after testing working pair it became clear that the connector was the problem. A temporary solution was picking a match with a cotton swab dipped in alcohol, but this always gave an unpredictable result. Then the situation worsened and the phone began to think that the headphones were constantly connected, or even give out terrible noise instead of sound.
If there is no mechanical damage to the connector, they are dirty inside. All this inner space can be washed with a toothpick soaked in 647 solvent, and then all with the same toothpick with a wound cotton swab, it is moistened in wd40 and continue to wash it inside, changing the cotton swab. After 5-10 minutes of cleaning, something about 700 ohms appears on the two extreme contacts of the connector, which indicates the normal operation of the connector.
thetermpapers.org