[OpenSIPS-Users] Help with transformation.

Richard Revels rrevels at bandwidth.com
Sat Sep 13 03:01:20 CEST 2008


if( is_avp_set( "$avp(s:test)/s") )

Should do what you are looking for.

With a little change to the way you have stashed the data in your  
table you could probably use avp_db_load and get user variables rather  
than just a unique id.  For instance with the name you are looking for  
in the username column and the attribute set to 'local_only' and the  
value set to 't' you could do

avp_db_load("$rU/username", "a");
if( is_avp_set( "$avp(s:local_only)/s") )
{
	if( avp_check("$avp(s:local_only)", "eq/s:t") )
		xlog("L_INFO", "This user only allowed to make local calls");
}

If you still needed to get the value for a unique id you could add  
that as a row in the table with attribute set to "uuid" and value set  
to "someid".  This would then be available as an avp named $avp(s:uuid).

Richard Revels



On Sep 12, 2008, at 7:28 PM, Sergio Gutierrez wrote:

> Hello everybody.
>
> I have a routing block with the following commands:
>
>         avp_db_query("select uuid from usr_preferences where value =  
> '$rU'", "$avp(s:test)");
>
>         if($(avp(s:test){s.len}) != 0)
>         {
>                 xlog("L_INFO", "found\n");
>                 setflag(4);
>         }
>         else
>         {
>                 xlog("L_INFO", "not found\n");
>         };
>
>         avp_delete("$avp(s:test)/g");
>
> When query returns 0 rows, this error appears in log:
>
> Sep 12 17:24:11 [663] CRITICAL:core:comp_scriptvar: cannot get left  
> var value.
>
> Is there a way to avoid it?
>
> Thanks in advance for your help and attention.
>
> Kind Regards.
>
> Sergio Gutiérrez.
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list