public void end(Integer statusCode){
        this.setStatus(Call.CALL_ENDED);
        if (getPastStatus()==Call.CALL_INITIALIZED){
            try {
                initialRequest.createResponse(statusCode).send();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        else if (getPastStatus() == Call.CALL_STARTED || getPastStatus() == Call.CALL_KILLED || getPastStatus() >= Call.MEDIA_CALL_INITIALIZED){

            Iterator i = initialRequest.getApplicationSession().getSessions();
            while (i.hasNext()){
                Object o = i.next();
                if (o instanceof SipSession){
                    SipSession ss = (SipSession)o;
                    SipServletRequest bye = ss.createRequest("BYE");
                    try {
                        ss.setHandler("EndSessionServlet");
                        bye.send();
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    } catch (ServletException e){
                        e.printStackTrace();
                    }
                }
            }
        }
        CacheHandler.getCacheHandler().getCallsMap().remove(id);
    }