Tripoth,
It depends on the Headset that you get on how you have to operate it so there is no one straight answer. We only deal with Plantronics headsets, but I am sure you can find less expensive equipment out there.
The Headset enable code [315] signals the system that a headset has been connected to the phone. The Headset disable code [316] returns the phone to normal operation. The on/off feature code [317] can be used to toggle the feature on or off.
So, with the headset mode turned on the phone [317] or [315] then use the headset port on the back of the phone to plug your headset device into. IF your headset device is setup to answer through it then it will work as expected; if it doesn't then you may have to change your setup.
Thanks,
TE