Examples of Jingle


Examples of org.jivesoftware.smackx.packet.Jingle

                // Process ACKs
                if (isExpectedId(iq.getPacketID())) {
                    removeExpectedId(iq.getPacketID());
                }
            } else if (iq instanceof Jingle) {
                Jingle jingle = (Jingle) iq;

                // There are 1 or more <content> sections in a Jingle packet.
                // Find out which <content> section belongs to this content negotiator, and
                // then dispatch the Jingle packet to the media and transport negotiators.

                for (JingleContent jingleContent : jingle.getContentsList()) {
                    if (jingleContent.getName().equals(name)) {
                        if (mediaNeg != null) {
                            responses.addAll(mediaNeg.dispatchIncomingPacket(iq, id));
                        }
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

      fail("The server did reply with an error packet: " + iqReceived.getError().getCode());
    }
    else {
      assertTrue(iqReceived instanceof Jingle);

      Jingle jin = (Jingle) iqReceived;
     
      System.out.println("Sent:     " + iqSent.toXML());
      System.out.println("Received: " + jin.toXML());
    }   
  }
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

            public boolean accept(Packet pin) {
                if (pin instanceof IQ) {
                    IQ iq = (IQ) pin;
                    if (iq.getType().equals(IQ.Type.SET)) {
                        if (iq instanceof Jingle) {
                            Jingle jin = (Jingle) pin;
                            if (jin.getAction().equals(JingleActionEnum.SESSION_INITIATE)) {
                                return true;
                            }
                        }
                    }
                }
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

                    System.out.println("packet: " + pin.toXML());
                    IQ iq = (IQ) pin;
                    if (iq.getType().equals(IQ.Type.SET)) {
                        System.out.println("packet");
                        if (iq instanceof Jingle) {
                            Jingle jin = (Jingle) pin;
                            if (jin.getAction().equals(JingleActionEnum.SESSION_INITIATE)) {
                                System.out.println("Session initiation packet accepted... ");
                                return true;
                            }
                        }
                    }
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

                        if ((bestRemote != null)
                                && ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
                            // Accepting the remote candidate
                            if (!acceptedRemoteCandidates.contains(bestRemote)) {
                                Jingle jout = new Jingle(JingleActionEnum.CONTENT_ACCEPT);
                                JingleContent content = parentNegotiator.getJingleContent();
                                content.addJingleTransport(getJingleTransport(bestRemote));
                                jout.addContent(content);

                                // Send the packet
                                js.sendFormattedJingle(jin, jout);
                                acceptedRemoteCandidates.add(bestRemote);
                            }
                            if ((isEstablished()) && (getNegotiatorState() == JingleNegotiatorState.PENDING)) {
                                setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
                                triggerTransportEstablished(getAcceptedLocalCandidate(), bestRemote);
                                break;
                            }
                        }
                    }

                    // Once we are in pending state, look for any valid remote
                    // candidate, and send an "accept" if we have one...
                    TransportCandidate bestRemote = getBestRemoteCandidate();

                    if (bestRemote == null) {
                        boolean foundRemoteRelay = false;
                        for (TransportCandidate candidate : remoteCandidates) {
                            if (candidate instanceof ICECandidate) {
                                ICECandidate iceCandidate = (ICECandidate) candidate;
                                if (iceCandidate.getType().equals("relay")) {
                                    //TODO Check if the relay is reacheable
                                    addValidRemoteCandidate(iceCandidate);
                                    foundRemoteRelay = true;
                                }
                            }
                        }

                        // If not found, check if we offered a relay. If yes, we should accept any remote candidate.
                        // We should accept the Public One if we received it, otherwise, accepts any.
                        if (!foundRemoteRelay) {
                            boolean foundLocalRelay = false;
                            for (TransportCandidate candidate : offeredCandidates) {
                                if (candidate instanceof ICECandidate) {
                                    ICECandidate iceCandidate = (ICECandidate) candidate;
                                    if (iceCandidate.getType().equals("relay")) {
                                        foundLocalRelay = true;
                                    }
                                }
                            }
                            if (foundLocalRelay) {
                                boolean foundRemotePublic = false;
                                for (TransportCandidate candidate : remoteCandidates) {
                                    if (candidate instanceof ICECandidate) {
                                        ICECandidate iceCandidate = (ICECandidate) candidate;
                                        if (iceCandidate.getType().equals(ICECandidate.Type.srflx)) {
                                            addValidRemoteCandidate(iceCandidate);
                                            foundRemotePublic = true;
                                        }
                                    }
                                }
                                if (!foundRemotePublic) {
                                    for (TransportCandidate candidate : remoteCandidates) {
                                        if (candidate instanceof ICECandidate) {
                                            ICECandidate iceCandidate = (ICECandidate) candidate;
                                            addValidRemoteCandidate(iceCandidate);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    for (int i = 0; i < 6; i++) {
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }

                        bestRemote = getBestRemoteCandidate();
                        //State state = getState();
                        if ((bestRemote != null)
                                && ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
                            if (!acceptedRemoteCandidates.contains(bestRemote)) {
                                Jingle jout = new Jingle(JingleActionEnum.CONTENT_ACCEPT);
                                JingleContent content = parentNegotiator.getJingleContent();
                                content.addJingleTransport(getJingleTransport(bestRemote));
                                jout.addContent(content);

                                // Send the packet
                                js.sendFormattedJingle(jin, jout);
                                acceptedRemoteCandidates.add(bestRemote);
                            }
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

        if (!cand.isNull()) {
            // Offer our new candidate...
            addOfferedCandidate(cand);
            JingleContent content = parentNegotiator.getJingleContent();
            content.addJingleTransport(getJingleTransport(cand));
            Jingle jingle = new Jingle(JingleActionEnum.TRANSPORT_INFO);
            jingle.addContent(content);

            // We SHOULD NOT be sending packets directly.
            // This circumvents the state machinery.
            // TODO - work this into the state machinery.
            session.sendFormattedJingle(jingle);
View Full Code Here

Examples of org.jivesoftware.smackx.packet.Jingle

                    response = receiveResult(iq);
                    removeExpectedId(iq.getPacketID());
                }
            } else if (iq instanceof Jingle) {
                // Get the action from the Jingle packet
                Jingle jingle = (Jingle) iq;
                JingleActionEnum action = jingle.getAction();

                switch (action) {
                    case CONTENT_ACCEPT:
                        response = receiveContentAcceptAction(jingle);
                        break;
View Full Code Here

Examples of rocks.xmpp.extensions.jingle.model.Jingle

                "                   type='proxy'/>\n" +
                "      </transport>\n" +
                "    </content>\n" +
                "  </jingle>\n";

        Jingle jingle = unmarshal(xml, Jingle.class);
        Assert.assertNotNull(jingle);
        Assert.assertTrue(jingle.getContents().get(0).getTransportMethod() instanceof S5bTransportMethod);
        S5bTransportMethod s5bTransportMethod = (S5bTransportMethod) jingle.getContents().get(0).getTransportMethod();
        Assert.assertNotNull(s5bTransportMethod);
        Assert.assertNull(jingle.getContents().get(0).getApplicationFormat());
        Assert.assertEquals(s5bTransportMethod.getDstAddr(), "1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba");
        Assert.assertEquals(s5bTransportMethod.getSessionId(), "vj3hs98y");
        Assert.assertEquals(s5bTransportMethod.getMode(), S5bTransportMethod.Mode.TCP);
        Assert.assertEquals(s5bTransportMethod.getCandidates().size(), 4);
        Assert.assertEquals(s5bTransportMethod.getCandidates().get(0).getCid(), "ht567dq");
View Full Code Here

Examples of rocks.xmpp.extensions.jingle.model.Jingle

                "    </content>\n" +
                "  </jingle>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        Jingle jingle = iq.getExtension(Jingle.class);
        Assert.assertNotNull(jingle);
        Assert.assertTrue(jingle.getContents().get(0).getTransportMethod() instanceof IceUdpTransportMethod);
        IceUdpTransportMethod iceUdpTransport = (IceUdpTransportMethod) jingle.getContents().get(0).getTransportMethod();
        Assert.assertNotNull(iceUdpTransport);
        Assert.assertEquals(iceUdpTransport.getPassword(), "asd88fgpdd777uzjYhagZg");
        Assert.assertEquals(iceUdpTransport.getUserFragment(), "8hhy");
        Assert.assertEquals(iceUdpTransport.getCandidates().size(), 2);
        Assert.assertEquals(iceUdpTransport.getCandidates().get(0).getComponent(), 1);
View Full Code Here

Examples of rocks.xmpp.extensions.jingle.model.Jingle

                "    </content>\n" +
                "  </jingle>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        Jingle jingle = iq.getExtension(Jingle.class);
        Assert.assertNotNull(jingle);
        Assert.assertEquals(jingle.getAction(), Jingle.Action.SESSION_INITIATE);
        Assert.assertEquals(jingle.getInitiator(), Jid.valueOf("romeo@montague.lit/orchard"));
        Assert.assertEquals(jingle.getSessionId(), "a73sjjvkla37jfea");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.