A portable electronic device having a connection for a plurality of audio accessories, comprising: a jack being sized for receiving a plug of an audio accessory of the plurality of audio accessories; a processor adapted to perform a first impedance test after insertion of the plug into the jack; electrical connectors (72, 74, 76, 78) provided in the jack for enabling communication between the audio accessory and the processor, each of the electrical connectors (72, 74, 76, 78) for contacting a corresponding electrical connector (58, 60, 62, 64) of the plug; and a switching circuit in communication with the processor and two of the electrical connectors (72, 74, 76, 78), the switching circuit for selectively routing audio signals between the corresponding electrical connectors (58, 60, 62, 64) of the plug and the processor, wherein the first impedance test determines whether a first corresponding connector of the corresponding electrical connectors (58, 60, 62, 64) is electrically grounded, and when the first impedance test determines that the first corresponding connector is electrically grounded, a switch of the switching circuit is adapted to route the audio signals between a second corresponding connector of the corresponding electrical connectors (58, 60, 62, 64) of the plug and the processor, and to be set to a position in which a first electrical connector of the electrical connectors (72, 74, 76, 78) is in communication with the second corresponding electrical connector; and the processor performs a test to determine if the second corresponding electrical connector is electrically grounded; determines that the audio accessory is a headset when the second corresponding electrical connector is not electrically grounded; and determines that the audio accessory is a set of headphones when the second corresponding electrical connector is electrically grounded. a jack being sized for receiving a plug of an audio accessory of the plurality of audio accessories; a processor adapted to perform a first impedance test after insertion of the plug into the jack; electrical connectors (72, 74, 76, 78) provided in the jack for enabling communication between the audio accessory and the processor, each of the electrical connectors (72, 74, 76, 78) for contacting a corresponding electrical connector (58, 60, 62, 64) of the plug; and a switching circuit in communication with the processor and two of the electrical connectors (72, 74, 76, 78), the switching circuit for selectively routing audio signals between the corresponding electrical connectors (58, 60, 62, 64) of the plug and the processor, wherein the first impedance test determines whether a first corresponding connector of the corresponding electrical connectors (58, 60, 62, 64) is electrically grounded, and when the first impedance test determines that the first corresponding connector is electrically grounded, a switch of the switching circuit is adapted to route the audio signals between a second corresponding connector of the corresponding electrical connectors (58, 60, 62, 64) of the plug and the processor, and to be set to a position in which a first electrical connector of the electrical connectors (72, 74, 76, 78) is in communication with the second corresponding electrical connector; and the processor performs a test to determine if the second corresponding electrical connector is electrically grounded; determines that the audio accessory is a headset when the second corresponding electrical connector is not electrically grounded; and determines that the audio accessory is a set of headphones when the second corresponding electrical connector is electrically grounded.