Skip to content
Snippets Groups Projects
Commit 96db8039 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #38608: fix ghost call in conference hang up

parent cd6a82d2
No related branches found
No related tags found
No related merge requests found
...@@ -194,7 +194,6 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -194,7 +194,6 @@ public class CallListFragment extends Fragment implements CallInterface {
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
...@@ -280,14 +279,6 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -280,14 +279,6 @@ public class CallListFragment extends Fragment implements CallInterface {
} }
public ArrayList<Conference> getDataset() {
return calls;
}
public void remove(Conference transfer) {
}
public void updateDataset(ArrayList<Conference> list) { public void updateDataset(ArrayList<Conference> list) {
calls.clear(); calls.clear();
calls.addAll(list); calls.addAll(list);
...@@ -411,10 +402,7 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -411,10 +402,7 @@ public class CallListFragment extends Fragment implements CallInterface {
Conference c = data.getParcelableExtra("target"); Conference c = data.getParcelableExtra("target");
transfer = data.getParcelableExtra("transfer"); transfer = data.getParcelableExtra("transfer");
try { try {
mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId()); mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId());
mConferenceAdapter.remove(transfer);
mConferenceAdapter.remove(c);
mConferenceAdapter.notifyDataSetChanged(); mConferenceAdapter.notifyDataSetChanged();
} catch (RemoteException e) { } catch (RemoteException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
......
...@@ -50,7 +50,7 @@ public class Conference implements Parcelable { ...@@ -50,7 +50,7 @@ public class Conference implements Parcelable {
return participants.get(0).isRinging(); return participants.get(0).isRinging();
} }
public void removeParticipant(String toRemove) { public void removeParticipant(SipCall toRemove) {
participants.remove(toRemove); participants.remove(toRemove);
} }
...@@ -111,6 +111,7 @@ public class Conference implements Parcelable { ...@@ -111,6 +111,7 @@ public class Conference implements Parcelable {
} }
}; };
private Conference(Parcel in) { private Conference(Parcel in) {
participants = new ArrayList<SipCall>(); participants = new ArrayList<SipCall>();
id = in.readString(); id = in.readString();
......
...@@ -80,21 +80,17 @@ public class CallManagerCallBack extends Callback { ...@@ -80,21 +80,17 @@ public class CallManagerCallBack extends Callback {
mService.mHistoryManager.insertNewEntry(mService.getConferences().get(callID)); mService.mHistoryManager.insertNewEntry(mService.getConferences().get(callID));
mService.getConferences().remove(callID); mService.getConferences().remove(callID);
} else { } else {
ArrayList<Conference> it = new ArrayList<Conference>(mService.getConferences().values());
boolean found = false; Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
int i = 0; while (it.hasNext()) {
while (!found && i < it.size()) { Conference tmp = it.next().getValue();
Conference tmp = it.get(i); for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(callID)) {
for (SipCall call : tmp.getParticipants()) { mService.mHistoryManager.insertNewEntry(c);
if (call.getCallId().contentEquals(callID)) { mService.getConferences().get(tmp.getId()).removeParticipant(c);
mService.mHistoryManager.insertNewEntry(call); break;
mService.getConferences().get(tmp.getId()).removeParticipant(call.getCallId());
found = true;
} }
} }
++i;
} }
} }
...@@ -200,7 +196,7 @@ public class CallManagerCallBack extends Callback { ...@@ -200,7 +196,7 @@ public class CallManagerCallBack extends Callback {
for (SipCall c : tmp.getParticipants()) { for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(all_participants.get(i))) { if (c.getCallId().contentEquals(all_participants.get(i))) {
created.addParticipant(c); created.addParticipant(c);
mService.getConferences().get(tmp.getId()).removeParticipant(c.getCallId()); mService.getConferences().get(tmp.getId()).removeParticipant(c);
} }
} }
} }
...@@ -279,10 +275,10 @@ public class CallManagerCallBack extends Callback { ...@@ -279,10 +275,10 @@ public class CallManagerCallBack extends Callback {
} }
} }
} else if (toModify.getParticipants().size() > newParticipants.size()) { } else if (toModify.getParticipants().size() > newParticipants.size()) {
Log.i(TAG, "toModify.getParticipants().size() > newParticipants.size()");
for (SipCall participant : toModify.getParticipants()) { for (SipCall participant : toModify.getParticipants()) {
if (!newParticipants.contains(participant.getCallId())) { if (!newParticipants.contains(participant.getCallId())) {
mService.removeCallFromConference(toModify.getId(), participant.getCallId()); mService.detachCallFromConference(toModify.getId(), participant);
} }
} }
} }
......
...@@ -86,16 +86,18 @@ public class SipService extends Service { ...@@ -86,16 +86,18 @@ public class SipService extends Service {
public void addCallToConference(String confId, String callId) { public void addCallToConference(String confId, String callId) {
if(mConferences.get(callId) != null){ if(mConferences.get(callId) != null){
// We add a simple call to a conference // We add a simple call to a conference
Log.i(TAG, "// We add a simple call to a conference");
mConferences.get(confId).addParticipant(mConferences.get(callId).getParticipants().get(0)); mConferences.get(confId).addParticipant(mConferences.get(callId).getParticipants().get(0));
mConferences.remove(callId); mConferences.remove(callId);
} else { } else {
Log.i(TAG, "addCallToConference");
Iterator<Map.Entry<String, Conference>> it = mConferences.entrySet().iterator(); Iterator<Map.Entry<String, Conference>> it = mConferences.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Conference tmp = it.next().getValue(); Conference tmp = it.next().getValue();
for (SipCall c : tmp.getParticipants()) { for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(callId)) { if (c.getCallId().contentEquals(callId)) {
mConferences.get(confId).addParticipant(c); mConferences.get(confId).addParticipant(c);
mConferences.get(tmp.getId()).removeParticipant(c.getCallId()); mConferences.get(tmp.getId()).removeParticipant(c);
} }
} }
} }
...@@ -103,10 +105,11 @@ public class SipService extends Service { ...@@ -103,10 +105,11 @@ public class SipService extends Service {
} }
public void removeCallFromConference(String confId, String callId) { public void detachCallFromConference(String confId, SipCall call) {
SipCall call = mConferences.get(confId).getCallById(callId); Log.i(TAG, "detachCallFromConference");
Conference separate = new Conference(call); Conference separate = new Conference(call);
mConferences.put(separate.getId(), separate); mConferences.put(separate.getId(), separate);
mConferences.get(confId).removeParticipant(call);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment