summaryrefslogtreecommitdiffstats
path: root/voip/java/com/android/server/sip/SipService.java
diff options
context:
space:
mode:
Diffstat (limited to 'voip/java/com/android/server/sip/SipService.java')
-rw-r--r--voip/java/com/android/server/sip/SipService.java21
1 files changed, 20 insertions, 1 deletions
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;
}