[SR-Users] Check for existence of URI param

Timo Reimann timo.reimann at 1und1.de
Mon Jun 28 13:04:43 CEST 2010


Hey,


Alex Balashov wrote:
> I have a Contact URI with params as in the following form returned to me
> in a 302 Moved Temporarily reply:
> 
>     <sip:a=foo;b;c=bar>
> 
> I am able to check the existence of parameters 'a' and 'b', which have
> values assigned to them, in the following way:
> 
>     failure_route[...] {
>             ...
>             $var(dest) = $T_rpl($ct);
>             $var(dest) = $(var(dest){nameaddr.uri});
>             $var(dest) = $(var(dest){uri.user});
>             ...
>             if(! $(var(dest){param.value,a})) {
>                     ....
>             }
>             ...
>     }
> 
> However, what I cannot seem to figure out is a reliable test condition
> for the existence of a parameter like 'b', which does not have a value. 

One quite hackish (and untested) approach could be to iterate over all
{param.count} parameters and see if any {param.name,INDEX} matches "b".


Cheers,

--Timo



More information about the sr-users mailing list