DNS SRV support for SIP11 SLEE RA?

50 views
Skip to first unread message

mls

unread,
Aug 6, 2010, 3:07:02 PM8/6/10
to mobicents-public
Hi,

First post to the group. I'm not much of a coder - just enough to be
dangerous - so please excuse me if I ask any stupid questions related
to Java.

I'm trying to build an application server for some IMS proof of
concept testing. I've written most of the code for what I need to do
and it works, except for one little detail.... I'd really like to
perform DNS SRV resolution on the destination domain when I send out a
SIP request and the RA appears to only do A record queries. In my
scenario, the SRV resolution would return two servers of equal weight
and priority. Ideally, the RA would determine if there was a failure
with the first server (for example, it isn't responding) and advance
to the next one, per RFC3263 Sec 4.2, but at this point, I'll just be
happy to get an SRV query out of it.

Is this possible in JAIN SLEE? I've found posts that talk about how
to do it in SIP Servlets, but I'm not sure how to get the
SipApplicationDispatcher object I need to instantiate a
DNSAddressResolver.

mls

mls

unread,
Aug 7, 2010, 5:10:35 PM8/7/10
to mobicents-public
From what I've been able to dig up from an old post on this topic, I
need to set the following variable in sipra.properties:

gov.nist.javax.sip.ADDRESS_RESOLVER=org.mobicents.servlet.sip.core.DNSAddressResolver

So I did this, rebuilt the sip11 RA jar, and deployed it, but I get an
error like this:

17:04:50,063 ERROR [SipResourceAdaptor] error in initializing resource
adaptor
javax.sip.PeerUnavailableException: The Peer SIP Stack:
org.mobicents.ha.javax.sip.SipStackImpl could not be instantiated.
Ensure the Path Name has been set.
at javax.sip.SipFactory.createStack(SipFactory.java:324)

<...omitted...>

Caused by: javax.sip.PeerUnavailableException: can't find or
instantiate AddressResolver implementation:
org.mobicents.servlet.sip.core.DNSAddressResolver
at gov.nist.javax.sip.SipStackImpl.<init>(SipStackImpl.java:
860)
at
org.mobicents.ha.javax.sip.ClusteredSipStackImpl.<init>(ClusteredSipStackImpl.java:
70)
at
org.mobicents.ha.javax.sip.SipStackImpl.<init>(SipStackImpl.java:50)
... 54 more


I have both dnsjava-2.0.6.jar and sip-servlets-impl-1.2.jar in
$JBOSS_HOME/server/default/lib

I guess I have two questions at this point:
1) Is there anything special I need to do so that Jboss can find the
missing class?
2) Is there a better way to override the sipra.properties than editing
the file and rebuilding the jar?

Again, I'm obviously not a Java expert.

Jean Deruelle

unread,
Aug 9, 2010, 5:03:25 AM8/9/10
to mobicent...@googlegroups.com
The Jar needs to be included in the SIP RA jar libraries IIRC. But using the sip servlets jar won't do.


and remove the ref to sipApplicationDispatcher. Then compile it in a jar and include the jar as a lib in the SIP RA.
Then pass to the sipra properties gov.nist.javax.sip.ADDRESS_RESOLVER=org.mobicents.servlet.sip.core.DNSAddressResolver (or your class name if you changed it)

Jean

Eduardo Martins

unread,
Aug 9, 2010, 5:44:36 AM8/9/10
to mobicent...@googlegroups.com
See if it works, in such case we will add the class to the RA sources.

-- Eduardo

-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
http://emmartins.blogspot.com
http://www.redhat.com/solutions/telco

Jean Deruelle

unread,
Aug 9, 2010, 5:49:17 AM8/9/10
to mobicent...@googlegroups.com
I actually could remove the sip application dispatcher reference and add setters and getters for the hostnames so that both MSS and JAIN SLEE could use the class and we can put it in jain sip ha or a jain sip ext project

mls

