Greetings,
I have a Contact URI with params as in the following form returned to me in a 302 Moved Temporarily reply:
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. I have tried:
if(! $(var(dest){param.value,b}))
which clearly cannot work as the parameter has no _value_.
Also have tried:
if(!defined $(var(dest){param.value,b}))
and also tests of strempty(), !defined, etc. for $var(dest){uri.param,b}) (prior to extraction of param list using {uri.user} above).
Ideas appreciated, thanks!
On 06/28/2010 06:54 AM, Alex Balashov wrote:
I am able to check the existence of parameters 'a' and 'b', which have values assigned to them, in the following way:
I meant 'a' and 'c', sorry.
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
2010/6/28 Timo Reimann timo.reimann@1und1.de:
One quite hackish (and untested) approach could be to iterate over all {param.count} parameters and see if any {param.name,INDEX} matches "b".
RR module does such inspection internally (not at script level of course) when inspecting if ";lr" parameter is present into Route header.
2010/6/28 Alex Balashov abalashov@evaristesys.com:
if(! $(var(dest){param.value,b}))
which clearly cannot work as the parameter has no _value_.
There should be a function like:
$(var(dest){has_param,b})
On Jun 28, 2010, at 7:12 AM, Iñaki Baz Castillo ibc@aliax.net wrote:
2010/6/28 Alex Balashov abalashov@evaristesys.com:
if(! $(var(dest){param.value,b}))
which clearly cannot work as the parameter has no _value_.
There should be a function like:
$(var(dest){has_param,b})
I could not agree more. :-)