JAIN-SIP support for RFC 7339

210 views Asked by At

Is there any way to add custom via header in jain-sip? Adding the oc-parametrs from RFC 7339.
From enter link description hereplace I got the following example, but not sure if it will work. The quote from link:

This could be easily achieved by adding some code to implementation of javax.sip.message.Message.addHeader(Header header) function.

void addHeader(Header header) {
    if(!(header instanceof InternalHeaderObject)
        && header instanceof ExtensionHeader) {
            ExtensionHeader extensionHeader = (ExtensionHeader) header;
            header = headerFactory.createHeader(extensionHeader.getName(), extensionHeader.getValue());
        }
    ...
}
1

There are 1 answers

3
Vladimir Ralev On BEST ANSWER

I will start by saying you can absolutely handle custom via headers in terms of SIP as long as it is valid SIP. For this RFC you just need to use viaHeader.set/getParameter if I am not missing something.

The blog post talks about creating your own header classes, which is not relevant to your needs as far as I can imagine. Custom header classes are tricky and inefficient. For example JAIN SIP will automatically construct it's own ViaHeader instance for inbound messages when parsing them. Plugging a custom header to override the default Via internally will break a lot of validation promises and cause overhead..

If you have a showstopper case for custom header classes I will gladly listen though.