コード例 #1
0
    /** The other endpoint has accepted the session. */
    public Jingle eventAccept(Jingle jin) throws XMPPException {

      PayloadType acceptedPayloadType = null;
      TransportCandidate acceptedLocalCandidate = null;

      // We process the "accepted" if we have finished the
      // sub-negotiators. Maybe this is not needed (ie, the other endpoint
      // can take the first valid transport candidate), but otherwise we
      // must cancel the negotiators...
      //
      if (isFullyEstablished()) {
        acceptedPayloadType = getAcceptedAudioPayloadType(jin);
        acceptedLocalCandidate = getAcceptedLocalCandidate(jin);

        if (acceptedPayloadType != null && acceptedLocalCandidate != null) {
          if (acceptedPayloadType.equals(getMediaNeg().getBestCommonAudioPt())
              && acceptedLocalCandidate.equals(getTransportNeg().getAcceptedLocalCandidate())) {
            setState(active);
          }
        } else {
          throw new JingleException(JingleError.MALFORMED_STANZA);
        }
      }

      return super.eventAccept(jin);
    }