[Freeswitch-users] Lua scripts

Chad Phillips chad at apartmentlines.com
Fri May 20 17:51:55 MSD 2016


Lua syntax doesn't require lines to be terminated with a semicolon. it also
doesn't require conditionals to be wrapped in parenthesis. however, i don't
believe either of those would result in a syntax error.

i have, on rare occasions, gotten bitten by weird special (and i assume
non-visual) characters when i've copy/pasted some code. often hand typing
it, or first copying it into a very basic text editor first have solved the
problem.

On Thu, May 19, 2016 at 9:07 AM, Nduwayezu, Joselyne <35633 at heb.be> wrote:

> I did as you said but i still have the syntax erroe on the second line:
> *session:setHangupHook("*onHangup","rien").
>
>
> NDUWAYEZU Joselyne
>
> 2016-05-17 18:33 GMT+02:00 Jude Mukundane <jude19love at gmail.com>:
>
>> Hello Joselyne,
>>
>> try this. it works for me:
>>
>>
>>
>>
>>
>> *session:answer()session:setHangupHook("onHangup","rien")if
>> (session:ready()) then*
>>
>> just replace your first two lines with the above and try.
>>
>> good luck!
>>
>> Jude Mukundane
>>
>> On Tue, May 17, 2016 at 4:58 PM, Nduwayezu, Joselyne <35633 at heb.be>
>> wrote:
>>
>>> Hello i use this lua script tha i found on freeswitch wiki
>>> But when i run it i have the errors:
>>> syntax error near unexpected token ;
>>> seesion.answer();
>>>
>>> and when i remove the ";" i have the error on the while loop, syntax
>>> error near the unexpected token ==, while (session:ready() == true.
>>>
>>> I there something i did not conigure in order the script to work? do we
>>> put ";" after an instructtion like session:answer() or not.
>>>
>>> Thank you or your reply.
>>>
>>> session:answer();
>>> while (session:ready() == true) do
>>>     session:setAutoHangup(false);
>>>     session:set_tts_params("flite", "kal");
>>>     session:speak("Welcome. Welcome to the VoIp World!. this is a Blind
>>> Users Programing Community. powered by Freeswitch, the free / ultimate PBX.
>>> thank to toni!");
>>>     session:sleep(100);
>>>     session:speak("please select an Action.");
>>>     session:sleep(100);
>>>     session:speak("to call the conference, press 1");
>>>     session:sleep(100);
>>>     session:speak("to call Freeswitch IVR, press 2");
>>>     session:sleep(100);
>>>     session:speak("to call Voice Mail, press 3");
>>>     session:sleep(100);
>>>     session:speak("for Music on hold, press 4");
>>>     session:sleep(100);
>>>     session:speak("to call me, press 0");
>>>     session:sleep(3000);
>>>     digits = session:getDigits(1, "", 3000);
>>>     if (digits == "1")  then
>>>         session:execute("transfer","9888");
>>>     end
>>>     if (digits == "2")  then
>>>         session:execute("transfer","5000");
>>>     end
>>>     if (digits == "3")  then
>>>         session:execute("transfer","4000");
>>>     end
>>>     if (digits == "4")  then
>>>         session:execute("transfer","9999");
>>>     end
>>>     if (digits == "0")  then
>>>         session:execute("transfer","voipaware at sip.voipuser.org");
>>>     end
>>> end
>>>
>>>
>>>
>>>
>>> NDUWAYEZU Joselyne
>>>
>>> Haute École de Bruxelles
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.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
>>> http://www.freeswitch.org
>>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.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
>> http://www.freeswitch.org
>>
>
>
> Haute École de Bruxelles
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.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
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160520/f18b53fe/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list