[Freeswitch-users] lua script not calling external script on Freeswitch

Joli Martinez mrjoli021 at gmail.com
Tue Sep 17 14:34:51 UTC 2019


I am running fusionPBX and I have upgrade the freeswitch to the latest
version they recommended.  All permissions on the
/usr/share/freeswitch/script directory are set to www-data as the owner and
group.

When I run my script through the API I am getting now a syntax error on the
python script which I don't get when I run it manually.
I am running the API with the command:
luarun sendjson.py param1 param2 param3


2019-09-17 14:25:29.557353 [ERR] mod_lua.cpp:203
/usr/share/freeswitch/scripts/sendjson.py:3: syntax error near 'requests'

the python script just imports requests which again doesn't have an issue
running the script through the linux cli

#!/usr/bin/python

import requests
import sys


FYI my bash script which ultimately what I need to run also fails

2019-09-17 14:31:16.677352 [ERR] mod_lua.cpp:203
/usr/share/freeswitch/scripts/callStats.sh:3: unexpected symbol near '$'
#!/bin/bash

calling=$1
called=$2
ip=$3
LOGFILE=/var/log/test.log



On Tue, Sep 17, 2019 at 1:16 AM Babak Yakhchali <babak.freeswitch at gmail.com>
wrote:

> can you try executing it through freeswitch api?
> api = freeswitch.API();
> reply = api:executeString("luarun yourscript.lua");
>
> On Tue, Sep 17, 2019 at 6:49 AM Abaci B <abaci64 at gmail.com> wrote:
>
>> Any chance that it's a permission issue, possibly freeswitch running as a
>> user that doesn't have the required permission to run the script.
>> I also see that MIke Jerris told you to try with an upgraded FreeSWITCH
>> as you're running a really old version, did you try that already?
>>
>> On Mon, Sep 16, 2019 at 8:22 PM Joli Martinez <mrjoli021 at gmail.com>
>> wrote:
>>
>>> I have a Lua script that calls via os.execute another script.  I have
>>> copied both scripts to /usr/share/freeswitch/scripts and gave them the
>>> proper permissions.  When I run lua script on the linux cli it calls the
>>> other script successfully, but when FreeSwitch Calls the script it does not
>>> call my second script.  The script that I am trying to use is an old bash
>>> script that was written to get statical data.  I pass it some parameters
>>> from the calls and it crunches and does it thing in the background.  I
>>> thought it was an issue with the batch script and I wrote a simple python
>>> script and called it the same way with os.execute.  gave it the same
>>> parameters and had Python print them out.  Again, on the linux cli it
>>> prints without any issue, but when the script gets called from Freeswitch
>>> it does not run.
>>>
>>> Any Ideas why?
>>>
>>>
>>>
>>> _________________________________________________________________________
>>>
>>> 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 at 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 at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> https://freeswitch.com
>>
>> _________________________________________________________________________
>>
>> 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 at 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 at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> https://freeswitch.com
>
> _________________________________________________________________________
>
> 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20190917/1361d3a3/attachment.html>


More information about the FreeSWITCH-users mailing list