[reSIProcate] Headers with nothing but parameters? Multiple of the same parameter?

John Gregg jgregg at aylus.com
Thu May 29 17:03:00 CDT 2014


RFC 3455 talks about things that look like this:

P-Charging-Function-Addresses: ccf=192.1.1.1; ccf=192.1.1.2; 
ecf=192.1.1.3; ecf=192.1.1.4

Note two things: first, there is no value separate from the parameters 
(i.e. it starts out with parameters right off the bat), and second, 
there are two instances of each parameter. I have found that if I define 
things like this in the appropriate places:

defineHeader(PChargingFunctionAddresses, 
"P-Charging-Function-Addresses", Token, "RFC 3455");

defineParam(ccf, "ccf", DataParameter, Token, "RFC 3455"); // 
P-Charging-Function-Addresses
defineParam(ecf, "ecf", DataParameter, Token, "RFC 3455"); // 
P-Charging-Function-Addresses

I get the following problems. First, because presumably the first ccf is 
parsed as the "value" and not a parameter, the ccf parameter is set to 
the second value, 
"192.1.1.2"(sipMsg->header(h_PChargingFunctionAddresses).param(p_ccf).c_str()).

Second, the ecf does not have this problem, but for ecf, it looks like 
the first one wins, and the second value is discarded, so 
sipMsg->header(h_PChargingFunctionAddresses).param(p_ecf).c_str() ends 
up being "192.1.1.3". Looking at the code, it seems that the second 
parameter is not actually discarded, the param() method only returns the 
first one it sees because it uses getParameterByEnum(). Maybe param() 
should take another argument, n, defaulted to 0, to return the nth 
instance of the parameter? I guess exists() would have to similarly take 
the new n argument.

Anyway, that is my proposed solution to problem 2 (can't see subsequent 
instances of parameters). Maybe I'll prototype it up unless someone 
thinks it's a bad idea. I don't know what the solution to problem 1 
would look like (first parameter does not show up as a parameter if 
there is no "value" first).

Is there any way I should be handling things like 
P-Charging-Function-Addresses in such a way that I have access to both 
ccf parameters and both ecf parameters from my app?

Thanks,

-John Gregg




More information about the resiprocate-devel mailing list