Reputation: 31
I'm developing a SIP client app using Android 2.3+ API, I can make a outgoing call and receive a incoming call successfully by using SipDemo sample codes. but I can't hear any thing before peer answers the call.
What steps will reproduce the problem?
I expect for ring-back tone, in step: 3 instead silence. Can i do something in onRingBack for hear sip ring-back tone instead of silence.
Upvotes: 3
Views: 1858
Reputation: 26
Try this in your onReceive()
mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setDataSource(context, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE));
mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING);
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IllegalArgumentException e1) {
e1.printStackTrace();
} catch (SecurityException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
Thats supposed to start the ringtone. Don't for get to put mediaPlayer.stop(); somewhere in your code. onCallEstablished is where i put mine
Upvotes: 1