unread,
Aug 9, 2010, 4:48:01 PM8/9/10
to mobicents-public
I did what you guys suggested. I copied the DNSAddressResolver class
to a new project with a new package and removed the
SipApplicationDispatcher references so that there was an empty
constructor. Then I built the project, put it in a jar, and added the
jar to my local maven repository. I modified the sip11ra project and
put the dependency in my pom.xml file. I also modified the
sipra.properties file and set the gov.nist.javax.sip.ADDRESS_RESOLVER
property to my new classpath. I rebuilt the RA and deployed it. Now
I do see the SRV queries and that part is working. I think I just
need to manually code the logic to have it advance to the next SRV
entry when I get a timeout, which is something I'll have to figure out
how to do.

Ideally, in the future I would like to see the mobicents
DNSAddressResolver class have an empty constructor so that it can be
passed to the RA without all the extra steps. Actually, ideally, I'd
like to see this feature built into the next release of the RA. But
this is obviously selfish on my part :).


On Aug 9, 5:49 am, Jean Deruelle <jean.derue...@gmail.com> wrote:
> I actually could remove the sip application dispatcher reference and add
> setters and getters for the hostnames so that both MSS and JAIN SLEE could
> use the class and we can put it in jain sip ha or a jain sip ext project
>
> On Mon, Aug 9, 2010 at 11:44 AM, Eduardo Martins <emmart...@gmail.com>wrote:
>
> > See if it works, in such case we will add the class to the RA sources.
>
> > -- Eduardo
>
> > -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
> >http://emmartins.blogspot.com
> >http://www.redhat.com/solutions/telco
>
> > On Mon, Aug 9, 2010 at 10:03 AM, Jean Deruelle <jean.derue...@gmail.com>
> > wrote:
> > > The Jar needs to be included in the SIP RA jar libraries IIRC. But using
> > the
> > > sip servlets jar won't do.
> > > you need to get the java code from
> > > here
> >http://mobicents.googlecode.com/svn/trunk/servers/sip-servlets/sip-se...
> > > and remove the ref to sipApplicationDispatcher. Then compile it in a jar
> > and
> > > include the jar as a lib in the SIP RA.
> > > Then pass to the sipra
>
> > properties gov.nist.javax.sip.ADDRESS_RESOLVER=org.mobicents.servlet.sip.core.DNSAddressResolver
> > > (or your class name if you changed it)
> > > Jean
>

Eduardo Martins

unread,
Aug 9, 2010, 5:03:43 PM8/9/10
to mobicent...@googlegroups.com
With respect to SLEE lets target 2.2.0 release for this feature.
Meanwhile please work with your hack.

-- Eduardo

-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
http://emmartins.blogspot.com
http://www.redhat.com/solutions/telco

Jean Deruelle

unread,
Aug 10, 2010, 4:12:46 AM8/10/10
to mobicent...@googlegroups.com
See inline

On Mon, Aug 9, 2010 at 10:48 PM, mls <lanes...@hotmail.com> wrote:
I did what you guys suggested.  I copied the DNSAddressResolver class
to a new project with a new package and removed the
SipApplicationDispatcher references so that there was an empty
constructor.  Then I built the project, put it in a jar, and added the
jar to my local maven repository.  I modified the sip11ra project and
put the dependency in my pom.xml file.  I also modified the
sipra.properties file and set the gov.nist.javax.sip.ADDRESS_RESOLVER
property to my new classpath.  I rebuilt the RA and deployed it.  Now
I do see the SRV queries and that part is working.

Great !

 I think I just
need to manually code the logic to have it advance to the next SRV
entry when I get a timeout, which is something I'll have to figure out
how to do.

Since the router and address resolver are stateless in jain sip, it might prove difficult.
You may want to check out what suggests alternative router implementations for jain sip  http://code.google.com/p/jain-sip-rfc3263-router/wiki/ClientUsage
 

Ideally, in the future I would like to see the mobicents
DNSAddressResolver class have an empty constructor so that it can be
passed to the RA without all the extra steps.

mls

