コード例 #1
0
  /**
   * Constructor for a Jingle incoming session
   *
   * @param conn the XMPP connection
   * @param responder the responder
   * @param transportManager The transport manager
   * @param initialJingleSessionRequest the initial Jingle Session Request
   */
  protected IncomingJingleSession(
      XMPPConnection conn,
      String responder,
      List payloadTypes,
      JingleTransportManager transportManager,
      JingleSessionRequest initialJingleSessionRequest)
      throws XMPPException {

    super(conn, responder, conn.getUser());

    setSid(initialJingleSessionRequest.getSessionID());

    // Create the states...

    accepting = new Accepting(this);
    pending = new Pending(this);
    active = new Active(this);

    TransportResolver resolver = null;
    try {
      resolver = transportManager.getResolver(this);
    } catch (XMPPException e) {
      e.printStackTrace();
    }

    setMediaNeg(new MediaNegotiator(this, payloadTypes));
    if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
      setTransportNeg(new TransportNegotiator.RawUdp(this, resolver));
    }
    if (resolver.getType().equals(TransportResolver.Type.ice)) {
      setTransportNeg(new TransportNegotiator.Ice(this, resolver));
    }
  }
コード例 #2
0
  /**
   * Start the session for a initial Jingle request packet.
   *
   * @param initialJingleSessionRequest the initial Jingle Session Request
   * @throws XMPPException
   */
  public void start(JingleSessionRequest initialJingleSessionRequest) throws XMPPException {
    // Establish the default state
    setState(accepting);

    updatePacketListener();

    Jingle packet = initialJingleSessionRequest.getJingle();
    if (packet != null) {

      // Initialize the session information
      setSid(packet.getSid());

      respond(packet);
    } else {
      throw new XMPPException("Session request with null Jingle packet.");
    }
  }