You should have both devices on same laptop or at least being controlled from same code.
Set your command time out capability to 2 hours, p.e.:
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 7200);
And your sleep should not break.
In order to identify an incoming call, as far as I know you will have to look for some element on that screen, like the answer button (example button from a samsung, you will have to use native ids, so it differs from device to device):
do {
Thread.sleep(10000);
} while (driver.findElementsById("com.android.incallui:id/popup_call_answer").size()==0);
This is far from advisable. If same code controls both devices you know when device A starts the call and so you just order B to answer it.
Edit - You should have some counter inside that loop in order to break from there after a time to define, if not it can be trap in there forever if device A call never arrives.