powered by Jive Software

Problems using Jingle support in SmackAPI

Hi folks.

I am also trying to run the Demo application for the Jingle support and I also run into the problem with the exception “ICMP Port Unreachable”. Setup is WinXP with no router or firewall other than the default win firewall. When i ignore the ICMP error and connect to a remote user a NullPointerExceptions is thrown.

Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException

at org.jivesoftware.smackx.jingle.nat.RTPBridge.serviceAvailable(RTPBridge.java:43 2)

at org.jivesoftware.smackx.jingle.nat.ICEResolver.resolve(ICEResolver.java:130)

at org.jivesoftware.smackx.jingle.nat.ICETransportManager.createResolver(ICETransp ortManager.java:45)

at org.jivesoftware.smackx.jingle.nat.JingleTransportManager.getResolver(JingleTra nsportManager.java:58)

at org.jivesoftware.smackx.jingle.OutgoingJingleSession.(OutgoingJingleSession.jav a:143)

at org.jivesoftware.smackx.jingle.JingleManager.createOutgoingJingleSession(Jingle Manager.java:617)

at org.jivesoftware.smackx.jingle.JingleManager.createOutgoingJingleSession(Jingle Manager.java:635)

at org.eclipse.ecf.internal.provider.jingle.Demo$2.actionPerformed(Demo.java:114)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.ja va:236)

at java.awt.Component.processMouseEvent(Component.java:6038)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)

at java.awt.Component.processEvent(Component.java:5803)

at java.awt.Container.processEvent(Container.java:2058)

at java.awt.Component.dispatchEventImpl(Component.java:4410)

at java.awt.Container.dispatchEventImpl(Container.java:2116)

at java.awt.Component.dispatchEvent(Component.java:4240)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)

at java.awt.Container.dispatchEventImpl(Container.java:2102)

at java.awt.Window.dispatchEventImpl(Window.java:2429)

at java.awt.Component.dispatchEvent(Component.java:4240)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:27 3)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:17 3)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

The NPE is caused because there is no ServiceDiscoveryManager present. After looking through the smack 3.0 source it seamed as if the ServiceDiscoveryManager is not properly registered as a ConnectionCreationListener so there is no mapping from the XMPPConnection to the ServiceDiscoveryManager. The registration is supposed to happen in the static{} part of the ServiceDiscoveryManager class which is not invoked before it is queryed.

When i catch the exception in the RTPBridge.serviceAvailable method so that the npe is discarded (i just return false) i can actually connect to the user on the other side.

this is nice. but there is no voice comming out of either side of the connection.

Any help in any direction would be greatly appreciated

Thanks

Hello,

Can you please provide more details about your setup?

Which version of openfire are you running?

The server is at the same machine that you are trying to run the clients?

Can you show a little bit of your code?

Best Regards,

Thiago

Hi there.

I am running an openfire server on a remote machine on the internet. It is an openfire 3.3.0 server. The SmackAPI is version 3.0.2.

My Setup is two machines (one WinXP, one Win2k) on the LAN are connecting to the server and than try to engage a voip session to each other. The code on both machines is identical. the most important parts are:


xmppConnection = new XMPPConnection(this.server);

xmppConnection.connect();

xmppConnection.login(this.user, this.pass);

ICETransportManager icetm0 = new ICETransportManager(xmppConnection, “jivesoftware.com”, 3478);

JmfMediaManager jmfMediaManager = new JmfMediaManager();

jm = new JingleManager(xmppConnection, icetm0, jmfMediaManager);

jm.addCreationListener(icetm0);


This code is pretty much the same as in the Demo.java file. I have made the changes to the SmackAPI code as described above. Now when i start the application i get the same log output on both machines:


Initialized

2

2

Initializing…Resolved

java.net.PortUnreachableException: ICMP Port Unreachable

at java.net.PlainDatagramSocketImpl.receive0(Native Method)

at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)

at java.net.DatagramSocket.receive(DatagramSocket.java:712)

at de.javawi.jstun.test.DiscoveryTest.test1(DiscoveryTest.java:113)

at de.javawi.jstun.test.DiscoveryTest.quickTest(DiscoveryTest.java:81)

at de.javawi.jstun.test.demo.ice.ICENegociator$1.run(ICENegociator.java:77)

at java.lang.Thread.run(Thread.java:619)

java.net.PortUnreachableException: ICMP Port Unreachable

at java.net.PlainDatagramSocketImpl.receive0(Native Method)

