On Sun, Dec 6, 2020 at 3:42 AM Joli Martinez <mrjoli021@gmail.com> wrote:
Hello,

It is not a permissions issue.  I have changed the permissions to rw for everyone and it will still not read the file.  

The password.json file is in the same directory as the script /usr/share/freeswitch/script.  I am using lua 5.2.3 and again, the same code works in my home directory.  I just copied the password.json file over and pasted the function into my code.  When I place the call freeswitch prints "Inside the function", so I know it gets there, but then freeswitch spits out  "attempt to index local 'file' (a nil value)"

What else could I be missing?
 
Hi, 
when I check the current folder inside the fs cli I get:

freeswitch@lab002> system pwd
/

So, if you use:

f = "password.json"
local file = io.open(f, "r")

freeswitch would try to open "/password.json"
So I think you should pass the full file path:
f = "/usr/share/freeswitch/script/password.json"