[sr-dev] Lua sr.pv.get and htable pv problem

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 1 17:49:17 CET 2013


Hello,

On 3/1/13 3:40 PM, Jasmin Schnatterbeck wrote:
> Hi,
>
> when using sr.pv.get() in app_lua the pv value is not always returned.
>
> Lua code is:
>
> local fscript = sr.pv.get("$(sht(myscripts=>" .. args["filterid"]  
> .."))")
>
>     if(fscript) then
>         sr.log("info","Filterscript is " .. fscript)
>     else
>         sr.log("warn","fscript not found!")
>     end
>
>
> And log shows:
>
> app_lua [app_lua_sr.c:888]: pv get: (sht(myscripts=>1))
>  <core> [pvapi.c:318]: pvar [$(sht(myscripts=>1))] found in cache
> WARNING: app_lua [app_lua_sr.c:99]: fscript not found!
>
> So the pv is being discovered in the pv cache, but sr.pv.get() returns 
> no value.
>
> I think the problem occurs especially in the case, when using 
> sht_reload mi command. So I have had a short look into htable.c and I 
> did not find any code, that clears the pv cache... is that 
> necessary/may the reason for the problem, that pv is found in pv cache 
> but nothing returned? (kamailio 3.2.3)
>
> Thanks for any ideas...
the cache is for PV names, not for PV values. What is printed as value 
of fscript anyhow? It might get 0 which will result in same logic with IF.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -




More information about the sr-dev mailing list