Peers evolutions

Most developers come to peers for its portability (100% java), its extensibility and its documentation.

Several important evolutions occurred in peers.

Peers is moving to maven. The project has split in several maven modules:

  • peers-doc: documentation converted to docbook
  • peers-lib: sip, sdp, rtp and media related code
  • peers-gui: swing graphical user interface
  • peers-jws: java web start application to start peers

Documentation is now integrated in source tree and converted to docbook standard. Documentation is not yet up-to-date in source tree, but it’s now generated dynamically.


Here are the steps to tweak peers source code using eclipse:

svn co peers
cd peers
mvn install
mvn eclipse:eclipse

In eclipse, add a new java build path classpath variable:

Window > Preferences > Java > Build Path > Classpath Variable, click on New:

  • Name: M2_REPO
  • Path: /home/yohann/.m2/repository

Then, you have to import eclipse projects generated by mvn eclipse:eclipse in eclipse: File > Import… > Existing Projects into Workspace > Browse, select the root peers folder and click Finish.


To generate documentation, use:

mvn pre-site

A pdf is generated in peers/peers-doc/target/docbkx/pdf and the html version is in peers/peers-doc/target/docbkx/html/peers.html.


To create a hello world project based on peers, first install peers in your local repo, create project and provide peers dependency:

~/peers$ mvn install
~/peers$ cd ..
~$ mvn archetype:create -DgroupId=test -DartifactId=demo -Dversion=0.1-SNAPSHOT

Then edit your new pom.xml file and add the following dependency:


Copy logs, media and conf folders from peers root directory to your demo project:

cp -r peers/conf/ peers/media/ peers/logs/ demo/

Edit your peers.xml file in conf/ folder. You have to provide at least <userpart> and and <domain>:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<peers xmlns=""
    xsi:schemaLocation=" peers.xsd">
      <interface id="eth1">
        <name>Ethernet network interface</name>
      <interface ref="eth1"/>
    <interface ref="eth1"/>

Generate your eclipse project using mvn eclipse:eclipse and import it in eclipse.

Edit your main App class:

package test;


import net.sourceforge.peers.sip.core.useragent.SipListener;
import net.sourceforge.peers.sip.core.useragent.UserAgent;
import net.sourceforge.peers.sip.syntaxencoding.SipUriSyntaxException;
import net.sourceforge.peers.sip.transport.SipRequest;
import net.sourceforge.peers.sip.transport.SipResponse;

public class App implements SipListener
    public static void main( String[] args )
        System.out.println( "Hello World!" );
        new App();

    public App() {
        try {
            UserAgent userAgent = new UserAgent(this, null, null);
            // start a new call
            userAgent.getUac().invite("sip:localhost", null);
        } catch (SocketException e) {
        } catch (SipUriSyntaxException e) {

    @Override public void registering(SipRequest sipRequest) { }
    @Override public void registerSuccessful(SipResponse sipResponse) { }
    @Override public void registerFailed(SipResponse sipResponse) { }
    @Override public void incomingCall(SipRequest sipRequest, SipResponse provResponse) { }
    @Override public void remoteHangup(SipRequest sipRequest) { }
    @Override public void ringing(SipResponse sipResponse) { }
    @Override public void calleePickup(SipResponse sipResponse) { }
    @Override public void error(SipResponse sipResponse) { }

Start a wireshark capture or even better launch a sipp uas script with echo option to play the role of the callee:

sipp -sn uas -rtp_echo

Launch your application in eclipse: right-click App > Run As > Java Application. You should get a exception. Provide a program argument to specify peers home (to locate configuration file): Run > Run Configurations… Select App, select Arguments tab, add .. in Program arguments. You should now be able to launch your application with no exception.

If you talk in your microphone, you should now hear your echo, thanks to sipp who is automatically picking-up the call and sending back media traffic to its origin.

For your convenience, you can find this demo project demo.

This entry was posted in Uncategorized by yohann. Bookmark the permalink.

10 thoughts on “Peers evolutions

  1. the line

    UserAgent userAgent = new UserAgent(this, null, null);

    gives a Constructor is ambugious error.
    When I replace it with

    UserAgent userAgent = new UserAgent(this, “.”, null);

    (without the program argument since it’s not needed then) then
    the program will start.

    However sipp gives an error:
    “Last Error: non SIP message discarded.”

    Also there is no sound.

    Any ideas? Is my profile ok?



    • Seems, the site deleted my xml tags. Any way the data that’s left is (in order) from the profile element of the conf/peers.xml.

    • Still no sound. I discovered that the app is calling to localhost while sipp runs on my server. Changing that I see App calling out and sipp picking up.
      However, still no sound.

      The log displays a problem with rtp sockets. I didn’t change the default port 8000 in the App and didn tweak sipp:
      2012-05-03 03:31:19,340 ERROR [Thread-9] cannot send rtp packet Cannot assign requested address: Datagram send failed
      at Method)
      at net.sourceforge.peers.rtp.RtpSession.send([/code]

      Any ideas?

  2. Thanks. Great work. Any idea how to add video conferencing to the application?????? I mean how to detect webcam and video call etc….

    • hi,
      if you want to add video conferencing, you have to use native interfaces to retrieve webcam and display video. Maybe you can use xuggle to play with video, but i don’t know if it can capture webcam.
      good luck,

  3. Hi,
    I found this project really intersting and starting to use it. Please advice me how can I accept the call?
    I know the method on “userAgent.getUas().acceptCall” But any idea How I used it?

  4. Hello Yohann, your project seems to be a good job !

    I am trying to execute your demo project but I have problem during the launch. I am launching sipp -sn uas -rtp_echo -trace_err also in a view to try the “echo” as you said.
    Here is the stack trace of the demo program :
    Exception in thread “main” java.lang.NullPointerException
    at net.sourceforge.peers.sip.transaction.InviteClientTransaction.start(
    at net.sourceforge.peers.sip.core.useragent.InitialRequestManager.createInitialRequestEnd(
    at net.sourceforge.peers.sip.core.useragent.InitialRequestManager.createInitialRequest(
    at net.sourceforge.peers.sip.core.useragent.InitialRequestManager.createInitialRequest(
    at net.sourceforge.peers.sip.core.useragent.UAC.invite(
    at application.App.(
    at application.App.main(

    The config file is well existing on conf/peers.xml and I tried launching the program with the “..” argument.

    Thanks in advance


    • Hello Yohann,

      It seems that the error was due to the 0 option : if 0 is specified, the port is not chosen randomly but the port number 0 is choose.

      here are the logs :
      2012-07-02 01:19:33,045 INFO [main] starting user agent [myAddress:, sipPort: 0, userpart: hello, domain: localhost]
      2012-07-02 01:19:33,135 INFO [main] added datagram socket
      2012-07-02 01:19:33,138 INFO [main] added net.sourceforge.peers.sip.transport.UdpMessageReceiver@5dd582 to message receivers
      2012-07-02 01:19:33,801 ERROR [main] input/output error Adresse déjà utilisée
      at Method)

      Then I specified the 8080 port and the exception doesn’t happen anymore.
      Keep looking on your interesting project :)

      Thanks !