/** * @param response the finalResponse to set */ public void setResponse(SipServletResponseImpl response) { if(response.getStatus() >= 200 && (lastFinalResponse == null || lastFinalResponse.getStatus() < response.getStatus())) { if(logger.isDebugEnabled()) { logger.debug("last final response " + response + " set on " + this); } this.lastFinalResponse = response; } // we keep the last informational response for noPrackReceived only if(containsRel100(response.getMessage()) && (response.getStatus() > 100 && response.getStatus() < 200) && (lastInformationalResponse == null || lastInformationalResponse.getStatus() < response.getStatus())) { if(logger.isDebugEnabled()) { logger.debug("last informational response " + lastInformationalResponse + " set on " + this); } this.lastInformationalResponse = response; } }
private void updateReadyToInvalidate(Transaction transaction) { // Section 6.2.4.1.2 Invalidate When Ready Mechanism : // "The container determines the SipSession to be in the ready-to-invalidate state under any of the following conditions: // 3. A SipSession acting as a UAC transitions from the EARLY state back to // the INITIAL state on account of receiving a non-2xx final response (6.2.1 Relationship to SIP Dialogs, point 4) // and has not initiated any new requests (does not have any pending transactions)." if(logger.isDebugEnabled()) { if(ongoingTransactions != null) { logger.debug("ongoingTransactions " + ongoingTransactions.isEmpty() + " for sipsession " + key); } else { logger.debug("ongoingTransactions " + null + " for sipsession " + key); } } if(!readyToInvalidate && (ongoingTransactions == null || ongoingTransactions.isEmpty()) && transaction instanceof ClientTransaction && getProxy() == null && state != null && state.equals(State.INITIAL) && // Fix for Issue 1734 sessionCreatingTransactionRequest != null && sessionCreatingTransactionRequest.getLastFinalResponse() != null && sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() >= 300) { setReadyToInvalidate(true); } }
if(response.getStatus() > Response.TRYING) { servlet.service(null, response);
/** * Invoked to handle incoming responses. This method dispatched responses to one of the * , * , * . Servlets will not usually need to override this method. */ protected void doResponse(javax.servlet.sip.SipServletResponse resp) throws javax.servlet.ServletException, java.io.IOException{ int status = resp.getStatus(); if (status < 200) { doProvisionalResponse(resp); } else { if (status < 300) { doSuccessResponse(resp); } else if (status < 400) { doRedirectResponse(resp); } else { doErrorResponse(resp); } } }
public boolean allResponsesHaveArrived() { for(final MobicentsProxyBranch pbi: this.proxyBranches.values()) { final SipServletResponse response = pbi.getResponse(); // The unstarted branches still haven't got a chance to get response // Issue http://code.google.com/p/mobicents/issues/detail?id=2461 adding !isCancelled if(!pbi.isStarted() && !pbi.isCanceled()) { return false; } if(pbi.isStarted() && !pbi.isTimedOut() // Issue http://code.google.com/p/mobicents/issues/detail?id=2461 adding !isCancelled // Issue https://code.google.com/p/sipservlets/issues/detail?id=283 fixing !isCancelled for parallel branches, // we should wait for best reponse from all branches && (!parallel && !pbi.isCanceled() || parallel) ) { if(response == null || // if there is no response yet response.getStatus() < Response.OK) { // or if the response if not final return false; // then we should wait more } } } return true; }
if (response.getStatus() > 200) response.getSession().setAttribute(B2BUA_LAST_FINAL_RESPONSE, response); if (response.getStatus() == 487 || (response.getStatus() == 200 && response.getMethod().equalsIgnoreCase("CANCEL"))) { if (logger.isDebugEnabled()) { logger.debug("response to CANCEL not forwarding"); if (response.getStatus() == 200 && response.getMethod().equalsIgnoreCase("BYE")) { if (logger.isDebugEnabled()) { logger.debug("response to BYE not forwarding"); SipServletResponse clonedResponse = linkedRequest.createResponse(response.getStatus()); SipURI originalURI = null; try { if (response.getStatus() == 100 || response.getStatus() == 180 || response.getStatus() == 183) { callRecord = callRecord.setStatus(CallStateChanged.State.RINGING.name()); } else if (response.getStatus() == 200 || response.getStatus() == 202) { callRecord = callRecord.setStatus(CallStateChanged.State.IN_PROGRESS.name()); callRecord = callRecord.setAnsweredBy(((SipURI) response.getTo().getURI()).getUser()); callRecord = callRecord.setStartTime(now); } else if (response.getStatus() == 486 || response.getStatus() == 600) { callRecord = callRecord.setStatus(CallStateChanged.State.BUSY.name()); } else if (response.getStatus() > 400) { callRecord = callRecord.setStatus(CallStateChanged.State.FAILED.name());
if(lastFinalResponse != null && lastFinalResponse.getStatus() >= 300) { callServlet = false; if(logger.isDebugEnabled()) {
(sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() != 401 && sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() != 407 && sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() != SipServletResponse.SC_SESSION_INTERVAL_TOO_SMALL)) { throw new IllegalStateException("cannot create a subsequent request " + method + " because the dialog " + sessionCreatingDialog + " for session " + key + " is in TERMINATED state"); sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() >= 400 && sessionCreatingTransactionRequest.getLastFinalResponse().getStatus() < 500) { if(logger.isDebugEnabled()) { logger.debug("Treating as Initial Request");
@Override public JsonElement serialize(CallInfo callInfo, Type typeOfSrc, JsonSerializationContext context) { final JsonObject object = new JsonObject(); writeSid(callInfo.sid(), object); writeState(callInfo.state().name(), object); if (callInfo.type() != null) writeType(callInfo.type().name(), object); writeDirection(callInfo.direction(), object); writeDateCreated(callInfo.dateCreated(), object); writeForwardedFrom(callInfo.forwardedFrom(), object); writeCallerName(callInfo.fromName(), object); writeFrom(callInfo.from(), object); writeTo(callInfo.to(), object); if (callInfo.invite() != null) { writeInviteUri(callInfo.invite().getRequestURI(), object); } if (callInfo.lastResponse() != null) writeLastResponseUri(callInfo.lastResponse().getStatus(), object); return object; }
@Override public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext context) { final CallInfo callInfo = (CallInfo) object; writer.startNode("CallInfo"); writeSid(callInfo.sid(), writer); writeState(callInfo.state().name(), writer); if (callInfo.type() != null) writeType(callInfo.type().name(), writer); writeDirection(callInfo.direction(), writer); writeDateCreated(callInfo.dateCreated(), writer); writeForwardedFrom(callInfo.forwardedFrom(), writer); writeCallerName(callInfo.fromName(), writer); writeFrom(callInfo.from(), writer); writeTo(callInfo.to(), writer); writeInviteUri(callInfo.invite().getRequestURI(), writer); if (callInfo.lastResponse() != null) writeLastResponseUri(callInfo.lastResponse().getStatus(), writer); writer.endNode(); }