Implementing jingle module

Krystian Wojcicki
Added over 2 years ago

I was looking at the sample jingle module code and it seems to be out of date I was wondering if there were any examples of how to implement a jingle module that is more up to date. Additionally I was wondering after I initialize a FileTransferManager how would I be able to access it to send a file.

Replies (5)


Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 2 years ago

At this point there is no more up to date example of usage of @JingleModule@.

As for @FileTransferManager@, you can retrieve it using following code:

FileTransferManager ftmanager = jaxmpp.get(FileTransferManager.class);

where jaxmpp is instance of Jaxmpp class.


Added by Krystian Wojcicki over 2 years ago

I am a little unsure of how to proceed with sending a file. Using the FileTransferManager i can create a FileTransfer object but i am unsure of how to proceed and actually send the initiation request to another user. And how would i go about receiving an file from a different user?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 2 years ago

Which method of FileTransferManager you use to create FileTransfer object? Isn't it called @sendFile@? It automatically sends initiation request.

On receiving side you need to listen for events declared and fired by FileTransferManager@, ie. FileTransferRequestEvent@ which will be fired when initiation requests will be received.

From there you need to set file to which you want data to be saved to using setFile() method of FileTransfer instance and call acceptFile or rejectFile method of @FileTransferManager@.

Added by Krystian Wojcicki over 2 years ago

Thanks a bunch I got the file transfer working. Returning to the JingleModule if I wanted to implement audio call and eventually video call how should I proceed?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 2 years ago

You need to implement classes responsible for handling events fired using EventBus by JingleModule@, like ie. @JingleSessionAcceptHandler@, @JingleSessionInitiationHandler@, @JingleSessionTerminateHandler@, JingleSessionInfoHandler@. To react on this events, ie. accept Jingle session you need to use methods provided by JingleModule instance.

Then you need to register instance of this class in EventBus instance, ie:

jaxmpp.getEventBus().addHandler(JingleSessionInitiationHandler.JingleSessionInitiationEvent.class, listenerInstance);

This will allow you to listen and react on incoming Jingle requests.

Later on you may need to implement XmppModule to advertise some features which are required to allow other clients know that your client is Jingle-Voip capable. And instance of this class needs to be registered in Jaxmpp instance as well.

In case of file transfer this things described above are implemented in JingleFileTransferNegotiator (there is no XMPP module, but FileTransferManager updates features advertised by client by adding features provided by registered in it FileTransferNegotiator instances.

Additionally you will need to provide support for Jingle-ICE or RTP implementation for data transfer, implementation which will provide candidates and transports information to exchange with remote client, etc.