at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)

at java.net.DatagramSocket.receive(DatagramSocket.java:712)

at de.javawi.jstun.test.DiscoveryTest.test1(DiscoveryTest.java:113)

at de.javawi.jstun.test.DiscoveryTest.quickTest(DiscoveryTest.java:81)

at de.javawi.jstun.test.demo.ice.ICENegociator$1.run(ICENegociator.java:77)

at java.lang.Thread.run(Thread.java:619)


Just instead of 2, 2 it says 1, 1 on one machine.

Now i go about to engage a connection form machine A to B. The log on machine A which starts the connection says:


C: /192.168.0.1|/192.168.0.1 p:2205

Listening for ECHO: 192.168.0.1:10982

C: /84.166.72.182|/84.166.72.182 p:2195

Listening for ECHO: 84.166.72.182:14938

Service listing

Initializing…Resolved

UpdatePacketListener


At that moment the log on the machine B says the following:


C: /192.168.0.197|192.168.0.197 p:2195

Listening for ECHO 192.168.0.197:14142

Service listing


Now i would think some form of communication is possible but as i mentioned, no voice on either side. just the one in my head wondering what is going in

So, any help would be greatly appreciated.

Do you have a firewall running in your lan?

Is your server’'s network firewalled? (You should opne UDP port range 10000-15000 to internet to make media proxy available)

It seems like your machines cannot communicate each other using UDP.

Regards,

Thiago

hello again

i have a direct connection to the internet via the winxp machine, which shares this connection with the win2k machine. maybe that is causing confusion?

i have disabled the firewall on the winxp machines so that nothing can stop the packet flow. still the problems remain the same as described above.

additionally i have enabled the openfire server to act as a media proxy but that didn’'t change anything either.

New development.

I have changed the TransportManager from ICETransportManager to a STUNTransportManager. This enabled a correct connection as it seams. Still no sound is coming from either side. The network setup is the same as described above. Here is the log on the initialising machine. SmackAPI 3.0.3.


Initialized

Initializing…Resolved

RESOLVING : 84.166.96.253:15460

Initialized

Initializing…Resolved

UpdatePacketListener

Jingle:

Cand: 84.166.96.253

RAW CAND

SET ACTIVE

Transport stabilished

RAW CAND

triggerTransportEstablished 192.168.0.1:15460|84.166.96.253:11110

RAW CAND

RAW CAND

RAW CAND

RAW CAND

RAW CAND

RAW CAND

RAW CAND

RAW CAND

Track 0 is set to transmit as:

gsm/rtp, 8000.0 Hz, Mono, FrameSize=264 bits

Created RTP session at 15460 to: 84.166.96.253 11110


Hello,

STUN worked partially, because it’‘s a blind establishment, which means that it didn’'t check if both machines are connected.

Please back to ICE Manager it’'s much more reliable.

Another question is: How did the machines share the connection to the internet?

A router, swith or hub?

Which model?

Have you checked the settings about firewall and UDP blocking?

Best Regards,

Thiago

With the ICETransportManager i still get the above errors, which means a NPE. with STUN i get a little further (i think).

The internet connection is setup like described in this image:

The WinXP machine creates the connection and shares it via Internet Connection Sharing offered by WindowsXP. The internal WinXP firewall is disabled and no other firewall is present. The Netgear switch is just a regular switch, routing the network traffic. the DSL-Model does not have any special features either.

As we can see your scenario is the simpler as possible.

I confirm that ICEtransport chacks connectivity. STUN only, doesn’‘t. That’'s why you have the “impression” of “further improvements”.

I would check if something is blocking UDP packets in your network setup. I’'m pretty sure, that there is no reason to a jingle call fail in a setup like yours.

Do you have “wireshark”? Can you download it from sourceforge?

This way I can tell you how to trace packets in your network )

Cheers,

Thiago

hello

i have spend some more time playing with various setups and different computers. since i am building smack from the sources, it turned out i was not updating the accompanying libraries but just the sources. so now that i use all the libs from the 3.0.3 release, the first exception “ICMP Port Unreachable” is gone, which is good (i guess). i do use the ICETransportManager.

Still though i have the exception in the very first post of this thread, the NPE in the RTPBridge.serviceAvailable(RTPBridge.java:432) method.

