summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-09-23 11:35:05 +0800
committerHung-ying Tyan <tyanh@google.com>2010-09-28 01:52:42 +0800
commit025a39af346f39743c1e384b9000ce1baee36562 (patch)
tree159ecd150d8ff4343ffb079eb400728aaba67c9c /services
parent00a22064efef4f574e439079aae2deae1a087a31 (diff)
downloadframeworks_base-025a39af346f39743c1e384b9000ce1baee36562.zip
frameworks_base-025a39af346f39743c1e384b9000ce1baee36562.tar.gz
frameworks_base-025a39af346f39743c1e384b9000ce1baee36562.tar.bz2
SIP: misc fixes
+ check REQUEST_TERMINATED response on INVITE not CANCEL, + check if a TransactionTerminatedEvent matches the ongoing transaction, + add log to track SipConnection disconnect events. Change-Id: I28325be62ac44e4a7507d3c4b5b78b066c0ea2ad
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/sip/SipSessionGroup.java68
1 files changed, 43 insertions, 25 deletions
diff --git a/services/java/com/android/server/sip/SipSessionGroup.java b/services/java/com/android/server/sip/SipSessionGroup.java
index faa7a60..3282c7f 100644
--- a/services/java/com/android/server/sip/SipSessionGroup.java
+++ b/services/java/com/android/server/sip/SipSessionGroup.java
@@ -620,13 +620,15 @@ class SipSessionGroup implements SipListener {
Response.CALL_OR_TRANSACTION_DOES_NOT_EXIST);
return true;
} else if (evt instanceof TransactionTerminatedEvent) {
- if (evt instanceof TimeoutEvent) {
- processTimeout((TimeoutEvent) evt);
- } else {
- processTransactionTerminated(
- (TransactionTerminatedEvent) evt);
+ if (isCurrentTransaction((TransactionTerminatedEvent) evt)) {
+ if (evt instanceof TimeoutEvent) {
+ processTimeout((TimeoutEvent) evt);
+ } else {
+ processTransactionTerminated(
+ (TransactionTerminatedEvent) evt);
+ }
+ return true;
}
- return true;
} else if (isRequestEvent(Request.OPTIONS, evt)) {
mSipHelper.sendResponse((RequestEvent) evt, Response.OK);
return true;
@@ -646,6 +648,34 @@ class SipSessionGroup implements SipListener {
}
}
+ private boolean isCurrentTransaction(TransactionTerminatedEvent event) {
+ Transaction current = event.isServerTransaction()
+ ? mServerTransaction
+ : mClientTransaction;
+ Transaction target = event.isServerTransaction()
+ ? event.getServerTransaction()
+ : event.getClientTransaction();
+
+ if ((current != target) && (mState != SipSession.State.PINGING)) {
+ Log.d(TAG, "not the current transaction; current="
+ + toString(current) + ", target=" + toString(target));
+ return false;
+ } else if (current != null) {
+ Log.d(TAG, "transaction terminated: " + toString(current));
+ return true;
+ }
+ }
+
+ private String toString(Transaction transaction) {
+ if (transaction == null) return "null";
+ Request request = transaction.getRequest();
+ Dialog dialog = transaction.getDialog();
+ CSeqHeader cseq = (CSeqHeader) request.getHeader(CSeqHeader.NAME);
+ return String.format("req=%s,%s,s=%s,ds=%s,", request.getMethod(),
+ cseq.getSeqNumber(), transaction.getState(),
+ ((dialog == null) ? "-" : dialog.getState()));
+ }
+
private void processTransactionTerminated(
TransactionTerminatedEvent event) {
switch (mState) {
@@ -661,19 +691,7 @@ class SipSessionGroup implements SipListener {
}
private void processTimeout(TimeoutEvent event) {
- Log.d(TAG, "processing Timeout..." + event);
- Transaction current = event.isServerTransaction()
- ? mServerTransaction
- : mClientTransaction;
- Transaction target = event.isServerTransaction()
- ? event.getServerTransaction()
- : event.getClientTransaction();
-
- if ((current != target) && (mState != SipSession.State.PINGING)) {
- Log.d(TAG, "not the current transaction; current=" + current
- + ", timed out=" + target);
- return;
- }
+ Log.d(TAG, "processing Timeout...");
switch (mState) {
case SipSession.State.REGISTERING:
case SipSession.State.DEREGISTERING:
@@ -1000,19 +1018,19 @@ class SipSessionGroup implements SipListener {
Response response = event.getResponse();
int statusCode = response.getStatusCode();
if (expectResponse(Request.CANCEL, evt)) {
+ if (statusCode == Response.OK) {
+ // do nothing; wait for REQUEST_TERMINATED
+ return true;
+ }
+ } else if (expectResponse(Request.INVITE, evt)) {
switch (statusCode) {
case Response.OK:
- // do nothing; wait for REQUEST_TERMINATED
+ outgoingCall(evt); // abort Cancel
return true;
case Response.REQUEST_TERMINATED:
endCallNormally();
return true;
}
- } else if (expectResponse(Request.INVITE, evt)) {
- if (statusCode == Response.OK) {
- outgoingCall(evt); // abort Cancel
- return true;
- }
} else {
return false;
}