Git Product home page Git Product logo

java-bells's Introduction

Java Bells

A Jingle implementation for Java based on LibJitsi, Ice4J and Smack

Jitsi implements many features that would be desirable to add to an XMPP library, including Jingle and ICE. Unfortunately, these features are not easily accessible to developers nor are they well documented. This project aims to make these features available to developers with good sample code and decent documentation.

Status

Basic functionality is implemented for both calling out and receiving calls. The receiver can accept calls from other XMPP/Jingle apps like Jitsi. Some documentation, cleanup and testing is still required. The API may change.

Project Goals

The goals of this project are:

  • to create an easy-to-use method of adding audio and video chat functionality to any java app.
  • to not require developers to have more than a cursory understanding of Jingle or ICE.
  • to not modify third-party code or libraries, so that this code can be kept up-to-date easily.

It is also desirable to minimize external requirements, but this is less important.

How to Use

If you are interested in integrating this code with your app, I suggest you start by using the Jisti app to make video calls to make sure your server is setup correctly. Then, use the sample code I've provided and described below to get one user to call themselves on the same machine. Then try calling from one machine to another.

After you get that working, you can easily modify it as needed and integrate into your awesome app.

Compiling and Running

To compile and run, you can use the included ant build.xml file. All the required libraries are included with the distrobution. The following targets are available:

  • compile compiles the code
  • jar builds the necessary jars for use in other code
  • clean cleans for a fresh build
  • test runs a test, trying to both call and answer. It is better to use the testcall and testanswer tests seperately.
  • testanswer connects to the XMPP server and waits to be "Called"
  • testcall connects to the XMPP server and calls the answerer
  • testanswer2 newer version of testanswer with slightly different style.
  • testcall2 newer version of testcall with slightly different style.
  • testcallout tests calling out to an external system like jitsi.

For the tests to run, you will need to copy the passwords.props.template to passwords.props and fill in the values. Don't commit passwords.props to the repository.

ToDo

  • There seem to still be some issues with ICE: eg right now connections don't always work on the same subnet.
  • Demonstrate selecting input devices and screen sharing.
  • Respond to transport-info including ice-restarts
  • Disconnect when other party disconnects from xmpp
  • Respond to error messages sent from peer
  • There are some issues with finding the stun and turn DNS servers. Falling back on jitsi.org servers for now.

How You Can Help

It is surprisingly easy to help. In order from easy to hard:

  • Star or watch this project. That will make it more popular. If you think this project is or might be helpful to you in the future, please star it!
  • Try it out and report problems. You can report issues via github or on the jitsi dev mailing list. If you use the jitsi dev mailing list, be sure to include Java-Bells in the subject.
  • Submit patches/pull requests. This is the best way to ensure issues are fixed!

Source Overview

The main functionality for XMPP connections is provided by the Smack library. In many ways, Java Bells is designed to replace the obsolete smacks-jingle package that came with smack. ICE functionality is provided by the Ice4J library, and the actual media IO and media streaming is provided by LibJitsi. Because LibJitsi and Ice4J have little documentation, other than the overwhelming Jitsi soucecode, it is difficult to inplement these features in other code. This library provides both lightwieght code to help make it easy to use the functions in Ice4J and LibJitsi as well as sample code to demonstrate how to do so.

The sample code is in the package com.xonami.javaBellsSample. Normally you will not use this package in your own code, but rather use it as an example. The code for this library is in the package com.xonami.javaBells. Other packages are coppied from Jitsi.

