How to Play an Audio File on a Voice Call in Android

Why it is not possible to play an audio file on a voice call in android

After a thorough research, what I have come to know is that there are more than one limitations/hurdles to make it possible. These limitations/hurdles are at three different levels.

First limitation is at API level, because there is no high-level API to play sound files in the conversation audio during a call as mentioned in Android official documentation.

Second limitation is at Radio Interface Layer (RIL). RIL passes on complete control of the call to Radio Daemon (rild) of the Linux library which then further passes the control to the vendor RIL. That means we cannot manipulate voice call in android source code.

Even if we are able to remove these two limitations, we may still not be able to play audio file to an ongoing voice call. Because there is a third limitation. Every vendor has their own library of RIL that communicates with Radio Daemon (rild). This requires that vendor RIL to be open source which is not actually. Hardware vendors do not usually make their device drivers code available.

Detail discussion on this topic is present at this link.

How to play audio file when call starts?

I have found a workaround with this. I play an audio file on device's speakers with full sound when the phone state changes to TelephonyManager.CALL_STATE_OFFHOOK

This ensures that the user on the other side can hear the recording.



Related Topics



Leave a reply



Submit