Hello,

The file permissions are set to rw-r--r-- www-data:www-data same as every other file in the scripts directory.

Thanks,

On Fri, Dec 4, 2020 at 5:02 PM Brian West <brian@freeswitch.com> wrote:
check permissions of the file.

On Fri, Dec 4, 2020 at 2:36 PM Joli Martinez <mrjoli021@gmail.com> wrote:
Hello,

I have the following function that works normally on lua, but when I copied and pasted it into my freeswitch lua script, the file wont open.  I am trying to put the passwords I use in a json format outside the script, so that I can share the script.  I have installed the correct libraries for lunajson to work.  
Any suggestions?


--Reads json file and parses it
function returnJson(option)
    freeswitch.consoleLog("INFO", "Inside function\n")

    local file = io.open("password.json", "r")
    if not file then 
      return nil
    end
    local jsonString = file:read("*a")
    
    freeswitch.consoleLog("INFO", "File is open\n")
    file:close()
    jsonResult = lunajson.decode( jsonString )
    freeswitch.consoleLog("INFO", "Parsing json\n")
    return ( jsonResult[option] )
end

--SID = returnJson("SID")
--Token = returnJson("TOKEN")
------------------------------------------------------------------------------------------------------------

2020-12-04 14:38:13.637108 [ERR] mod_lua.cpp:203 /usr/share/freeswitch/scripts/test.lua:67: attempt to concatenate global 'SID' (a nil value)

stack traceback:

/usr/share/freeswitch/scripts/test.lua:67: in main chunk

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com


--

Brian West | Co-founder and Developer

Need Commercial support? email sales@freeswitch.com

FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045

Email: brian@freeswitch.com

Mobile: 918-424-9378

Website: https://www.FreeSWITCH.com

https://www.facebook.com/signalwireinc?src=email https://twitter.com/freeswitch

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com