To use Java Bells, here are the basic steps you need to follow. See the JavaBellsSample for more detail:

  • Call LibJitsi.start() (You will also want a corresponding LibJitsi.stop() at the end of your application.)
  • Call JingleManager.enableJingle() (This ensures that smack won't automatically reject all jingle packets for you, and enabled automatic creation of jingleIQ packets.)
  • Create a new JinglePacketHandler for each connection. You'll want to override the createJingleSession method to create and return a JingleSession object that behaves the way you want. It is important to create your own JingleSession (usually by subclassing DefaultJingleSession) because this is the class that makes decisions about, for example, how to respond to incoming calls.
  • See the sample code for more details.

Support

If you need help, please open a ticket here or contact me directly. I am no longer subscribed to the jitsi mailing list, but I do want to help.

java-bells's People

Contributors

bejayoharen avatar yyjdelete avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-bells's Issues

Issue

I work on a MMORPG private server based on Runescape. I have created my own framework which recieves and sends the needfull information to login (Could be found here https://github.com/AdamAliRS/Gielinor-Netty-Framework) I was researching about having voice chat ingame since its multiplayer. Real time conference for every clanchat (Which is for a clan, it's in the name). I was wondering if voice chat could be integrated for every clanchat, so every clan chat will run a new thread for the voicechat and then send the input to the people in the clanchat via the client.

Since, there is no real API's for something like that, I came across this and was wondering if this would be right for what I want to do. Any help is appreciated.

Call to Jitsi client

Hi,

First : thank you sharing your code!

I am trying to get it working but I have one issue when calling a jitsi client. Once the jitsi client respons the call, it does not seems to send a packet back to javabellssample. The javabellssample do not react or detect that jitsi took the call.

May have you some experience with this problem?

Best regards,

Frederic

Failed to register custom Renderer

Getting this error on testanswer:

[Thread-4] INFO org.slf4j.Logger - [Caller]: connecting to 127.0.0.1
Aug 28, 2013 5:28:42 PM org.jitsi.util.Logger error
SEVERE: Failed to register custom Renderer org.jitsi.impl.neomedia.jmfext.media.renderer.audio.WASAPIRenderer with JMF.
java.lang.NullPointerException
at org.jitsi.impl.neomedia.jmfext.media.renderer.audio.AbstractAudioRenderer.getSupportedInputFormats(AbstractAudioRenderer.java:159)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.registerCustomRenderers(DeviceConfiguration.java:1064)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.(DeviceConfiguration.java:368)
at org.jitsi.impl.neomedia.MediaServiceImpl.(MediaServiceImpl.java:132)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.jitsi.impl.libjitsi.LibJitsiImpl.getService(LibJitsiImpl.java:132)
at org.jitsi.service.libjitsi.LibJitsi.invokeGetServiceOnImpl(LibJitsi.java:163)
at org.jitsi.service.libjitsi.LibJitsi.getMediaService(LibJitsi.java:115)
at com.xonami.javaBells.JingleStreamManager.addDefaultMedia(JingleStreamManager.java:55)
at com.xonami.javaBellsSample.JavaBellsSample$3.run(JavaBellsSample.java:310)

Aug 28, 2013 5:28:42 PM org.jitsi.util.Logger error
SEVERE: Failed to register custom Renderer org.jitsi.impl.neomedia.jmfext.media.renderer.video.JAWTRenderer with JMF.
java.lang.UnsatisfiedLinkError: no jnawtrenderer in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.jitsi.impl.neomedia.jmfext.media.renderer.video.JAWTRenderer.(JAWTRenderer.java:90)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.registerCustomRenderers(DeviceConfiguration.java:1060)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.(DeviceConfiguration.java:368)
at org.jitsi.impl.neomedia.MediaServiceImpl.(MediaServiceImpl.java:132)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.jitsi.impl.libjitsi.LibJitsiImpl.getService(LibJitsiImpl.java:132)
at org.jitsi.service.libjitsi.LibJitsi.invokeGetServiceOnImpl(LibJitsi.java:163)
at org.jitsi.service.libjitsi.LibJitsi.getMediaService(LibJitsi.java:115)
at com.xonami.javaBells.JingleStreamManager.addDefaultMedia(JingleStreamManager.java:55)
at com.xonami.javaBellsSample.JavaBellsSample$3.run(JavaBellsSample.java:310)

Caller: java.io.IOException: Failed to bind even a single host candidate for component:Component id=1 parent stream=audio
no local candidates.
no remote candidates. preferredPort=8938 minPort=8938 maxPort=9038
java.io.IOException: Failed to bind even a single host candidate for component:Component id=1 parent stream=audio
no local candidates.
no remote candidates. preferredPort=8938 minPort=8938 maxPort=9038
at org.ice4j.ice.harvest.HostCandidateHarvester.harvest(HostCandidateHarvester.java:172)
at org.ice4j.ice.Agent.gatherCandidates(Agent.java:441)
at org.ice4j.ice.Agent.createComponent(Agent.java:349)
at com.xonami.javaBells.IceAgent.createStream(IceAgent.java:233)
at com.xonami.javaBells.IceAgent.createStreams(IceAgent.java:80)
at com.xonami.javaBellsSample.JavaBellsSample$3.run(JavaBellsSample.java:313)

Did I miss something???

Call from Jitsi will be rejected by Jitsi after accepted

net.java.sip.communicator.service.protocol.OperationFailedException: Remote party sent an invalid Jingle answer.

Maybe refer to code
com.xonami.javaBells.JingleStreamManager->getSupportedFormat
the number of audio channels must be the same for AudioMediaFormat

Tested with
MediaType mediaType = dev.getMediaType(); if (mf.matches(mediaType, payloadType.getName(), payloadType.getClockrate(), payloadType.getChannels(), null)) {//formatParameters is not used by default
and works well

How Can I use java-bells-with-deps.jar

Hello sir,
I am trying to develop a program that let users communicate with etch other in local network using audio, video and Instance message.
First, I compile the source code of java-bells using ant jar command. I got a java-bells-with-deps.jar. After that, I created a java project using Eclipse Juno Service Release 1 and I put this jar in build class path of my project. I created com.xonami.javaBellsSample 's package and I put on it all example from your source code. Finally when I tried to run JavaBellsSample2.java, I got this error
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at com.xonami.javaBellsSample.JavaBellsSample.main(JavaBellsSample.java:76
Please help?
And thank you

Creating and Sending an Audio Message (HOW TO?)

This library is really useful, and has saved me a lot of headache when working with Smack's deprecated jingle API's.

But your samples do not have anything about creating, sending and receiving and Audio message, for which I actually need to use Jingle.

Can you shed some light on as to how do I create, send and receive an audio message? I am using your library for implementing live voice chat module in an existing web application. #

Unable to setup java bells for two peers

Hi,
While searching for the answers to my question here (http://stackoverflow.com/questions/22756339/newbie-questions-for-jitsi-api ), I came across java-bells.

First of all you have done a very good job on integrating smack, ice4j and Libjitsi, it's commendable.

Right now I am trying to run the sample apps in the java-bells, I have following questions for you:

  1. The sample code is meant for one account acting as both caller and receiver only, am I right in this assumption?
  2. I have hosted an xmpp server of my own and has two separate user accounts on it.
    I want to establish a video call by using java-bells between these two separate accounts on two different machines, how can I do it by using the sample codes that you have provided?

Also I request you to provide any good references that you followed to understand about ice4j, Libjitsi and video communication over RTP in general.

you can also reply to me on [email protected]

many thanks
Ashish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.