SipUnit Home
CafeSip.org Contributor
Howto
CafeSip.org
Java Coding Conventions
SipUnit User Guide
|
SipUnit
Developer & Contributor Howto
This guide is for developers who want to contribute features and
functionality to SipUnit. You may also want to read this document if
you plan
to make changes to the SipUnit code even if you do not want to
contribute the code back to us.
Topics:
- What
do
I
need to know
before deciding to contribute code to the SipUnit project?
- What
kind of
technical skills do I need to have in order to contribute to the
SipUnit project?
- What
kind of
contributions are you looking for?
- How
do I
learn about the SipUnit internals?
- What
do I
need to get started?
- What
kind of reference material do I need to have handy?
- How
do I setup the Eclipse project for sipunit development?
- Some source files
seem to be missing, such as the org.cafesip.sipunit.presenceparser.pidf
classes. Where are they?
- How do I build
the source?
- How
do I actually submit my code?
- How
do I make documentation changes?
What do I need to know
before deciding to contribute code to the SipUnit project?
- First, please read the CafeSip.org
contributor FAQ. This document talks in details on what kind of
contributors we are looking for, who can
contribute, what kind of copyright issues are involved, howto become a
regular contributor, legal issues, ethical issues etc.
- Next, please read the coding
conventions document that explains the coding standards and
conventions followed by the CafeSip.org projects. You will need to
follow the conventions in order for us to take your code.
- Finally read all the
documentation for the SipUnit project,
especially the User Guide. It will give
you enough information to get you
started.
- Finally contact us (info@cafesip.org)
to discuss your ideas. We will be able to orient you and even get in
touch with other interested developers.
What kind of
technical skills do I need to have in order to contribute to the
SipUnit project?
- You must be a strong Java programmer.
- You must be knowledgeable on SIP - Session Initiation
Protocol (see RFC-3261, RFC-3665,
and also the JAIN-SIP
API Javadoc documentation).
- You will need to understand Ant. We use Ant for
building and packaging.
- You must be experienced with JUnit and automated testing concepts.
- If your contribution also requires documentation changes,
you will need to understand how to create HTML documents. We use the Mozilla Composer to create our web
pages. For creating diagrams, we use Dia and GIMP.
- We use the Eclipse IDE for developing,
managing and debugging the code. Although this is not entirely
necessary for you in order to contribute, we encourage you to use the
same tools.
- We use Subversion for managing the
source code. If you are a regular contributor, we will give you access
to the Subversion server hosted by SourceForge. Before using
Subversion, you will need to know the Subversion
basics.
What kind of
contributions are you looking for?
We have some particular projects in mind. You can take a
look at it here (see the TODOs). If
you would like
to contribute for these projects, please
contact us by sending an email to info@cafesip.org.
However, you do not have to follow our plans in case you have better
ideas. If you would like to contribute for a project that you have
thought of on your own, please contact us first to make sure that
someone
else is not already working on it, whether we would accept your
contribution, etc.
How do I learn about the
SipUnit internals?
This section contains some information on the SipUnit
design - class diagram, design notes, etc. Also you can read the javadocs.
However, your best bet is to
read the source code. An IDE with good navigation will make you an
expert in no time.
The architecture diagram in the user
guide shows the concepts but it's
not accurate as a class diagram and skips some detail. Here is the
class diagram for SipUnit. An important philosophy to keep in mind is
that test programs that are using SipTestCase and the high level API
classes (specifically SipPhone,
SipCall, Credential, SipRequest, SipResponse, etc.) do not (should not
have to) use the
JAIN-SIP API.

Miscellaneous Design Notes
Authentication &
Authorization
The idea is that one can supply SipPhone with needed credentials ahead
of time, which will be automatically used during registrations,
presence messaging, and call
processing when an authentication challenge is received. A credential
is: realm + user + password. SipPhone keeps a list of credentials
given to it. It also keeps a list (per Call-ID) of authorization
headers automatically created using the credentials when authentication
challenge(s) are received, to be used on subsequent requests.

