Search code examples
androidphone-call

Is it possible to dial numbers programatically on the dialer while on an active call..?


I have been recently working on an app which requires to respond to an Automatic attendant (virtual receptionist) which allows callers to be automatically transferred to an extension without the intervention of an operator/receptionist.

My requirement is such that to make a scheduled phone call to a particular number and to respond to the Automatic attendant instructions ("for sales, press 1, for service, press 2," etc)

Is it possible to achieve similar action that i could otherwise achieve by responding to the system manually by pressing an option (say 1 or 2 from above example) programmatically while the call is still active.

Any help is appreciated.


Solution

  • There's no way to do this. There isn't an API, and since the dialer is not part of the OS and can be any app, you can't count on anything working on all devices.

    The best chance you have is to assume the dialer will accept USSD input (USSD is an ancient telephony protocol for sending data to phones). In the USSD language, a comma is a pause. SO if you want to dial a number, than 1 at the prompt you could ask it to dial "number,,,,1" and hope that the dialer accepts USSD input and that the pause is long enough to dial the 1 at the right time. But it will work on only a subset of all devices, and be fragile there.