[OpenSIPS-Users] Finding value-less URI parameters

Saúl Ibarra Corretgé saul at ag-projects.com
Tue Mar 20 10:37:49 CET 2012


Hi,

I managed to solve it as follows:

if ($(ct.fields(uri){uri.params}) != "" && $(ct.fields(uri){uri.params}{param.exist,gr}) == 1) {
    # Contact is a GRUU, do stuff
    ....
} else {
    # Contact is not a GRUU, fix it
    ....
}

I had to use that compound test because apparently the param.exist transformation doesn't like getting an empty parameter list as input, which happens in case the Contact URI didn't have any parameters. Should we consider that a bug?


Thanks,

On Mar 19, 2012, at 7:07 PM, Saúl Ibarra Corretgé wrote:

> Hi,
> 
> I'm trying to find a way to check if a URI has a given parameter, which may or may not have a value. The use case at hand is GRUU: a public GRUU looks like this sip:saul at ag-projects.com;gr=jhf34fhio34f0934jf and a temporary GRUU looks as follows: sip:jhfr9843h09fh3f at 1.2.3.4:5060;gr
> 
> I want to check if a Contact header has the 'gr' parameter (not interested in the value), but I'm having some trouble. So far I tested this:
> 
> $avp(gruu_parameter) := $(ct.fields(uri){uri.param,gr});
> 
> But apparently the AVP is set to the empty string both if the parameter has no value or the parameter doesn't exist. I thought that in case it didn't exist it would return null, but I may not be remembering correctly :-S
> 
> Any ideas?
> 
> 
> Regards,
> 
> --
> Saúl Ibarra Corretgé
> AG Projects
> 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

--
Saúl Ibarra Corretgé
AG Projects






More information about the Users mailing list