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 {
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
......@@ -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) {
calls.clear();
calls.addAll(list);
......@@ -411,10 +402,7 @@ public class CallListFragment extends Fragment implements CallInterface {
Conference c = data.getParcelableExtra("target");
transfer = data.getParcelableExtra("transfer");
try {
mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId());
mConferenceAdapter.remove(transfer);
mConferenceAdapter.remove(c);
mConferenceAdapter.notifyDataSetChanged();
} catch (RemoteException e) {
// TODO Auto-generated catch block
......
......@@ -50,7 +50,7 @@ public class Conference implements Parcelable {
return participants.get(0).isRinging();
}
public void removeParticipant(String toRemove) {
public void removeParticipant(SipCall toRemove) {
participants.remove(toRemove);
}
......@@ -111,6 +111,7 @@ public class Conference implements Parcelable {
}
};
private Conference(Parcel in) {
participants = new ArrayList<SipCall>();
id = in.readString();
......
......@@ -80,21 +80,17 @@ public class CallManagerCallBack extends Callback {
mService.mHistoryManager.insertNewEntry(mService.getConferences().get(callID));
mService.getConferences().remove(callID);
} else {
ArrayList<Conference> it = new ArrayList<Conference>(mService.getConferences().values());
boolean found = false;
int i = 0;
while (!found && i < it.size()) {
Conference tmp = it.get(i);
for (SipCall call : tmp.getParticipants()) {
if (call.getCallId().contentEquals(callID)) {
mService.mHistoryManager.insertNewEntry(call);
mService.getConferences().get(tmp.getId()).removeParticipant(call.getCallId());
found = true;
Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
while (it.hasNext()) {
Conference tmp = it.next().getValue();
for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(callID)) {
mService.mHistoryManager.insertNewEntry(c);
mService.getConferences().get(tmp.getId()).removeParticipant(c);
break;
}
}
++i;
}
}
......@@ -200,7 +196,7 @@ public class CallManagerCallBack extends Callback {
for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(all_participants.get(i))) {
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 {
}
}
} else if (toModify.getParticipants().size() > newParticipants.size()) {
Log.i(TAG, "toModify.getParticipants().size() > newParticipants.size()");
for (SipCall participant : toModify.getParticipants()) {
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 {
public void addCallToConference(String confId, String callId) {
if(mConferences.get(callId) != null){
// 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.remove(callId);
} else {
Log.i(TAG, "addCallToConference");
Iterator<Map.Entry<String, Conference>> it = mConferences.entrySet().iterator();
while (it.hasNext()) {
Conference tmp = it.next().getValue();
for (SipCall c : tmp.getParticipants()) {
if (c.getCallId().contentEquals(callId)) {
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 {
}
public void removeCallFromConference(String confId, String callId) {
SipCall call = mConferences.get(confId).getCallById(callId);
public void detachCallFromConference(String confId, SipCall call) {
Log.i(TAG, "detachCallFromConference");
Conference separate = new Conference(call);
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.
Finish editing this message first!
Please register or to comment