[OpenSIPS-Users] Localcache issue

Yaniv Vaknin yaniv at shahar-tech.com
Wed Sep 22 12:07:02 CEST 2010


Thanks Bogdan,
I already figure it up, I used :$var(max-reg)=$(avp(s:max-reg){s.int}); to
convert the value.
But this issue is still weird, how come when the first use the AVP, the
function works, but on the next time, when I'm getting the value from the
cache, the function fails and I need to convert the values?

Yaniv
*

 Yaniv Vaknin
*
*Mobile:* 972-524-525065
*Office:* 972-722-772299
*Email: <http://Yaniv@shahar-tech.com/>*Yaniv at Shahar-tech.com<Yaniv at shahar-tech.com>

*Site:*http://www.shahar-tech.com




On Wed, Sep 22, 2010 at 11:40 AM, Bogdan-Andrei Iancu [via OpenSIPS (Open
SIP Server)] <ml-node+5558338-1859823343-280679 at n2.nabble.com<ml-node%2B5558338-1859823343-280679 at n2.nabble.com>
> wrote:

> Hi Yaniv,
>
> Yaniv Vaknin wrote:
>
> > Hi,
> > I'm using localcache module to store some variables, the module works
> great
> > but i noticed an issue when performing value check on the AVP's.
> > I'm trying to check if the value of the AVP is bigger then a value:
> >
> > if(!cache_fetch("local","a_$fd",$avp(s:a))){
> > avp_db_query("select `a` from table where domain='$fd'","$avp(s:a)");
> > cache_store("local","a_$fd","$avp(s:a)",3600)
> >
> > }else{
> > cache_fetch("local","a_$fd",$avp(s:a))
> >
> why do you do fetch again here? you already did it once in the "if"
> condition
> > avp_db_query("select count(*)  FROM `location` WHERE `domain`= '$fd'
> > ","$avp(s:cur-reg);");
> > if(avp_check("$avp(s:cur-reg)","ge/$avp(s:a)")){
> >
> replace this with the much straight forward:
>        if ( $avp(s:cur-reg) >= $avp(s:a) ) {
>
> But note that the values must be INT to compare. The avp_db_query()
> return STR all the time, so you might use some transformation to convert
> to int :
>        if ( $(avp(s:cur-reg){s.int}) >= $(avp(s:a){s.int}) ) {
>
> Regards,
> Bogdan
>
> > On the first time that I run the check, everything works fine, but on the
>
> > second time, when the server uses the cache_fetch value the avp_check
> fails
> > (give the wrong result)
> > I tried setting the avp to int and also played with the avp_check command
>
> > (add /g or /i to the command), I even tried :
> >  if($avp(s:cur-reg) > $avp(s:a))
> > But the result is always the same, I guess that I'm doing something the
> > wrong way, but I can't figure what...
> > the version I'm using is 1.6.2...
> >
> > Thanks,
> > Yaniv Vaknin
> >
>
>
> --
> Bogdan-Andrei Iancu
> OpenSIPS Bootcamp
> 15 - 19 November 2010, Edison, New Jersey, USA
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5558338&i=0>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ------------------------------
>  View message @
> http://opensips-open-sip-server.1449251.n2.nabble.com/Localcache-issue-tp5523216p5558338.html
> To unsubscribe from Localcache issue, click here<http://opensips-open-sip-server.1449251.n2.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=5523216&code=eWFuaXZAc2hhaGFyLXRlY2guY29tfDU1MjMyMTZ8MTMzOTg4MDAzMg==>.
>
>
>

-- 
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Localcache-issue-tp5523216p5558395.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100922/15845ffe/attachment.htm 


More information about the Users mailing list