am 5cab38ba
: Merge "SIP: minor fixes." into gingerbread
Merge commit '5cab38ba11d976c54f28f4bdbced78040cba1cbb' into gingerbread-plus-aosp * commit '5cab38ba11d976c54f28f4bdbced78040cba1cbb': SIP: minor fixes.
This commit is contained in:
@ -23,6 +23,7 @@ import android.os.IBinder;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
@ -83,6 +84,8 @@ public class SipManager {
|
|||||||
/** Part of the incoming call intent. */
|
/** Part of the incoming call intent. */
|
||||||
public static final String EXTRA_OFFER_SD = "android:sipOfferSD";
|
public static final String EXTRA_OFFER_SD = "android:sipOfferSD";
|
||||||
|
|
||||||
|
private static final String TAG = "SipManager";
|
||||||
|
|
||||||
private ISipService mSipService;
|
private ISipService mSipService;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
@ -525,8 +528,10 @@ public class SipManager {
|
|||||||
return ((session == null)
|
return ((session == null)
|
||||||
? mUri
|
? mUri
|
||||||
: session.getLocalProfile().getUriString());
|
: session.getLocalProfile().getUriString());
|
||||||
} catch (RemoteException e) {
|
} catch (Throwable e) {
|
||||||
throw new RuntimeException(e);
|
// SipService died? SIP stack died?
|
||||||
|
Log.w(TAG, "getUri(): " + e);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ import javax.sip.DialogTerminatedEvent;
|
|||||||
import javax.sip.IOExceptionEvent;
|
import javax.sip.IOExceptionEvent;
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.ListeningPoint;
|
import javax.sip.ListeningPoint;
|
||||||
|
import javax.sip.ObjectInUseException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
import javax.sip.ResponseEvent;
|
import javax.sip.ResponseEvent;
|
||||||
import javax.sip.ServerTransaction;
|
import javax.sip.ServerTransaction;
|
||||||
@ -415,11 +416,25 @@ class SipSessionGroup implements SipListener {
|
|||||||
mPeerProfile = null;
|
mPeerProfile = null;
|
||||||
mState = SipSession.State.READY_TO_CALL;
|
mState = SipSession.State.READY_TO_CALL;
|
||||||
mInviteReceived = null;
|
mInviteReceived = null;
|
||||||
mDialog = null;
|
|
||||||
mServerTransaction = null;
|
|
||||||
mClientTransaction = null;
|
|
||||||
mPeerSessionDescription = null;
|
mPeerSessionDescription = null;
|
||||||
|
|
||||||
|
if (mDialog != null) mDialog.delete();
|
||||||
|
mDialog = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (mServerTransaction != null) mServerTransaction.terminate();
|
||||||
|
} catch (ObjectInUseException e) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
mServerTransaction = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (mClientTransaction != null) mClientTransaction.terminate();
|
||||||
|
} catch (ObjectInUseException e) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
mClientTransaction = null;
|
||||||
|
|
||||||
cancelSessionTimer();
|
cancelSessionTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,8 +899,8 @@ class SipSessionGroup implements SipListener {
|
|||||||
generateTag());
|
generateTag());
|
||||||
mDialog = mClientTransaction.getDialog();
|
mDialog = mClientTransaction.getDialog();
|
||||||
addSipSession(this);
|
addSipSession(this);
|
||||||
mProxy.onCalling(this);
|
|
||||||
startSessionTimer(cmd.getTimeout());
|
startSessionTimer(cmd.getTimeout());
|
||||||
|
mProxy.onCalling(this);
|
||||||
return true;
|
return true;
|
||||||
} else if (evt instanceof RegisterCommand) {
|
} else if (evt instanceof RegisterCommand) {
|
||||||
mState = SipSession.State.REGISTERING;
|
mState = SipSession.State.REGISTERING;
|
||||||
@ -964,8 +979,8 @@ class SipSessionGroup implements SipListener {
|
|||||||
// ring back for better UX
|
// ring back for better UX
|
||||||
if (mState == SipSession.State.OUTGOING_CALL) {
|
if (mState == SipSession.State.OUTGOING_CALL) {
|
||||||
mState = SipSession.State.OUTGOING_CALL_RING_BACK;
|
mState = SipSession.State.OUTGOING_CALL_RING_BACK;
|
||||||
mProxy.onRingingBack(this);
|
|
||||||
cancelSessionTimer();
|
cancelSessionTimer();
|
||||||
|
mProxy.onRingingBack(this);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Response.OK:
|
case Response.OK:
|
||||||
@ -1222,14 +1237,12 @@ class SipSessionGroup implements SipListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onRegistrationFailed(Throwable exception) {
|
private void onRegistrationFailed(Throwable exception) {
|
||||||
reset();
|
|
||||||
exception = getRootCause(exception);
|
exception = getRootCause(exception);
|
||||||
onRegistrationFailed(getErrorCode(exception),
|
onRegistrationFailed(getErrorCode(exception),
|
||||||
exception.toString());
|
exception.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRegistrationFailed(Response response) {
|
private void onRegistrationFailed(Response response) {
|
||||||
reset();
|
|
||||||
int statusCode = response.getStatusCode();
|
int statusCode = response.getStatusCode();
|
||||||
onRegistrationFailed(getErrorCode(statusCode),
|
onRegistrationFailed(getErrorCode(statusCode),
|
||||||
createErrorMessage(response));
|
createErrorMessage(response));
|
||||||
|
Reference in New Issue
Block a user