[OpenSER-Users] Unable to do transformation on expires param if display name present

Robert Dyck rob.dyck at telus.net
Tue May 20 07:41:41 CEST 2008


I am currently using 1.3.2 but this problem exists in older versions as well.

My config script includes a transformation on the expires parameter in a 
Contact header. I have found that a Linksys SPA3000 will include the display 
name in the Contact header and that there is white space between the display 
name and the URI. The function parse_param_name in parse_param.c will stop 
parsing when it encounters the white space.

As a workaround I commented the line in parse_param_name that checks for white 
space. This works for me but I do not know if there are side effects.

This form of Contact is not common but it appears to be legal according to RFC 
3261.
20.10 Contact  
 A Contact header field value provides a URI whose meaning depends on the type 
of request or response it is in. 
 A Contact header field value can contain a display name, a URI with URI 
parameters, and header parameters. 
 This document defines the Contact parameters "q" and "expires". These 
parameters are only used when the Contact is present in a REGISTER request or 
response, or in a 3xx response. Additional parameters may be defined in other 
specifications. 
 When the header field value contains a display name, the URI including all 
URI parameters is enclosed in "<" and ">". If no "<" and ">" are present, all 
parameters after the URI are header parameters, not URI parameters. The 
display name can be tokens, or a quoted string, if a larger character set is 
desired. 
 Even if the "display-name" is empty, the "name-addr" form MUST be used if 
the "addr-spec" contains a comma, semicolon, or question mark. There may or 
may not be LWS between the display-name and the "<". 

Here is an excerpt from my script --
                        if ((is_present_hf("Expires") && $(hdr(Expires)
{s.int}) == 0)\
                         ||($(ct{param.value,expires}) == '0'))
                                {
                                log(1, "looks like deregistration\n");

I added some debug messages to illustrate the problem --

May 19 22:16:32 [14447] DBG:core:parse_param_name: string passed to 
parse_param_name is RJD <sip:17476316719 at 192.168.1.4:5061>;expires=3600
May 19 22:16:32 [14447] DBG:core:parse_param_name: next char is R
May 19 22:16:32 [14447] DBG:core:parse_param_name: next char is J
May 19 22:16:32 [14447] DBG:core:parse_param_name: next char is D
May 19 22:16:32 [14447] DBG:core:parse_param_name: next char is
May 19 22:16:32 [14447] ERROR:core:parse_params: invalid character, ; expected
May 19 22:16:32 [14447] DBG:core:run_transformations: return val is -1
May 19 22:16:32 [14447] CRITICAL:core:comp_scriptvar: cannot get left var 
value
May 19 22:16:32 [14447] WARNING:core:do_action: error in expression




More information about the Users mailing list