What do I need to get
started?
You will need to have a Windows or a Linux system. The
systems must
have 512MB+ RAM, 100MB+ hard disk space and a 2GHz+ processor.
You need to download and install the following software:
- Java 1.4
SDK or higher.
- Ant 1.6 or
higher.
- Eclipse
3.0 or higher.
- If you are a first-time contributor, download the latest SipUnit source package. To
install the software, just unpack the ZIP file you downloaded using
unzip (Linux), winzip (Windows) or jar (part of the Java SDK). If you
are a regular contributor, you will have access to the CafeSip.org
Subversion
repository.
What kind of reference
material do I need to have handy?
From your browser, bookmark the following web pages:
- Java 1.4 API or 1.5 API
javadoc
- Ant Manual.
- JAIN-SIP
API javadoc.
- SIP RFC.
- NIST SIP projects page.
How do I setup the
Eclipse project for SipUnit development?
Here is what you need to do.
I. Install Eclipse: We
use Eclipse 3.2. Download Eclipse from http://www.eclipse.org and install
it as per the instructions.
II. Create the Eclipse project
Either from Subversion:
- Download and install the subclipse plugin from http://subclipse.tigris.org/
.
- Create a directory called cafesip in a location where you
want to store the source code for the sipunit project. This is your
development workspace. Create an environment variable called
CAFESIP_HOME to point to this location.
- From the Eclipse IDE, select menu options Window->Show
View->Other.
- From the Show View dialog box, select the SVN folder
and select SVN Repository . A n empty SVN repostory panel will be
created and docked into the Eclipse screen.
- Select the SVN Repository panel, right click on the panel
to bring up the popup menu. Select New->Repository Location.
- From the repository dialog box, enter the URL - http://cafesip.svn.sourceforge.net/svnroot/cafesip
.
- Once the above step is completed, you will see the CafeSip
source tree on the panel. First select the sipunit project and choose
the sub-directory called "trunk" to select the latest code base. The
latest source code in the trunk directory
may not be stable and may not even compile. Morever, the document may
not even match up. If you want to download the source code that we
consider stable, download the software from the /labels/stable directory. If
you are working on a branch, you may have to choose a different
sub-directory.
- Right-click on the trunk, from the context menu, select the
Checkout option. The Eclipse IDE will contact the repository to gather
project information. We have included all the Eclipse project files
with the jiplet source code so that the project can be setup easily.
- From the Checkout dialog box, select Next. Uncheck the "Use
default workspace location". Instead enter the location of the
directory where you created the cafesip directory above
($CAFESIP_HOME). Clck on the Finish button.
- The Eclipse IDE will download the source code and create
the project. Depending on your connection speed, the download time will
vary. The download is more than 10MB. Once the download is completed,
you will see the project on the Package Explorer panel.
Or from the source distribution:
- Download the source code from CafeSip.org web site and
unpack the source distribution in a directory. The unpacking process
will create a directory called "sipunit".
- From the Eclipse menu, select the following: new workspace
-> new project (Java project).
- Give the project a name (sipunit), hit Next.
- Source - Source folders on build path: sipunit/src, and
Default output
folder: sipunit/src ('Allow output folders for source folders'
unchecked).
- Create the project.
III. Build the Build Path
- Under sipunit/lib, select the jars from the eclipse
Navigator view,
right click and 'Source->Add to build path'. You'll notice this
moves the jars
out of the
lib dir into the main view (dir) of the eclipse Package Explorer.
- Go into project properties, Java Build Path. Click the
'Libraries' tab.
You'll see the jars there. Click the 'Order and Export' tab. Uncheck
lib: JRE
System Library[jdk]. Everything else should be checked.
Some source files seem to be missing, such as the
org.cafesip.sipunit.presenceparser.pidf classes. Where are they ?
Those files are automatically generated by the JAXB
compiler from the xsd in the conf directory. Basically, if you run the
ant "build" target you'll see the missing files appear (refresh your
package explorer/navigator if you're using eclipse) - the build
process will first run the xjc compiler (JAXB) to generate the source
code for those. Alternatively, you can also generate these classes by
running the "genjaxb" target.
For more details on building the source, see next item.
How do I build the source?
- From the package explorer, double click the build.xml file.
You'll see
the outline of it pop up.
- Make sure that the CAFESIP_HOME environmental variable has
been set
correctly to a directory one level higher than the directory containing
the sipunit project. If it wasn't,
set it and restart Eclipse.
- Right click on the 'compilesipunit' target. Run, Ant build.
If, in your Ant build output, you see anything like ${xxxx.xxx} (ie,
Running ${project.name}...), then something is wrong and Ant can't find
your project build.properties file. Check your CAFESIP_HOME and the
init/setglobalenv targets to fix the problem.
- After 'compilesipunit' builds successfully, run the default
'build' Ant target. It should be successful. Now you're cooking.
How do I actually
submit my code?
If you are a regular contributor, you will have
access to the
CafeSip.org Subversion repository. You can directly commit your changes
for
the project that were already agreed upon. If you are a casual
contributor, please submit your changes by following the steps below:
- Before starting the project, please make sure that you have
communicated with us regarding what you want to do.
- Download the source distribution from the CafeSip.org
download site. You will find a .SVN directory under every directory.
Please do not delete these directories.
- Before you make any changes, run all the existing Ant test
targets. They should all pass. You will have to look at the header
comments in the Java test files so that you know what to set up for the
test to run successfully (ie, proxy settings if any).
- Make the necessary changes to the code. Make sure that your
code works and that you have not broken anything. Add/run automated
tests for your code and also run the automated
tests that were already in the project (run all the Ant test targets).
They must pass before
you submit.
- Create a file called SUBMIT.README in the root directory of
the sipunit project. List the following:
- Describe the feature you added.
- Describe the base sipunit version number where
your code is based.
- Describe the nature of changes you made.
- List any part that you want us to check for possible
errors.
- List any third-party libraries that you have added
including their license. Please do
not include any library from projects that cannot be freely
re-distributed.
- When you are ready to submit the code, run the "clean"
target on Ant to remove all binary files. ZIP or tar.gz the entire
source distribution with your changes.
- Upload the packed distribution to a location that we will
provide you.
- We may ask you to make certain changes, please make the
changes and upload again.
- Once we incorporate the changes into our codebase, we will
inform you and you can download and check out the changes and verify
the code. If you want to make further changes, re-package the source
distribution and send it to us.
How do I make
documentation changes?
When you add a new feature or make modifications that
require
documentation changes, you
will need to make them yourself. First go through the project
documentation links and find out what you need to change. Make sure
that you understand the HTML code style and conventions that we are
following. The HTML pages are stored in the CafeSip.org Subversion
server and
is versioned.
If you are a regular contributor:
- Please communicate with the mainitainer of the
web site before you make any changes. THIS IS VERY IMPORTANT. Specify
the directory that you want to modify and the nature of the
modification.
- Check out the web site repository from Subversion.
- If you are creating new pages - Each directory has a file
called template.html. Copy the file and rename it to the file name you
want. Make sure that the file name is lower case, has no spaces and
contain no blank spaces, punctuation characters and no international
character. The file name must have a .html extension.
- Make the necessary changes.
- Upload your changes to the CafeSip.org web site
(instruction will be provided to you on request).
- Check in your changes to the Subversion.
If you are a casual contributor:
- Request us for a zipped version of the cafesip.org web
site. You will find a .SVN directory under every directory. Please do
not delete these directories.
- Make the necessary changes.
- If you are creating new pages - Each directory has a file
called
template.html. Copy the file and rename it to the file name you want.
Make sure that the file name is lower case, has no spaces and contain
no blank spaces, punctuation characters and no international character.
The file name must have a .html extension.
- Pack the entire directory that we sent you into a
ZIP/tar.gz file and upload the file to a specified location.
- We may ask you to make changes to the documentation. Please
make the necessary changes, create ZIP/tar.gz file and upload.
- Once we incorporate the changes into the base, we will
inform you
and you can verify the documentation changes are reflected in the
CafeSip.org website. If
you want to make further changes, upload your changes
again.
|