Discussion:
Programmatically play DTMF tones during a call
keithfry
2011-04-14 14:53:11 UTC
Permalink
I've read that it does not seem possible to play audio files while in
a phone call. However, I'd like to have an application play a DTMF
tone during a phone call. There shouldn't be any hw restriction on
this as the dial pad does this already when you press one of the
number keys. Instead I would like to have an application play this
tone automatically without requiring the user to touch the screen. An
example use case would be to recognize when the user has called their
voicemail number and automatically play the tones required to enter
their security code then begin listening to messages.

I've tried using the AudioManager.requestAudioFocus() to get access to
the voice call stream (AudioManager.STREAM_VOICE_CALL) but it always
returns REQUEST_FAILED. I can play the tone using ToneGenerator
without requesting audio focus, but it doesn't play over the voice
call just over the headset speaker.

Any suggestions?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Mark Murphy
2011-04-15 11:11:48 UTC
Permalink
Post by keithfry
I've read that it does not seem possible to play audio files while in
a phone call.
You can play audio files while in a phone call, but they only come out
the earpiece or speaker of the phone your app is running on. The only
way the other end might hear it is if you are in speakerphone mode,
and I don't know how murky that turns out.
Post by keithfry
I've tried using the AudioManager.requestAudioFocus() to get access to
the voice call stream (AudioManager.STREAM_VOICE_CALL) but it always
returns REQUEST_FAILED. I can play the tone using ToneGenerator
without requesting audio focus, but it doesn't play over the voice
call just over the headset speaker.
Any suggestions?
What you want is not supported, sorry.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
lbendlin
2011-04-15 13:40:22 UTC
Permalink
I think what is actually wanted is to inject the DTMF tones into the audio
input (microphone) rather than the output.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Keith Fry
2011-04-15 14:16:35 UTC
Permalink
Yes, I want it to play tones over the call not over the headset speaker.
I've been looking into what it takes to get access to the CallManager which
has a function for playing the DTMF tones during a call, but I have not been
able to get access to it using the ClassLoader. Apparently I haven't found
the secret sauce yet, even after looking at the discussion on stackoverflow:

http://stackoverflow.com/questions/4745899/how-to-access-com-android-internal-telephony-callmanager
Post by lbendlin
I think what is actually wanted is to inject the DTMF tones into the audio
input (microphone) rather than the output.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Mark Murphy
2011-04-15 14:28:56 UTC
Permalink
Post by Keith Fry
Yes, I want it to play tones over the call not over the headset speaker.
I've been looking into what it takes to get access to the CallManager which
has a function for playing the DTMF tones during a call, but I have not been
able to get access to it using the ClassLoader. Apparently I haven't found
http://stackoverflow.com/questions/4745899/how-to-access-com-android-internal-telephony-callmanager
Pretty much nothing in that SO post is a good idea. I humbly suggest
that you move on to other features or other apps.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Takeyuki UEDA
2011-04-16 11:05:45 UTC
Permalink
How about ToneGenerator?

http://developer.android.com/reference/android/media/ToneGenerator.html

- Takeyuki
Post by Mark Murphy
Post by Keith Fry
Yes, I want it to play tones over the call not over the headset speaker.
I've been looking into what it takes to get access to the CallManager which
has a function for playing the DTMF tones during a call, but I have not been
able to get access to it using the ClassLoader. Apparently I haven't found
http://stackoverflow.com/questions/4745899/how-to-access-com-android-internal-telephony-callmanager
Pretty much nothing in that SO post is a good idea. I humbly suggest
that you move on to other features or other apps.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Warescription: Three Android Books, Plus Updates, One Low Price!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
keithfry
2011-04-18 18:26:45 UTC
Permalink
Takeyuki - from documentation on ToneGenerator: "This API is not for
generating tones over the uplink audio path."

As such, it won't work for me. Thanks though.

Keith
Post by Takeyuki UEDA
How about ToneGenerator?
http://developer.android.com/reference/android/media/ToneGenerator.html
- Takeyuki
Post by Mark Murphy
Post by Keith Fry
Yes, I want it to play tones over the call not over the headset speaker.
I've been looking into what it takes to get access to the CallManager which
has a function for playing theDTMFtones during a call, but I have not been
able to get access to it using the ClassLoader. Apparently I haven't found
http://stackoverflow.com/questions/4745899/how-to-access-com-android-...
Pretty much nothing in that SO post is a good idea. I humbly suggest
that you move on to other features or other apps.
--
Mark Murphy (a Commons Guy)
http://commonsware.com|http://github.com/commonsguy
http://commonsware.com/blog|http://twitter.com/commonsguy
Warescription: Three Android Books, Plus Updates, One Low Price!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
lbendlin
2011-04-19 01:18:00 UTC
Permalink
yes, but what's the point in sending them downstream? Maybe the
documentation is wrong? You should at least give it a try.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Loading...