From 2093561a58e602450f6e4f2aae4831edd1b840f4 Mon Sep 17 00:00:00 2001 From: repo sync Date: Tue, 28 Jun 2011 15:25:44 +0800 Subject: Support INVITE w/o SDP. bug:3326873 Change-Id: Ie29d2c61b237fee2d8637f4ba3d293a22469cced --- voip/java/android/net/sip/SipAudioCall.java | 3 +++ voip/java/com/android/server/sip/SipSessionGroup.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java index 2666b69..c1affa6 100644 --- a/voip/java/android/net/sip/SipAudioCall.java +++ b/voip/java/android/net/sip/SipAudioCall.java @@ -26,6 +26,7 @@ import android.net.sip.SimpleSessionDescription.Media; import android.net.wifi.WifiManager; import android.os.Message; import android.os.RemoteException; +import android.text.TextUtils; import android.util.Log; import java.io.IOException; @@ -400,6 +401,7 @@ public class SipAudioCall { @Override public void onRinging(SipSession session, SipProfile peerProfile, String sessionDescription) { + // this callback is triggered only for reinvite. synchronized (SipAudioCall.this) { if ((mSipSession == null) || !mInCall || !session.getCallId().equals( @@ -730,6 +732,7 @@ public class SipAudioCall { } private SimpleSessionDescription createAnswer(String offerSd) { + if (TextUtils.isEmpty(offerSd)) return createOffer(); SimpleSessionDescription offer = new SimpleSessionDescription(offerSd); SimpleSessionDescription answer = diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java index 6304369..c0c1b28 100644 --- a/voip/java/com/android/server/sip/SipSessionGroup.java +++ b/voip/java/com/android/server/sip/SipSessionGroup.java @@ -1007,7 +1007,13 @@ class SipSessionGroup implements SipListener { throws SipException { // expect ACK, CANCEL request if (isRequestEvent(Request.ACK, evt)) { - establishCall(false); + String sdp = extractContent(((RequestEvent) evt).getRequest()); + if (sdp != null) mPeerSessionDescription = sdp; + if (mPeerSessionDescription == null) { + onError(SipErrorCode.CLIENT_ERROR, "peer sdp is empty"); + } else { + establishCall(false); + } return true; } else if (isRequestEvent(Request.CANCEL, evt)) { // http://tools.ietf.org/html/rfc3261#section-9.2 -- cgit v1.1