gui.calls.add(c); gui.list2.addElement("["+callId+"] : <TRY> : "+getCall(callId, gui.calls).sipurl); pendingCalls.remove(index);
gui.list2.removeElementAt(index); gui.list2.insertElementAt("["+callId+"] : <TRY> : "+getCall(callId, gui.calls).sipurl, index);
    public boolean changeCallStatus(int callId, String callStatus) {        //print("Call status is "+callStatus+" for call # "+ callId);        if (callStatus.equalsIgnoreCase("ACCEPTED")) {                        Call nc = getCall(callId, gui.calls);//pendingCalls);            int index = getIndex(nc.id, gui.calls); //pendingCalls);            print("Call # "+callId+" accepted.");                           gui.list2.removeElementAt(index);            gui.list2.insertElementAt("["+callId+"] : <ACC> : "+getCall(callId, gui.calls).sipurl, index);                     } else if (callStatus.equalsIgnoreCase("TERMINATED")) {        	        	if (getCall(callId, pendingCalls) == null) { // hang-up-termination by the other side        	    Call c = getCall(callId, gui.calls);              	int index = getIndex(c.id, gui.calls);        	    gui.list2.remove(index);        	} else { // decline-termination by user        	    removeCall(callId, pendingCalls);        	}        	print("Call # " + callId +" terminated.");        }          else {                      	Call c = getCall(callId, gui.calls);          	if (c == null) {          	    c = getCall(callId, pendingCalls);          	}          	int index = getIndex(c.id, gui.calls);          	if (index == -1) {          	    index = getIndex(c.id, pendingCalls);          	}       if (callStatus.equalsIgnoreCase("TRYING")) {                     //  gui.list2.removeElementAt(index);          //  gui.list2.insertElementAt("["+callId+"] : <TRY> : "+getCall(callId, gui.calls).sipurl, index);           gui.calls.add(c);           gui.list2.addElement("["+callId+"] : <TRY> : "+getCall(callId, gui.calls).sipurl); //, index);           pendingCalls.remove(index);        } else if (callStatus.equalsIgnoreCase("RINGING")) {            gui.list2.removeElementAt(index);            gui.list2.insertElementAt("["+callId+"] : <RIN> : "+getCall(callId, gui.calls).sipurl, index);        } else if (callStatus.equalsIgnoreCase("DECLINED")) {            removeCall(callId, gui.calls);            print("Call # " + callId +" declined.");        } else if (callStatus.equalsIgnoreCase("CANCELLED")) {            removeCall(callId, gui.calls);            print("Call # " + callId +" cancelled.");        } else if (callStatus.equalsIgnoreCase("UNREACHABLE")) {            removeCall(callId, gui.calls);            print("Call # " + callId +" unreachable.");        }                 }        return true;    }