Package org.mobicents.slee.util

Examples of org.mobicents.slee.util.SessionAssociation


          request);

      Header h = ct.getRequest().getHeader(CallIdHeader.NAME);
      String calleeCallId = ((CallIdHeader) h).getCallId();

      SessionAssociation sa = new SessionAssociation(
          "org.mobicents.slee.service.callcontrol.CallControlSbb$InitialState");

      Session calleeSession = new Session(calleeCallId);
      calleeSession.setSipAddress(calleeAddress);
      calleeSession.setToBeCancelledClientTransaction(ct);

      // The dialog for the client transaction in which the INVITE is sent
      Dialog dialog = ct.getDialog();
      if (dialog != null && logger.isDebugEnabled()) {
        logger
            .debug("Obtained dialog from ClientTransaction : automatic dialog support on");
      }
      if (dialog == null) {
        // Automatic dialog support turned off
        try {
          dialog = getSipProvider().getNewDialog(ct);
          if (logger.isDebugEnabled()) {
            logger
                .debug("Obtained dialog for INVITE request to callee with getNewDialog");
          }
        } catch (Exception e) {
          logger.error("Error getting dialog", e);
        }
      }

      if (logger.isDebugEnabled()) {
        logger
            .debug("Obtained dialog in onThirdPCCTriggerEvent : callId = "
                + dialog.getCallId().getCallId());
      }
      // Get activity context from factory
      ActivityContextInterface sipACI = getSipActivityContextInterfaceFactory()
          .getActivityContextInterface(dialog);

      ActivityContextInterface clientSipACI = getSipActivityContextInterfaceFactory()
          .getActivityContextInterface(ct);

      calleeSession.setDialog(dialog);
      sa.setCalleeSession(calleeSession);

      Session callerSession = new Session();

      // Create a new caller address from caller URI specified in the
      // event (the real caller address)
      // since we need this in the next INVITE.
      callerAddress = getSipUtils().convertURIToAddress(callerSip);
      callerSession.setSipAddress(callerAddress);
      // Since we don't have the client transaction for the caller yet,
      // just set the to be cancelled client transaction to null.
      callerSession.setToBeCancelledClientTransaction(null);
      sa.setCallerSession(callerSession);

      // put the callId for the callee dialog in the cache
      getCacheUtility().put(calleeCallId, sa);

      ChildRelation relation = getCallControlSbbChild();
View Full Code Here


  }

  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);
  }
View Full Code Here

  }

  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);
  }
View Full Code Here

   *            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);
    }
  }
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug("Setting state to " + state + " for callId " + callId);
      ;
    }
    String stateName = state.getClass().getName();
    SessionAssociation sa = (SessionAssociation) cache.get(callId);
    // This state is used to manage the state machine transitions in the Sbb
    // implementation
    sa.setState(stateName);
    // Also communicate the state to external observers
    StateCallback callback = sa.getStateCallback();
    if (callback != null) { // The callback property is optional and can be
      // null
      callback.setSessionState(stateName);
    }
View Full Code Here

   * @param dialog
   * @param callId
   */
  // TODO Fix the hack referred to above
  private void setDialog(Dialog dialog, String callId) {
    SessionAssociation sa = (SessionAssociation) cache.get(callId);
    Session session = sa.getSession(callId);
    if (log.isDebugEnabled()) {
      log.debug("Setting dialog in session for callId : " + callId);
    }
    session.setDialog(dialog);
  }
View Full Code Here

      e.printStackTrace();
    }
  }

  private Dialog getPeerDialog(String callId) {
    SessionAssociation sa = (SessionAssociation) cache.get(callId);
    Session peerSession = sa.getPeerSession(callId);
    return peerSession.getDialog();
  }
View Full Code Here

    Session peerSession = sa.getPeerSession(callId);
    return peerSession.getDialog();
  }

  private Dialog getDialog(String callId) {
    SessionAssociation sa = (SessionAssociation) cache.get(callId);
    Session session = sa.getSession(callId);
    return session.getDialog();
  }
View Full Code Here

   */

  private void sendRequestWithAuthorizationHeader(ResponseEvent event) {
   
    ClientTransaction ct = null;
    SessionAssociation sa = null;
    try {
      Request request = sipUtils.buildRequestWithAuthorizationHeader(
          event, getPassword());

      log
          .debug("sendRequestWithAuthorizationHeader. request with Auth = "
              + request);

      ct = sipProvider.getNewClientTransaction(request);
    } catch (TransactionUnavailableException e) {
      e.printStackTrace();
    }

    Dialog dialog = ct.getDialog();
    SbbLocalObject sbbLocalObject = this.getSbbContext().getSbbLocalObject();
    // TODO Handle exception
    if (dialog == null) {
      // Automatic dialog support is off
      try {
        dialog = sipProvider.getNewDialog(ct);
        if (log.isDebugEnabled()) {
          log
              .debug("Obtained dialog with getNewDialog in sendRequestWithAuthorizationHeader");
        }
      } catch (SipException e) {
        log
            .error(
                "Error getting dialog in sendRequestWithAuthorizationHeader",
                e);
      }

      // Let us remove mapping between SessionAsscoiation and old Call-ID
      ClientTransaction ctOld = event.getClientTransaction();
      Header h = ctOld.getRequest().getHeader(CallIdHeader.NAME);
      String oldCallId = ((CallIdHeader) h).getCallId();

      sa = (SessionAssociation) cache.get(oldCallId);

      Header hNew = ct.getRequest().getHeader(CallIdHeader.NAME);
      String calleeCallIdNew = ((CallIdHeader) hNew).getCallId();

      Session oldCalleeSession = sa.getSession(oldCallId);
      oldCalleeSession.setCallId(calleeCallIdNew);

      try {
        ActivityContextInterface sipACI = activityContextInterfaceFactory
            .getActivityContextInterface(dialog);
View Full Code Here

   * @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;
  }
View Full Code Here

TOP

Related Classes of org.mobicents.slee.util.SessionAssociation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.