问题
I am planning on developing my specific voip app for android.
Here's the scenario: when a phone call occurs I want to hear the person who's calling on my local pc speakers and I want to speak to him via my own pc microphone / headset. So I need to send the audio stream of both me and the person I am talking to via the wlan network.
Something like this:
...
onCallStateChanged(int state, String phoneNumber){
while(state == PhoneListener.CALL_STATE_OFFHOOK){ //while phone call is happening
//send incoming speech via wlan to pc
//receive audiostream from pc microphone and direct it to the phone call
}
}
...
Is this possible with the current Android API? (Actually it should be since voip apps are available in the market) I did some research in the Android API and all I found was the AudioManager which has constant named
public static final int STREAM_VOICE_CALL; //The audio stream for phone calls
But I don't know how to use it our how it should give me access to the actual audiostreams which I can send via network. How do I manage to do this?
The connection would be realised by TCP sockets.
回答1:
Here's the scenario: when a phone call occurs I want to hear the person who's calling on my local pc speakers and I want to speak to him via my own pc microphone / headset. So I need to send the audio stream of both me and the person I am talking to via the wlan network.
What is the point of having Android in the mix? If you have a local PC, and you want to use the local PC for audio in/out, use a VOIP app on the local PC.
Something like this: onCallStateChanged()...
That is for voice calls using the built-in telephony subsystem (3G, CDMA, etc.). This has nothing to do with VOIP.
Is this possible with the current Android API?
It depends on what "this" is. If "this" is "intercept the incoming 3G phone call and have the audio for the call be handled by Android code", then no, it is not possible.
来源:https://stackoverflow.com/questions/2492457/android-phone-call-audio-stream-via-wlan