I can answer calls up to API Lollipop using this code. For Marshmallow, I just add a permission request for the user then the same code works as well.
However, starting API 24 it doesn't work!
How can I answer a call starting API 24 and above?