Parameterable Headers in SailFin

Headers which have "field-name: field-value \*(;parameter-name=parameter-value)" have a direct support for manipulating headers in JSR 289 and referred as Parameterable Headers. javax.servlet.sip.Parameterable interface defines the contract for Parameterable header, javax.servlet.sip.SipFactory.createParameterable(String) helps in creating a Parameterable and javax.servlet.sip.ServletMessage getters and setters helps in adding and retrieves headers in Parameterable form.

According to the JSR 289, a Parameterable header should be interpreted as "field-value \*(;parameter-name[=parameter-value])"
where the field-value may be in name-addr or addr-spec format as defined in RFC 3261 or may be any sequence of tokens till the first semicolon.

With the above interpretation, almost all the headers would be qualified as Parameterable headers, and there is away to create Parameterable but then there is a restriction while adding the created Parameterable to the message as the JSR 289 disallows any header, whose form is not the form in its BNF.


SipServletMessage.addParameterableHeader(..)
java.lang.IllegalArgumentException - if the specified header is not defined to hold Parameterable values or if the specified header field is a system header

With this the implementation is in a tricky situation and it has to know before hand, what are all the headers which have Parameterable header form, if not for the extension headers, this task is not overly complex. Since some of the extension headers defined by other RFCs might have Parameterable form, there should be a way of extending the list of headers, which takes Parameterable form.

SailFin's Parameterable implementation has been extended so that there is a configurable way of allowing any header to be added to SipServletMessage as a Parameterable. Two system properties which effect this behaviour are:
1) org.glassfish.sip.parameterablecheck : This property can be set to to false to allow any header name to be added to the message as a Parameterable as long as it follows Parameterable's BNF.

Example, the domain.xml:
-Dorg.glassfish.sip.parameterablecheck=false

2) org.glassfish.sip.parameterablelist : This property can be used to specify the explicit list of header names to be considered as Parameterable headers. Union of predefined Parameterable headers as specified in the 4.2.1 of the JSR 289 spec
and this list will be considered as the list of Parameterable headers.

Example, in the domain.xml:
-Dorg.glassfish.sip.parameterablelist=Header1,Header2

We hope, predefined parameterable headers are good enough for most users and where it is not sufficient, above mechanism can be used.

Comments:

Hi,

In my app' I would like to set 'tag' value to the 'To' header for a message like this,

MESSAGE sip:1500331@foo.inc SIP/2.0
Max-Forwards: 10
Content-Length: 2
To: <sip:1500331@foo.inc>
Cseq: 6 MESSAGE
User-Agent: Purple/2.5.2
Via: SIP/2.0/TCP 129.158.230.98:5062;branch=z9hG4bKCFB859BA8C9FADCB5B94;received=127.0.0.1
Content-Type: text/plain
Call-Id: 0459g69A6a565CiF50Fm25F3tC297b25D5xCD84x
From: <sip:1500100@foo.inc>;tag=3614144000;epid=1234567890

-------------------------------------
Just like 'From' header. With the above mentioned vm params on sailfin build # b60b-nightly-05_dec_2008 my app' suffer an IllegalArgumentException. My code is like ths,

Parameterable np = factory.createParameterable(req.getTo().toString());
np.setParameter("tag", "suneel-tag1");
req.setParameterableHeader("To", np);

According to Sip spec' UAS must set the tag value. How could I do this.

Posted by Suneel on December 09, 2008 at 09:06 AM IST #

Suneel,

Sorry for the delay in response.
To is a system header and according to JSR 289, system headers can not be modified. Also you don't need to add tag to To, container manages this on its own.

Posted by Sankara Rao Bhogi on December 24, 2008 at 06:20 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

bsankararao

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today