[OpenSIPS-Users] problem with $avp pulled from local db cache

Richard Robson rrobson at greenlightcrm.com
Wed Aug 10 18:07:51 CEST 2016


Ok,

I've solved this.

The problem was the dbcache had stored or fetched the 
$avp(customerratelimit) as string and the rl_limit function was 
expecting an int.
If I cast the asp to an int $(avp(customerratelimit){s.int}) it works 
fine with the fetched value.

I had made the assumption that the dbcaching would leave the value with 
the same type.
Regards,

Richard


On 10/08/2016 12:05, Richard Robson wrote:
> Hi All,
>
> I'm using  the local dbcache to record an accountcode password and two 
> variables. these are used for authentoiaction and rate and channe 
> limiting the customer.
>
>
> the account code is a 4 digit number e.g. 0001
>
> this authenticates correctly in the auth_db and auth modules. (its 
> chached after the first attempt)
>
> once authenticated the accountcode is uses as a ratelimit pipe, which 
> is working fine after the auth_db, when  the values are cached in the 
> local cache.
>
> on a subsequent call the cached credentials are there and are pulled 
> from the cache and the pv_proxy_auth passes. this is then ratelimited 
> (with the same code block) but here we get an error.
>
> rl_check("$avp(accountcode)", "$avp(customerratelimit)", "TAILDROP")
>
> ERROR:core:fixup_get_ivalue: no valid PV value found (error in scripts)
> ERROR:ratelimit:w_rl_check_3: cannot retrieve limit
>
> I suspect that the avp that is being used is casting the value somehow 
> ans the ratelimit is not recognising the value, but i'm logging the 
> avp and it show 0001 in both cases.
>
> [relay_customer] Account code: 0001 -  Channel Limit: 20 - ratelimit: 10
>
> xlog("[relay_customer] Account code: $avp(accountcode) -  Channel 
> Limit: $avp(customerchannellimit) -  ratelimit: 
> $avp(customerratelimit)");
>
> this is the fetch:
>
> cache_fetch("local","username_$si",$avp(accountcode)
>
> this is the  store:
>
> cache_store("local","username_$si","$avp(accountcode)",1200)
>
> here the avp is in quotes in one and not the other, which may be the 
> problem but the script fails when the quotes are added to the fetch or 
> removed from the store.
>
>
> version 2.2.1
>
>
>


-- 
Richard Robson
Greenlight Support
01382 843843
support at greenlightcrm.com




More information about the Users mailing list