/**
   * Send INVITE message
   *
   * @param invite SIP INVITE
   * @throws SipException
   */
  @Override
  /** M: Modified to resolve the 403 error issue.@{ */
  protected void sendInvite(SipRequest invite) throws SipException {
    /** @} */
    // Send INVITE request
    SipTransactionContext ctx =
        getImsService().getImsModule().getSipManager().sendSipMessageAndWait(invite);

    // Wait response
    ctx.waitResponse(getResponseTimeout());

    // Analyze the received response
    if (ctx.isSipResponse()) {
      // A response has been received
      if (ctx.getStatusCode() == 200) {
        // 200 OK
        handle200OK(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 407) {
        // 407 Proxy Authentication Required
        handle407Authentication(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 422) {
        // 422 Session Interval Too Small
        handle422SessionTooSmall(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 603) {
        // 603 Invitation declined
        handleError(
            new FileSharingError(
                FileSharingError.SESSION_INITIATION_DECLINED, ctx.getReasonPhrase()));
      } else if (ctx.getStatusCode() == 487) {
        // 487 Invitation cancelled
        handleError(
            new FileSharingError(
                FileSharingError.SESSION_INITIATION_CANCELLED, ctx.getReasonPhrase()));
      }
      /** M: Modified to resolve the 403 error issue.@{ */
      else if (ctx.getStatusCode() == 403) {
        handle403Forbidden(invite);
      }
      /** @} */
      else {
        // Other error response
        handleError(
            new FileSharingError(
                FileSharingError.SESSION_INITIATION_FAILED,
                ctx.getStatusCode() + " " + ctx.getReasonPhrase()));
      }
    } else {
      if (logger.isActivated()) {
        logger.debug("No response received for INVITE");
      }
      /**
       * M:ALPS00507513. ADDED to reslove issue of wrong prompt in case of file transfer timeout@{
       */
      // No response received: timeout
      handleError(new FileSharingError(FileSharingError.SESSION_INITIATION_TIMEOUT));
      /** @}* */
    }
  }
예제 #2
0
  /**
   * Send INVITE message
   *
   * @param invite SIP INVITE
   * @throws SipException
   */
  public void sendInvite(SipRequest invite) throws SipException {
    // Send INVITE request
    SipTransactionContext ctx =
        getImsService()
            .getImsModule()
            .getSipManager()
            .sendSipMessageAndWait(invite, getResponseTimeout());

    // Analyze the received response
    if (ctx.isSipResponse()) {
      // A response has been received
      if (ctx.getStatusCode() == 200) {
        // 200 OK
        handle200OK(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 404) {
        // 404 session not found
        handle404SessionNotFound(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 407) {
        // 407 Proxy Authentication Required
        handle407Authentication(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 422) {
        // 422 Session Interval Too Small
        handle422SessionTooSmall(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 480) {
        // 480 Temporarily Unavailable
        handle480Unavailable(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 486) {
        // 486 busy
        handle486Busy(ctx.getSipResponse());
      } else if (ctx.getStatusCode() == 487) {
        // 487 Invitation cancelled
        handle487Cancel(ctx.getSipResponse());
      } else {
        if (ctx.getStatusCode() == 603) {
          // 603 Invitation declined
          handle603Declined(ctx.getSipResponse());
        } else
          // Other error response
          handleDefaultError(ctx.getSipResponse());
      }
    } else {
      // No response received: timeout
      handleError(
          new ImsSessionBasedServiceError(
              ImsSessionBasedServiceError.SESSION_INITIATION_FAILED, "timeout"));
    }
  }