public boolean equals( Object other ) { if (this==other) return true; if (other instanceof CallIdHeader) { final CallIdHeader o = (CallIdHeader) other; return this.getCallId().equalsIgnoreCase( o.getCallId() ); } return false; }
@Override public int hashCode() { if ( (callIdHeader == null) && // https://java.net/jira/browse/JSIP-493 (callIdHeaderString == null)) { return 0; } else { return getCallId().getCallId().hashCode(); } }
public String getForkId() { if ( this.forkId != null ) { return forkId; } else { String callId = this.getCallId().getCallId(); String fromTag = this.getFromTag(); if ( fromTag == null ) { throw new IllegalStateException("From tag is not yet set. Cannot compute forkId"); } this.forkId = (callId + ":" + fromTag).toLowerCase(); return this.forkId; } }
@Override public CallIdHeader getCallId( MobicentsExtendedListeningPoint extendedListeningPoint, String callId) throws ParseException { String callIdString = callId; if(callIdString == null) { callIdString = extendedListeningPoint.getSipProvider().getNewCallId().getCallId(); } if(callIdMaxLength > 0 && callIdString.length() > callIdMaxLength) { callIdString = callIdString.substring(0, callIdMaxLength); } return SipFactoryImpl.headerFactory.createCallIdHeader(callIdString); }
public String getCallId() { CallIdHeader id = (CallIdHeader) this.message .getHeader(getCorrectHeaderName(CallIdHeader.NAME)); if (id != null) return id.getCallId(); else return null; }
public String getCallId() { if(this.sessionCreatingDialog != null) return this.sessionCreatingDialog.getCallId().getCallId(); else if(sessionCreatingTransactionRequest != null) return ((CallIdHeader)this.sessionCreatingTransactionRequest.getMessage().getHeader(CallIdHeader.NAME)).getCallId(); else if(key != null) return key.getCallId(); else return null; }
public void execute(ResponseEvent event) { Response response = event.getResponse(); // We expect a 200 OK // However, we should send switch state to TerminationState whatever // the response is // so we simply ignore the response for now. final String callId = ((CallIdHeader) response .getHeader(CallIdHeader.NAME)).getCallId(); setState(new TerminationState(), callId); } }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } } }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } } }
public void execute(ResponseEvent event) { Response response = event.getResponse(); // We expect a 200 OK but move to TerminationState no matter // what the response status is. // TODO Introduce a termination cause property on the // TerminationEvent to communicate this information final String callId = ((CallIdHeader) response .getHeader(CallIdHeader.NAME)).getCallId(); setState(new TerminationState(), callId); } }
/** * * @param callId * @return */ private Session getSession(Dialog dialog) { final String callId = dialog.getCallId().getCallId(); SessionAssociation sa = (SessionAssociation) cache.get(callId); Session session = sa.getSession(callId); return session; }
public void handleOK(String callerCallId, ResponseEvent event) { // Check that the dialog of the event is the same as in the session // If not this is the result of a fork, we don't handle this try { Dialog eventDialog = sipUtils.getDialog(event); Dialog currentDialog = getDialog(eventDialog.getCallId() .getCallId()); if (!eventDialog.equals(currentDialog)) { log.warn("Received 200 response from forked dialog"); return; // We don't currently handle this. Should send ACK // and BYE } } catch (SipException e) { // TODO Handle this } sendCalleeAck(event); sendCallerAck(event); setState(new SessionEstablishedState(), callerCallId); }
public InitialEventSelector callIDSelect(InitialEventSelector ies) { Object event = ies.getEvent(); String callID = null; if (event instanceof RequestEvent) { // If request event, the convergence name to callId Request request = ((RequestEvent) event).getRequest(); callID = ((CallIdHeader) request.getHeader(CallIdHeader.NAME)).getCallId(); } ies.setCustomName(callID); return ies; }
public void execute(ResponseEvent event) { Response response = event.getResponse(); int status = response.getStatusCode(); final String callId = ((CallIdHeader) response .getHeader(CallIdHeader.NAME)).getCallId(); if (status == Response.OK) { // status == 200 setState(new TerminationState(), callId); } } }
/** * Store the client transaction in the cache since we may need to send a * cancel request associated with this ClientTransaction later. * * @param The * client transaction to store as "to be cancelled". */ private void setToBeCancelledClientTransaction(ClientTransaction ct) { String callId = ((CallIdHeader) ct.getRequest().getHeader( CallIdHeader.NAME)).getCallId(); SessionAssociation sa = (SessionAssociation) cache.get(callId); if (sa != null) { Session session = sa.getSession(callId); session.setToBeCancelledClientTransaction(ct); } }
private void executeResponseState(ResponseEvent event) { String callId = ((CallIdHeader) event.getResponse().getHeader( CallIdHeader.NAME)).getCallId(); SessionAssociation sa = (SessionAssociation) cache.get(callId); SimpleCallFlowState simpleCallFlowState = getState(sa.getState()); simpleCallFlowState.execute(event); }
private void executeRequestState(RequestEvent event) { String callId = ((CallIdHeader) event.getRequest().getHeader( CallIdHeader.NAME)).getCallId(); SessionAssociation sa = (SessionAssociation) cache.get(callId); SimpleCallFlowState simpleCallFlowState = getState(sa.getState()); simpleCallFlowState.execute(event); }
public void execute(ResponseEvent event) { Response response = event.getResponse(); int status = response.getStatusCode(); final String calleeCallId = ((CallIdHeader) response .getHeader(CallIdHeader.NAME)).getCallId(); if (status >= Response.OK && status <= Response.ACCEPTED) { handleOK(calleeCallId, event); } else if (status == Response.DECLINE) { handleDecline(calleeCallId, event); } else if (status == Response.UNAUTHORIZED || status == Response.PROXY_AUTHENTICATION_REQUIRED) { handleAuthentication(calleeCallId, event); } }
public void setAuthenticationHeaders(Request request) { SIPRequest sipRequest = (SIPRequest) request; String callId = sipRequest.getCallId().getCallId(); request.removeHeader(AuthorizationHeader.NAME); Collection<AuthorizationHeader> authHeaders = this.cachedCredentials .getCachedAuthorizationHeaders(callId); if (authHeaders == null) { if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) logger.logDebug( "Could not find authentication headers for " + callId); return; } for (AuthorizationHeader authHeader : authHeaders) { request.addHeader(authHeader); } }