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.

Posted in Uncategorized