<div dir="ltr"><font color="#000099"><font size="2">Thanks Bogdan,</font></font><div><font color="#000099"><font size="2">I already figure it up, I used :$var(max-reg)=$(avp(s:max-reg){<a href="http://s.int?by-user=t" target="_top" rel="nofollow" link="external">s.int</a>}); to convert the value.</font></font></div>
<div><font class="Apple-style-span" color="#000099">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?</font></div>
<div><font class="Apple-style-span" color="#000099"><br></font></div><div><font class="Apple-style-span" color="#000099">Yaniv</font></div><div><div dir="ltr"><span style="font-family:arial, sans-serif;font-size:13px"><span style="font-size:medium"><span><strong><span><span><span><span style="color:rgb(255, 153, 0)"><div>
<span style="font-family:arial, sans-serif;font-size:13px"><span style="font-size:medium"><span><strong><span><span><span><span style="color:rgb(255, 153, 0)"><br></span></span></span></span></strong></span></span></span></div>
<div><span style="font-family:arial, sans-serif;font-size:13px"><span style="font-size:medium"><span><strong><span><span><span><span style="color:rgb(255, 153, 0)"></span></span></span></span></strong></span></span></span></div>
<div><span style="font-family:arial, sans-serif;font-size:13px"><span style="font-size:medium"><span><strong><span><span><span><span style="color:rgb(255, 153, 0)"></span></span></span></span></strong></span></span></span><span style="color:rgb(0, 0, 0);font-weight:normal"><strong><span><span><span><span style="color:rgb(255, 153, 0)">Yaniv Vaknin</span></span></span></span></strong></span></div>
</span></span></span></span></strong></span></span><span style="font-size:medium"><br><span style="color:rgb(0, 0, 255)"><strong>Mobile:</strong></span> 972-524-525065<br><span style="color:rgb(0, 0, 255)"><strong>Office:</strong></span> 972-722-772299<br>
<strong><span style="color:rgb(0, 0, 255)">Email</span><a title="Yaniv@shahar-tech.com" href="http://Yaniv@shahar-tech.com/" style="color:rgb(28, 81, 168)" target="_blank" rel="nofollow" link="external">:</a></strong><a href="/user/SendEmail.jtp?type=node&node=5558395&i=0" target="_top" rel="nofollow">[hidden email]</a> <br>
<span style="color:rgb(0, 0, 255)"><strong>Site:</strong></span><a title="http://www.shahar-tech.com" href="http://www.shahar-tech.com/" style="color:rgb(28, 81, 168)" target="_blank" rel="nofollow" link="external">http://www.shahar-tech.com</a></span></span><div>
<span style="font-family:arial, sans-serif;font-size:13px"><br></span></div></div><br>
<br><br><div class="gmail_quote">On Wed, Sep 22, 2010 at 11:40 AM, Bogdan-Andrei Iancu [via OpenSIPS (Open SIP Server)] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=5558395&i=1" target="_top" rel="nofollow">[hidden email]</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Yaniv,
<br><br>Yaniv Vaknin wrote:
<div><div class='shrinkable-quote'><br>> Hi,
<br>> I'm using localcache module to store some variables, the module works great
<br>> but i noticed an issue when performing value check on the AVP's.
<br>> I'm trying to check if the value of the AVP is bigger then a value:
<br>>
<br>> if(!cache_fetch("local","a_$fd",$avp(s:a))){
<br>> avp_db_query("select `a` from table where domain='$fd'","$avp(s:a)");
<br>> cache_store("local","a_$fd","$avp(s:a)",3600)
<br>>
<br>> }else{
<br>> cache_fetch("local","a_$fd",$avp(s:a))
<br>>
</div>why do you do fetch again here? you already did it once in the "if"
</div>condition
<br>> avp_db_query("select count(*) FROM `location` WHERE `domain`= '$fd'
<br>> ","$avp(s:cur-reg);");
<br>> if(avp_check("$avp(s:cur-reg)","ge/$avp(s:a)")){
<br>>
<br>replace this with the much straight forward:
<br> if ( $avp(s:cur-reg) >= $avp(s:a) ) {
<br><br>But note that the values must be INT to compare. The avp_db_query()
<br>return STR all the time, so you might use some transformation to convert
<br>to int :
<br> if ( $(avp(s:cur-reg){<a href="http://s.int?by-user=t" target="_blank" rel="nofollow" link="external">s.int</a>}) >= $(avp(s:a){<a href="http://s.int?by-user=t" target="_blank" rel="nofollow" link="external">s.int</a>}) ) {
<br><br>Regards,
<br>Bogdan
<br><div><div class='shrinkable-quote'><br>> On the first time that I run the check, everything works fine, but on the
<br>> second time, when the server uses the cache_fetch value the avp_check fails
<br>> (give the wrong result)
<br>> I tried setting the avp to int and also played with the avp_check command
<br>> (add /g or /i to the command), I even tried :
<br>> if($avp(s:cur-reg) > $avp(s:a))
<br>> But the result is always the same, I guess that I'm doing something the
<br>> wrong way, but I can't figure what...
<br>> the version I'm using is 1.6.2...
<br>>
<br>> Thanks,
<br>> Yaniv Vaknin
<br>>
</div></div><br>--
<br>Bogdan-Andrei Iancu
<br>OpenSIPS Bootcamp
<br>15 - 19 November 2010, Edison, New Jersey, USA
<br><a href="http://www.voice-system.ro?by-user=t" target="_blank" rel="nofollow" link="external">www.voice-system.ro</a>
<br><br><br>_______________________________________________
<br>Users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=5558338&i=0" rel="nofollow" target="_blank" link="external">[hidden email]</a>
<br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br><br>
<hr noshade size="1" color="#cccccc">
<div style="color:#666666;font:11px tahoma,geneva,helvetica,arial,sans-serif">
View message @ <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/Localcache-issue-tp5523216p5558338.html?by-user=t" target="_blank" rel="nofollow" link="external">http://opensips-open-sip-server.1449251.n2.nabble.com/Localcache-issue-tp5523216p5558338.html</a>
<br>To unsubscribe from Localcache issue, <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=5523216&code=eWFuaXZAc2hhaGFyLXRlY2guY29tfDU1MjMyMTZ8MTMzOTg4MDAzMg==&by-user=t" target="_blank" rel="nofollow" link="external">click here</a>.
</div>
<br>
</blockquote></div><br></div></div>
<br><hr align="left" width="300">
View this message in context: <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/Localcache-issue-tp5523216p5558395.html">Re: Localcache issue</a><br>
Sent from the <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/OpenSIPS-Users-f1449235.html">OpenSIPS - Users mailing list archive</a> at Nabble.com.<br>