Skip to content
Snippets Groups Projects
Commit 6f283ef3 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

call service: synchronize state change

Change-Id: I50426174a6441aa53cb042890ae42233bdc73d8a
parent 17d34dc8
Branches
Tags
No related merge requests found
...@@ -453,11 +453,14 @@ public class CallService { ...@@ -453,11 +453,14 @@ public class CallService {
} }
public void removeCallForId(String callId) { public void removeCallForId(String callId) {
synchronized (currentCalls) {
currentCalls.remove(callId); currentCalls.remove(callId);
currentConferences.remove(callId); currentConferences.remove(callId);
} }
}
private SipCall addCall(String accountId, String callId, String from, SipCall.Direction direction) { private SipCall addCall(String accountId, String callId, String from, SipCall.Direction direction) {
synchronized (currentCalls) {
SipCall call = currentCalls.get(callId); SipCall call = currentCalls.get(callId);
if (call == null) { if (call == null) {
Account account = mAccountService.getAccount(accountId); Account account = mAccountService.getAccount(accountId);
...@@ -471,6 +474,7 @@ public class CallService { ...@@ -471,6 +474,7 @@ public class CallService {
} }
return call; return call;
} }
}
private Conference addConference(SipCall call) { private Conference addConference(SipCall call) {
String confId = call.getConfId(); String confId = call.getConfId();
...@@ -537,6 +541,7 @@ public class CallService { ...@@ -537,6 +541,7 @@ public class CallService {
void callStateChanged(String callId, String newState, int detailCode) { void callStateChanged(String callId, String newState, int detailCode) {
Log.d(TAG, "call state changed: " + callId + ", " + newState + ", " + detailCode); Log.d(TAG, "call state changed: " + callId + ", " + newState + ", " + detailCode);
try { try {
synchronized (currentCalls) {
SipCall call = parseCallState(callId, newState); SipCall call = parseCallState(callId, newState);
if (call != null) { if (call != null) {
callSubject.onNext(call); callSubject.onNext(call);
...@@ -546,6 +551,7 @@ public class CallService { ...@@ -546,6 +551,7 @@ public class CallService {
updateConnectionCount(); updateConnectionCount();
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
Log.w(TAG, "Exception during state change: ", e); Log.w(TAG, "Exception during state change: ", e);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment