summaryrefslogtreecommitdiffstats
path: root/voip/java
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-10-21 09:50:50 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-21 09:50:50 -0700
commit9d6d17fcd80ca43fb57c4bb5808e55e79f0fbe26 (patch)
tree8faacfaa1a5186d0c84e34412af09ce64b8b6dbc /voip/java
parenta294faffc90255fa17f9884a6e1749553d446deb (diff)
parent35d9e7701eea343d8cdfcd3c990ae74685b299b2 (diff)
downloadframeworks_base-9d6d17fcd80ca43fb57c4bb5808e55e79f0fbe26.zip
frameworks_base-9d6d17fcd80ca43fb57c4bb5808e55e79f0fbe26.tar.gz
frameworks_base-9d6d17fcd80ca43fb57c4bb5808e55e79f0fbe26.tar.bz2
am 35d9e770: am 0a6e717f: Handle dialing a SIP call to self.
Merge commit '35d9e7701eea343d8cdfcd3c990ae74685b299b2' * commit '35d9e7701eea343d8cdfcd3c990ae74685b299b2': Handle dialing a SIP call to self.
Diffstat (limited to 'voip/java')
-rw-r--r--voip/java/com/android/server/sip/SipHelper.java4
-rw-r--r--voip/java/com/android/server/sip/SipService.java21
-rw-r--r--voip/java/com/android/server/sip/SipSessionGroup.java16
3 files changed, 40 insertions, 1 deletions
diff --git a/voip/java/com/android/server/sip/SipHelper.java b/voip/java/com/android/server/sip/SipHelper.java
index 2514262..13e6f14 100644
--- a/voip/java/com/android/server/sip/SipHelper.java
+++ b/voip/java/com/android/server/sip/SipHelper.java
@@ -365,6 +365,10 @@ class SipHelper {
Response response = mMessageFactory.createResponse(
Response.BUSY_HERE, request);
+ if (inviteTransaction == null) {
+ inviteTransaction = getServerTransaction(event);
+ }
+
if (inviteTransaction.getState() != TransactionState.COMPLETED) {
if (DEBUG) Log.d(TAG, "send BUSY HERE: " + response);
inviteTransaction.sendResponse(response);
diff --git a/voip/java/com/android/server/sip/SipService.java b/voip/java/com/android/server/sip/SipService.java
index a6f0d88..2a35fb0 100644
--- a/voip/java/com/android/server/sip/SipService.java
+++ b/voip/java/com/android/server/sip/SipService.java
@@ -430,6 +430,21 @@ public final class SipService extends ISipService.Stub {
}
}
+ private synchronized boolean callingSelf(SipSessionGroupExt ringingGroup,
+ SipSessionGroup.SipSessionImpl ringingSession) {
+ String callId = ringingSession.getCallId();
+ for (SipSessionGroupExt group : mSipGroups.values()) {
+ if ((group != ringingGroup) && group.containsSession(callId)) {
+ if (DEBUG) Log.d(TAG, "call self: "
+ + ringingSession.getLocalProfile().getUriString()
+ + " -> " + group.getLocalProfile().getUriString());
+ return true;
+ }
+ }
+ return false;
+ }
+
+
private class SipSessionGroupExt extends SipSessionAdapter {
private SipSessionGroup mSipGroup;
private PendingIntent mIncomingCallPendingIntent;
@@ -452,6 +467,10 @@ public final class SipService extends ISipService.Stub {
return mSipGroup.getLocalProfile();
}
+ public boolean containsSession(String callId) {
+ return mSipGroup.containsSession(callId);
+ }
+
// network connectivity is tricky because network can be disconnected
// at any instant so need to deal with exceptions carefully even when
// you think you are connected
@@ -551,7 +570,7 @@ public final class SipService extends ISipService.Stub {
(SipSessionGroup.SipSessionImpl) s;
synchronized (SipService.this) {
try {
- if (!isRegistered()) {
+ if (!isRegistered() || callingSelf(this, session)) {
session.endCall();
return;
}
diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java
index bb246a6..50ce7dc 100644
--- a/voip/java/com/android/server/sip/SipSessionGroup.java
+++ b/voip/java/com/android/server/sip/SipSessionGroup.java
@@ -231,6 +231,10 @@ class SipSessionGroup implements SipListener {
}
}
+ synchronized boolean containsSession(String callId) {
+ return mSessionMap.containsKey(callId);
+ }
+
private synchronized SipSessionImpl getSipSession(EventObject event) {
String key = SipHelper.getCallId(event);
SipSessionImpl session = mSessionMap.get(key);
@@ -582,6 +586,7 @@ class SipSessionGroup implements SipListener {
}
private void processCommand(EventObject command) throws SipException {
+ if (isLoggable(command)) Log.d(TAG, "process cmd: " + command);
if (!process(command)) {
onError(SipErrorCode.IN_PROGRESS,
"cannot initiate a new transaction to execute: "
@@ -1050,6 +1055,13 @@ class SipSessionGroup implements SipListener {
mSipHelper.sendCancel(mClientTransaction);
startSessionTimer(CANCEL_CALL_TIMER);
return true;
+ } else if (isRequestEvent(Request.INVITE, evt)) {
+ // Call self? Send BUSY HERE so server may redirect the call to
+ // voice mailbox.
+ RequestEvent event = (RequestEvent) evt;
+ mSipHelper.sendInviteBusyHere(event,
+ event.getServerTransaction());
+ return true;
}
return false;
}
@@ -1351,6 +1363,10 @@ class SipSessionGroup implements SipListener {
return DEBUG;
}
+ private static boolean isLoggable(EventObject evt) {
+ return isLoggable(null, evt);
+ }
+
private static boolean isLoggable(SipSessionImpl s, EventObject evt) {
if (!isLoggable(s)) return false;
if (evt == null) return false;