diff options
Diffstat (limited to 'voip/java/android/net/sip/SipAudioCall.java')
-rw-r--r-- | voip/java/android/net/sip/SipAudioCall.java | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java index d859c4c..fbd3db8 100644 --- a/voip/java/android/net/sip/SipAudioCall.java +++ b/voip/java/android/net/sip/SipAudioCall.java @@ -18,10 +18,6 @@ package android.net.sip; import android.content.Context; import android.media.AudioManager; -import android.media.Ringtone; -import android.media.RingtoneManager; -import android.media.ToneGenerator; -import android.net.Uri; import android.net.rtp.AudioCodec; import android.net.rtp.AudioGroup; import android.net.rtp.AudioStream; @@ -30,8 +26,6 @@ import android.net.sip.SimpleSessionDescription.Media; import android.net.wifi.WifiManager; import android.os.Message; import android.os.RemoteException; -import android.os.Vibrator; -import android.provider.Settings; import android.util.Log; import java.io.IOException; @@ -175,11 +169,6 @@ public class SipAudioCall { private boolean mMuted = false; private boolean mHold = false; - private boolean mRingbackToneEnabled = true; - private boolean mRingtoneEnabled = true; - private Ringtone mRingtone; - private ToneGenerator mRingbackTone; - private SipProfile mPendingCallRequest; private WifiManager mWm; private WifiManager.WifiLock mWifiHighPerfLock; @@ -285,8 +274,6 @@ public class SipAudioCall { private synchronized void close(boolean closeRtp) { if (closeRtp) stopCall(RELEASE_SOCKET); - stopRingbackTone(); - stopRinging(); mInCall = false; mHold = false; @@ -366,7 +353,6 @@ public class SipAudioCall { @Override public void onRingingBack(SipSession session) { Log.d(TAG, "sip call ringing back: " + session); - if (!mInCall) startRingbackTone(); Listener listener = mListener; if (listener != null) { try { @@ -403,8 +389,6 @@ public class SipAudioCall { @Override public void onCallEstablished(SipSession session, String sessionDescription) { - stopRingbackTone(); - stopRinging(); mPeerSd = sessionDescription; Log.v(TAG, "onCallEstablished()" + mPeerSd); @@ -533,10 +517,6 @@ public class SipAudioCall { Log.v(TAG, "attachCall()" + mPeerSd); try { session.setListener(createListener()); - - if (getState() == SipSession.State.INCOMING_CALL) { - startRinging(); - } } catch (Throwable e) { Log.e(TAG, "attachCall()", e); throwSipException(e); @@ -580,7 +560,6 @@ public class SipAudioCall { */ public void endCall() throws SipException { synchronized (this) { - stopRinging(); stopCall(RELEASE_SOCKET); mInCall = false; @@ -625,7 +604,6 @@ public class SipAudioCall { */ public void answerCall(int timeout) throws SipException { synchronized (this) { - stopRinging(); try { mAudioStream = new AudioStream(InetAddress.getByName( getLocalIp())); @@ -1026,69 +1004,6 @@ public class SipAudioCall { return mSipSession.getLocalIp(); } - - /** - * Enables/disables the ring-back tone. - * - * @param enabled true to enable; false to disable - */ - public void setRingbackToneEnabled(boolean enabled) { - synchronized (this) { - mRingbackToneEnabled = enabled; - } - } - - /** - * Enables/disables the ring tone. - * - * @param enabled true to enable; false to disable - */ - public void setRingtoneEnabled(boolean enabled) { - synchronized (this) { - mRingtoneEnabled = enabled; - } - } - - private void startRingbackTone() { - if (!mRingbackToneEnabled) return; - if (mRingbackTone == null) { - // The volume relative to other sounds in the stream - int toneVolume = 80; - mRingbackTone = new ToneGenerator( - AudioManager.STREAM_VOICE_CALL, toneVolume); - } - mRingbackTone.startTone(ToneGenerator.TONE_CDMA_LOW_PBX_L); - } - - private void stopRingbackTone() { - if (mRingbackTone != null) { - mRingbackTone.stopTone(); - mRingbackTone.release(); - mRingbackTone = null; - } - } - - private void startRinging() { - if (!mRingtoneEnabled) return; - ((Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE)) - .vibrate(new long[] {0, 1000, 1000}, 1); - AudioManager am = (AudioManager) - mContext.getSystemService(Context.AUDIO_SERVICE); - if (am.getStreamVolume(AudioManager.STREAM_RING) > 0) { - String ringtoneUri = - Settings.System.DEFAULT_RINGTONE_URI.toString(); - mRingtone = RingtoneManager.getRingtone(mContext, - Uri.parse(ringtoneUri)); - mRingtone.play(); - } - } - - private void stopRinging() { - ((Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE)) - .cancel(); - if (mRingtone != null) mRingtone.stop(); - } - private void throwSipException(Throwable throwable) throws SipException { if (throwable instanceof SipException) { throw (SipException) throwable; |