37

I am developing an android application that must play an audio file during a call and the other party should hear it.

Is there any way to do this in android? I searched for it by last 2 months, but no idea. If any of you crossed the same problem, please share your ideas with me.

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
Srinivas
  • 1,405
  • 2
  • 13
  • 15
  • please read this: http://stackoverflow.com/questions/1977777/android-voice-call-logging and http://stackoverflow.com/questions/5202277/android-audio-and-voice-processing – Horrorgoogle Jan 09 '12 at 05:39
  • 3
    thanx for ur reply, but i havent asked anything about new call events, i want to play an audio file in an existing call , is it possible? – Srinivas Jan 09 '12 at 06:09
  • 21
    This got closed as "too broad". What is too broad about this question? I find it to the point and quite specific. – Peter V. Mørch May 17 '17 at 15:20
  • 2
    The close reason is false. I just searched for this exact point and Google returned as #1 result. Would I be the only one who believes that because it is not possible today, that it very well could be possible tomorrow? – qxotk Jun 04 '17 at 20:03
  • 1
    the close reason is false, however, if nothing changes today in 2018, it shall be remain closed. – nimbus_debug Nov 21 '18 at 07:03
  • From what I've read so far, some Pixel phone(s?) can do that in their Dialer. See this (the most complete research I've found so far): https://forum.xda-developers.com/android/software-hacking/dev-porting-call-audio-injection-t4036995. Maybe this could become possible, because Google Dialer seems to be the start point, as "Google's Call Screening feature can 'talk' to someone calling your phone". Though, may not be the only place to look at. This could be malicious too, so I'll just wait and see if it gets done or not (if I a ROM coder doesn't know how to continue the research, I won't haha). – Edw590 Nov 09 '20 at 04:19
  • Google Assistant could be another place to go search for information, from what Google says (https://support.google.com/phoneapp/answer/9118387): "Your Google Assistant screens the call and ask who's calling and why. You'll get a real-time transcript of how the caller responds.". – Edw590 Nov 09 '20 at 04:34
  • And yet another idea, sending DTMF tones over the call? (As key presses are sent, it seems). If it's audio that's being injected, any Dialer can do that already. I wrote what I found out about that in the XDA thread. Not much, but maybe might help people to continue the research? When I can I'll try my luck on Google searching on how to send DTMF tones over a call. I've only tried the "audio" word, not DTMF. If that's audio, might help, I'd say. And even if only a frequency could be injected, it's better than nothing, I guess (some frequency = beep = very cool already haha). – Edw590 Nov 09 '20 at 05:04
  • https://stackoverflow.com/questions/34763971/how-to-send-dtmf-tone-programmatically-during-a-live-call-in-android - "But what you can't do for sure is to play tones over a call made from other app.". That might give a hint... Make an app that answers the phone itself instead of asking Phone app to do it? Then we could send stuff over the call. We'll be sending our voice, as a start. That will require infinite research haha. Hope there's some other way. – Edw590 Nov 09 '20 at 05:20

4 Answers4

35

While this is a old post, thought would share the experience i have so far with trying this..

In the simplest sense, no.. you can not But there are "some" exceptions here, but if your looking to build an application for the public.. This is not for you... its device specific...

WHY WE CANT PLAY AUDIO DURING A CALL

The simple fact is the microphone / input audio stream during a phone call is not able to be pre-processed or replaced with another stream of any form.

So simply while one would think its easy to use media during a call, it simply is not possible due to the way the android system processes the audio.

SO WHAT ARE THE WAYS PEOPLE HAVE DONE IT??

Well lets start simple... They have not, they have managed to hack or use a exploit to do so or some device specific programming to do this.. ONE CODE WILL NOT FIT ALL HERE

As far as i have been able to see and research on this topic, there are means by using adb or messing with codecs and the kernel.. But simply i have not looked to far into this as i am ideally seeking a solution that works on all devices and is only restrictive by the API being used.

WHY DID ANDROID/GOOGLE/HARDWARE DO THIS TO US???

Well your guess is as good as mine, but one would think its to do with the way this can be exploited.. Having a application to mask your voice, a rouge application that answers calls for you and so on.. Simply i myself can see plenty of good reasons why to not allow it, but really wish it was allowed/possible because with any technology people will be screwed over with anyway.

ALTERNATIVE METHODS FOR THIS????

Well this is the tricky question, simply there is no true alternative if your core requirement is to play an audio stream on a live call to the other party from your phone... Some people revert to using VoIP for redirecting and handling this or other logic methods..

APPLICATIONS WHO CLAIM TO DO THIS!?!?!

Firstly, download one and test it with two phones.... Does the sound truely get streamed along with your normal audio to them or does it just appear faint/broken up or not just there at all.

The only true known method that works on all android devices, is using the loud speaker.. Which also makes me wonder why Elias was down voted for this as technically its the only answer that is a valid way of doing this instead of people simply saying "No, Its Not Possible"..

The only applications to truly have this working in any way, are the ones who are targeted for set devices.. They will not work with a no-name brand or in general with all android devices. Read the reviews and find out for yourself

SO WHAT DO WE DO IN THE MEAN TIME ............... wish that it was possible ............

Angry 84
  • 2,935
  • 1
  • 25
  • 24
  • any example how do it with adb, for example my phone connected to windows or linux pc with usb and I want to send music or speech. is it possible with adb? – user924 May 25 '18 at 11:07
  • I wanted to write an app to send a fax directly from the phone itself no additional resources needed.. guess that's not possible. thanks android! – Dan Jun 01 '18 at 16:14
  • What about root access? – beppe9000 Jun 25 '19 at 11:44
  • I so not believe root access will change this, you would have to modify a distro of android and use that. Root access only allows admin rights as such, but the core still has this safety in place. – Angry 84 Jun 30 '19 at 02:43
23

Note: You can play back the audio data only to the standard output device. Currently, that is the mobile device speaker or a Bluetooth headset. You cannot play sound files in the conversation audio during a call.

from the official docs.

John Riselvato
  • 12,854
  • 5
  • 62
  • 89
18

You can play audio to speaker during the call. Then the microphone will get the audio. Apparently, you can't play music while the phone is turned on.

If you're near a PC, however, you can run a wire from the PC sound card to the microphone jack. I haven't tried it yet, but don't see why it wouldn't work.

Charles D Pantoga
  • 4,307
  • 1
  • 15
  • 14
Elias
  • 317
  • 2
  • 3
  • 5
    I have up voted this due to this being actually technically correct, While there is no software way.. THIS IS THE ONLY TRUE KNOWN way... Please read my answer if you disagree and prove otherwise. – Angry 84 Feb 11 '15 at 07:40
  • 2
    can you provide an example please? – Silvia H Apr 04 '15 at 21:33
  • 1
    If seeking an example of a wired audio solution from another audio source, perhaps the electrical engineering SE could have something. – qxotk Jun 04 '17 at 20:05
7

As far as I recall this has been discussed on the Android SDK mailing list - and the answer is:

No - there is no way to play a sound file to the other party while placing a call.

Michael Banzon
  • 4,879
  • 1
  • 26
  • 28