In which Android versions? Cyanogenmod supports this functionality, but most stock builds don't, up through the most recent Kitkat releases.
(The first shipped Kitkat builds supported a form of this, but it was quickly removed, amidst complaints from privacy advocates:
https://www.eff.org/deeplinks/2013/12/google-removes-vital-p...
So, there are a few shipped phones which can have this functionality made accessible via third party app --- but update your phone and they cease to work.)