The Apple EarPods with Remote and Mic (iPhone 5 and later) and the Apple Earphones with Remote and Mic (iPhone 4s) feature a microphone, volume buttons, and the center button, which lets you answer and end calls or control audio and video playback, even when iPhone is locked.

Use the center button to control music playback.
Pause a song or video: Press the center button. Press again to resume playback.
Skip to the next song: Press the center button twice quickly.
Return to the previous song: Press the center button three times quickly.
Fast-forward: Press the center button twice quickly and hold.
Rewind: Press the center button three times quickly and hold.
Use the center button to answer or make phone calls.
Answer an incoming call: Press the center button.
End the current call: Press the center button.
Decline an incoming call: Press and hold the center button for about two seconds, then let go. Two low beeps confirm you declined the call.
Switch to an incoming or on-hold call, and put the current call on hold: Press the center button. Press again to switch back to the first call.
Switch to an incoming or on-hold call, and end the current call: Press and hold the center button for about two seconds, then let go. Two low beeps confirm you ended the first call.