[Users] comparing an avp to a null value

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Apr 7 10:32:26 CEST 2006


Hi Tavis,

for empty values ,the pseudo variables returns "NULL" for strings and 0 
for integers. you should try to check against these values.

regards,
bogdan

Tavis P wrote:

>I've been trying to make a comparison, using avp_check, between a pseudo
>variable (copied to an avp) and a null value (which is a valid state for
>some pseudo varibles currently)
>I havn't had any luck in being able to determine if an avp is null short
>of using a regex (which i try to avoid) so i thought i would mention
>this here, perhaps this functionality may be seen as useful to others or
>simply useful in general (tm)
>
>
>Here is a quick example of what i'm currently doing
>----
># Store the destination IP into an AVP
>avp_printf("i:450", "$dd"); In this case, $dd is null because the
>destination set contains a domain for this branch
>avp_printf("i:451", "$si");
>
>if ( avp_check("i:450", "re/^.{0,0}$/g") )
>{
>    xlog("L_WARN", "[$fU] Route{4}: AVP I:450 was empty");
>}
>----
>
>
>I think it was probably thought that an avp should never have a null
>value therefor there was no logic added to any of the functions used to
>check/print/write avps which allowed for the creation/evaluation of
>NULL, however it would be advantageous in the least to include this
>functionality somewhere (other than regex matches)
>
>a few things that i've tried, that were no successful
>----
># Store the destination IP into an AVP
>avp_printf("i:450", "$dd");
>avp_printf("i:451", "$si");
>avp_printf("i:452", ""); This will break script compilation
>avp_write("i:452", ""); This will break script compilation
>avp_write("i:452", "s:"); This will break script compilation
>
>if ( avp_check("i:450", "eq//g") )
>{
>    xlog("L_WARN", "[$fU] Route{4}: AVP I:450 was empty");
>}
>
>if ( avp_check("i:450", "eq/0x/g") )
>{
>    xlog("L_WARN", "[$fU] Route{4}: AVP I:450 was empty");
>}
>
>if ( avp_check("i:450", "eq/i:452/g") )
>{
>    xlog("L_WARN", "[$fU] Route{4}: AVP I:450 was empty");
>}
>----
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>  
>





More information about the Users mailing list