Skip to content

PresenceClientExample

deruelle edited this page Dec 17, 2014 · 2 revisions

Table of Contents

Service Description

When receiving an INVITE request, the application will call out to the Mobicents SIP Presence Service to check if the from address is a blocked contact. If that's the case it sends out a FORBIDDEN in response and the processing stops.

If that's not the case it proxies the INVITE to the nex application in chain.

All configuration is taken from the sip.xml and used in the application to contact the XDMS for doing the user provisionning on application startup (create user and initial resource list creation) and then retrieving is the user taken from the From Header of the SIP INVITE is present in the blocked contacts of the user.

In a real world application, the users in the XDMS will be provisionned externally and the To Header of the SIP INVITE will be used to get the blocked list instead of using the default user from the sip.xml

This example is used in conjunction with the location service example as well to proxy the response to the correct location if the call is not blocked

How to activate it

From the binary

Download the latest version of the war file corresponding to this example from here

Drop the downloaded war file into your tomcat_home/webapps directory or jboss_home/server/default/deploy directory Get the corresponding dar configuration file.

To understand what the dar configuration file is used for, check the Application Router Documentation .

Drop it in your tomcat_home/conf/dars directory or jboss_home/server/default/conf/dars directory.

To use this dar file for this service, specify in the Service xml tag, darConfigurationFileLocation attribute of the tomcat_home/conf/server.xml file or jboss_home/server/default/deploy/jboss-web.deployer/server.xml , the following : conf/dars/presence-client-example-dar.properties

You can now run your container (Tomcat or Jboss).

From the source

Please check out the speed dial example located under this location from the svn repository. Just call mvn clean install war:inplace to create the war file in the target directory

How to play with it

Download the lastest version of the Mobicents SIP Presence XDMS Server. Extract it locally to a directory that we will reference as $MOBICENTS_PRESENCE_XDMS

Start it with the following command sh $MOBICENTS_PRESENCE_XDMS/bin/run.sh -Djboss.service.binding.set=ports-01 When the Mobicents XDMS Server is completely started, start Mobicents Sip Servlets with sh $MOBICENTS_SIP_SERVLETS/bin/run.sh

Start a SIP Phone of your choice such as the account name should be sip:[email protected] or sip:[email protected]. The From Header should be one of the following addresses : sip:[email protected] or sip:[email protected].

Start another SIP Phone of your choice as the account name is sip:[email protected] (as in the location service example ) on port 5090

The SIP phone doesn't have to be registered. Make a call to sip:[email protected] address, you should receive a Forbidden.

If you change the account name of the first SIP Phone the call will go through