unread,
Aug 10, 2010, 9:06:50 PM8/10/10
to mobicents-public
I came across the jain-sip-rfc3263-router project on Google code as I
was looking into my issue. I tried to incorporate it by setting these
properties:

javax.sip.ROUTER_PATH=com.google.code.rfc3263.DefaultRouter
javax.sip.USE_ROUTER_FOR_ALL_URIS=true

I had to set them in both the sipra.properties and deploy-config.xml
to get it to take. After resolving a bunch of dependancy problems by
putting a lot of jars in the server/default/lib directory, it
complains about "java.lang.NoSuchFieldError: cluster". So it seems
that it doesn't work cleanly with the mobicents ha projects. I
haven't really dug into it in too much detail yet. Just curious if
anyone has tried this and if there has been any success. Would it
make more sense to try and incorporate this project instead of re-
writing the DNSAddressResolver in a future release?

On Aug 10, 4:12 am, Jean Deruelle <jean.derue...@gmail.com> wrote:
> See inline
>
> On Mon, Aug 9, 2010 at 10:48 PM, mls <laneshie...@hotmail.com> wrote:
> > I did what you guys suggested.  I copied the DNSAddressResolver class
> > to a new project with a new package and removed the
> > SipApplicationDispatcher references so that there was an empty
> > constructor.  Then I built the project, put it in a jar, and added the
> > jar to my local maven repository.  I modified the sip11ra project and
> > put the dependency in my pom.xml file.  I also modified the
> > sipra.properties file and set the gov.nist.javax.sip.ADDRESS_RESOLVER
> > property to my new classpath.  I rebuilt the RA and deployed it.  Now
> > I do see the SRV queries and that part is working.
>
> Great !
>
>  I think I just
>
> > need to manually code the logic to have it advance to the next SRV
> > entry when I get a timeout, which is something I'll have to figure out
> > how to do.
>
> Since the router and address resolver are stateless in jain sip, it might
> prove difficult.
> You may want to check out what suggests alternative router implementations
> for jain siphttp://code.google.com/p/jain-sip-rfc3263-router/wiki/ClientUsage

mls

unread,
Aug 11, 2010, 12:00:41 PM8/11/10
to mobicents-public
Jean,

I think our messages crossed because I did not see your suggestion
before I posted my post above. I will open an issue.

Have you attempted to use the RFC3261 router before? I'm just curious
if I should expect it to work or not.

If I rebuild the RA with the changes indicated above and add the jain-
sip-rfc3263-router jar file to the dependencies of the library's
pom.xml file, the RA and my application will deploy (at least if
dnsjava.jar is in the server/default/lib directory; putting it in the
RA's library doesn't seem to work). When my application gets ready to
fire off a request, the jain-sip-rfc3263-router's DefaultRouter class
kicks off an exception: "java.lang.NoClassDefFoundError: javax/sip/
address/SipURI". Seeing that this class is found in the jain-sip-
api-1.2.jar file, I put this in the server/default/lib directory.
Once I do that, though, the RA will not deploy anymore with the
following errors:

11:53:41,980 ERROR [SipResourceAdaptor] error in initializing resource
adaptor
javax.sip.PeerUnavailableException: The Peer SIP Stack:
org.mobicents.ha.javax.sip.SipStackImpl could not be instantiated.
Ensure the Path Name has been set.
...
Caused by: java.lang.ClassNotFoundException:
org.mobicents.ha.javax.sip.SipStackImpl from ...

This is and subsequent errors are what led me to put (in addition to
dnsjava.jar and jain-sip-api.jar) jain-sip-ri-1.2.153.jar, mobicents-
jain-sip-ha-core-0.7.jar, mobicents-jain-sip-jboss5-0.7.jar, and sip11-
jain-sip-ha-2.2.0-SNAPSHOT.jar in the server/default/lib directory.
That is the point where I get the "java.lang.NoSuchFieldError:
cluster" as indicated in my last message.