just to let you know, i have installed Spark on both machines and were able to create a computer-to-computer voice communication. when i tried to use my own Demo application as a client on either side (as caller or as receiver) no voice is coming out on either side. in fact, spark is not even recognizing the “Demo user” as being jingle enabled so i can only try to call the spark app but not vice versa. The NPE might be a problem in that field.

any help is greatly appreciated. as always

Are you loading the native libs of JMF?

Are you using full JIDs to place the calls?

Best Regards,

Thiago

i am using full JIDS (username@server/Smack) but i am not using native JMF libs. what dlls do i have to put on the library path?

hi thiago

I am still trying to bring the demo to work. Since the ICETransportManager seams to work now, i am still faced by the NullPointerException pasted in post 1. The explanation under the NPE is still valid. Just to rephrase: The ServiceDiscoveryManager is not aware of the XMPPConnection because its static part is not invoked before the actual connection is established.

So what i did was to make the static{ } part of the ServiceDiscoveryManager execut by just calling ServiceDiscoveryManager.getIdentityName() before the actuall connection.

Now with the ServiceDiscoveryManager registered as a ConnectionListener on the XMPPConnection the NPE is gone, just to be replaced by the next problem: a ClassCastException. I have no idea if what i am doing is actually correct, so that could have numerous reasons. The exception is thrown in the ServiceDiscoveryManager.discoverItems(String entityID, String node) because a IQ is cast to a DiscoverItems. The full Exception is this:

Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: org.jivesoftware.smack.PacketReader$4 cannot be cast to org.jivesoftware.smackx.packet.DiscoverItems

at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryM anager.java:462)

at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryM anager.java:426)

at org.jivesoftware.smackx.jingle.nat.RTPBridge.serviceAvailable(RTPBridge.java:43 2)

at org.jivesoftware.smackx.jingle.nat.ICEResolver.resolve(ICEResolver.java:130)

at org.jivesoftware.smackx.jingle.nat.ICETransportManager.createResolver(ICETransp ortManager.java:45)

at org.jivesoftware.smackx.jingle.nat.JingleTransportManager.getResolver(JingleTra nsportManager.java:58)

at org.jivesoftware.smackx.jingle.OutgoingJingleSession.(OutgoingJingleSession.jav a:143)

at org.jivesoftware.smackx.jingle.JingleManager.createOutgoingJingleSession(Jingle Manager.java:617)

at org.jivesoftware.smackx.jingle.JingleManager.createOutgoingJingleSession(Jingle Manager.java:635)

at org.eclipse.ecf.internal.provider.jingle.Demo$2.actionPerformed(Demo.java:120)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.ja va:236)

at java.awt.Component.processMouseEvent(Component.java:6038)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)

at java.awt.Component.processEvent(Component.java:5803)

at java.awt.Container.processEvent(Container.java:2058)

at java.awt.Component.dispatchEventImpl(Component.java:4410)

at java.awt.Container.dispatchEventImpl(Container.java:2116)

at java.awt.Component.dispatchEvent(Component.java:4240)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)

at java.awt.Container.dispatchEventImpl(Container.java:2102)

at java.awt.Window.dispatchEventImpl(Window.java:2429)

at java.awt.Component.dispatchEvent(Component.java:4240)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:27 3)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:17 3)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

I am eager to get this piece of software to work and am hopping that you can provide some more hints.

thanks in advance

Hello again

So far i have build the SmackAPI from source. Now i have tried to use the prepackaged jar directly. And luckily the Demo works.

So the problem must be in my SmackAPI building process. I let eclipse do that work. What i have done is to create a new project and just drop the smack and the jingle sources into the source folder. than i added all the libs to the build path and compilation works fine. additionally i have added the “smack.providers” and the “smack-config.xml” file to the META-INF directory.

from here on i wanted to reference the smack project in another project to use it. this does not seam to work as i get the NPE mentioned in the very first post here. is there anything else i have to consider when building the project from source within eclipse?

regards

Hello folks

I just wanted to mention, that i have been able to solve the mentioned problems myself. It was the way in which i loaded the smack api which caused some confussion for the classloader. It was not able to locate the smack.providers file and therefore didn’'t initialize the corresponding provider.

thanks for any help so far.

Hey ! it seems I am having the same issue. I am missing the smack.providers file and smack-config.xml file. Is there any way to have these included in eclipse ?

Also is there any known issue with the smack library under linux ? I mean I reach session.start() but there is no call received on my spark client.

You can get those files from the binary build (at least). and you have to make sure everything is loaded from the same classloader.