Sgavrosh
Sgavrosh

Reputation: 31

No ringback for outgoing calls sip

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?

  1. register to sip provider (mSipManager.open())
  2. place a call (mSipManager.makeAudioCall)
  3. silence (onRingBack method trigger in SipAudioCallListener)
  4. other side answer (onCallEstablished method trigger in SipAudioCallListener)
  5. both sides hear each other with good quality

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

Answers (1)

reggietheroman
reggietheroman

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

Related Questions