So, I'm not sure I understand all the mess with the dependencies. It
looks like my initial attempt with only dnsjava.jar in the lib
directory is the closest I have to working, but I'm not sure how to
rectify the issue of it not finding javax.sip.address.SipURI. Could
anyone provide me some insight into this?

Eduardo Martins

unread,
Aug 11, 2010, 12:12:50 PM8/11/10
to mobicent...@googlegroups.com
Put all the extra stuff in the RA library, it may be some class that
you have outside of SLEE that needs to use a jsip class, and that is
not seen cause it is in the RA classloader domain.

-- Eduardo

-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
http://emmartins.blogspot.com
http://www.redhat.com/solutions/telco

mls

unread,
Aug 11, 2010, 12:51:02 PM8/11/10
to mobicents-public
Is there anywhere else I need to call out the dependencies? Because I
already have all the files I would put in the lib directory in the
library, but it still isn't happy unless dnsjava is in the lib
directory.

<library-jar>
<library>
<library-name>jain-sip</library-name>
<library-vendor>javax.sip</library-vendor>
<library-version>1.2</library-version>


<jar>
<jar-name>jars/sip11-jain-sip-ha-2.2.0-SNAPSHOT.jar</jar-name>
</jar>
<jar>
<jar-name>jars/mobicents-jain-sip-ha-core-0.10.jar</jar-name>
</jar>
<jar>
<jar-name>jars/mobicents-jain-sip-jboss5-0.10.jar</jar-name>
</jar>
<jar>
<jar-name>jars/jain-sip-api-1.2.jar</jar-name>
</jar>
<jar>
<jar-name>jars/jain-sip-ri-1.2.151.jar</jar-name>
</jar>
<jar>
<jar-name>jars/sip-balancer-jar-1.0.0.FINAL.jar</jar-name>
</jar>
<jar>
<jar-name>jars/jain-sip-rfc3263-router-1.0.5.jar</jar-name>
</jar>
<jar>
<jar-name>jars/dnsjava-2.0.6.jar</jar-name>
</jar>
</library>
</library-jar>


On Aug 11, 12:12 pm, Eduardo Martins <emmart...@gmail.com> wrote:
> Put all the extra stuff in the RA library, it may be some class that
> you have outside of SLEE that needs to use a jsip class, and that is
> not seen cause it is in the RA classloader domain.
>
> -- Eduardo
>
> -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-http://emmartins.blogspot.comhttp://www.redhat.com/solutions/telco
> ...
>
> read more »

Eduardo Martins

unread,
Aug 11, 2010, 1:13:14 PM8/11/10
to mobicent...@googlegroups.com
Try a clean mobicents jain slee binary, you may have something left
deployed in the JEE domain.

-- Eduardo

-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
http://emmartins.blogspot.com
http://www.redhat.com/solutions/telco

mls

unread,
Aug 11, 2010, 2:19:04 PM8/11/10
to mobicents-public
That did it! I'm not sure what I did to my installation, but starting
with a fresh binary build of 2.1.2 and deploying my modified RA
works! Well, it's still not doing 100% what I would hope in failure
scenarios, but I think this is as close as I'm going to get. Thank
you guys for all the help!

On Aug 11, 1:13 pm, Eduardo Martins <emmart...@gmail.com> wrote:
> Try a clean mobicents jain slee binary, you may have something left
> deployed in the JEE domain.
>
> -- Eduardo
>
> -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-http://emmartins.blogspot.comhttp://www.redhat.com/solutions/telco
>
> ...
>
> read more »

Eduardo Martins

unread,
Aug 11, 2010, 2:25:32 PM8/11/10
to mobicent...@googlegroups.com
With classloading issues always remember that what is in SLEE sees all
classes in JEE domain, but the other way around is not true. If you
have something that is split between SLEE and JEE make sure that all
shared classes stay in JEE domain.

-- Eduardo

-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
http://emmartins.blogspot.com
http://www.redhat.com/solutions/telco

Reply all
Reply to author
Forward
0 new messages