Overview

SipServlite-Spring is an addon for SipServlite which facilitates the easy configuration of SipServlite components as Spring Beans using a custom XSD stylesheet.

A side benefit to this project is to try and look like the deployment descriptor files of the SIP Servlet speficification, so understanding concepts from the specification will allow you easily to configure the SipServlite framework.

It uses the Spring XML Authoring for integration into Spring, which means that you just need to put the .jar file into your CLASSPATH, and then Spring will figure it out.

Example usage

A very quick example to give you an idea about what this does for you.

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:sip="http://tanesha.net/schema/oss/ims/sipservlite/spring"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://tanesha.net/schema/sipservlite-spring-0.9.0
       http://tanesha.net/schema/sipservlite-spring-0.9.0.xsd">

        <!-- the simple way, create an endpoint with mappers inside, all is wired -->
        <sip:endpoint id="endpoint" hostname="127.0.0.1" port="5060" proto="udp">
                <sip:servlite servlite-ref="myServlite" mapping-ref="myServliteMapping" />
        </sip:endpoint>

        <sip:mapping id="myServliteMapping">
                <sip:and>
                        <sip:equal var="request.method" value="INVITE"/>
                        <sip:regex var="request.uri" value="^sip:test-\d+@.*"/>
                </sip:and>
        </sip:mapping>

        <bean id="myServlite" class="test.MyTestServlite"/>

As with Spring, you can use and reuse beans as you like :-). Another example where we have two endpoints, one using two servlites and the other reusing one of those.

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:sip="http://tanesha.net/schema/oss/ims/sipservlite/spring"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://tanesha.net/schema/sipservlite-spring-0.9.0
       http://tanesha.net/schema/sipservlite-spring-0.9.0.xsd">
        
        <sip:endpoint id="endpoint" hostname="127.0.0.1" port="5060" proto="udp">
                <sip:servlite servlite-ref="myServlite" mapping-ref="myServliteMapping" />
                <sip:servlite servlite-ref="myOtherServlite" mapping-ref="myOtherServliteMapping" />
        </sip:endpoint>

        <sip:endpoint id="otherEndpoint" hostname="195.140.132.100" port="5068" proto="udp">
                <sip:servlite servlite-ref="myServlite" mapping-ref="myServliteMapping" />
        </sip:endpoint>

        <sip:mapping id="myServliteMapping">
                <sip:and>
                        <sip:equal var="request.method" value="INVITE"/>
                        <sip:regex var="request.uri" value="^sip:test-\d+@.*"/>
                </sip:and>
        </sip:mapping>

        <sip:mapping id="myOtherServliteMapping">
                <sip:and>
                        <sip:regex var="request.method" value="SUBSCRIBE|MESSAGE|NOTIFY"/>
                        <sip:equal var="request.uri.user" value="messenger"/>
                </sip:and>
        </sip:mapping>

        <bean id="myServlite" class="test.MyTestServlite"/>

        <bean id="myOtherServlite" class="test.MyTestServlite"/>
</beans>