how to run Lua commands in freeswitch?
i have created the file named "helloworld.lua" like this: session:answer(); session:streamFile("blah.wav"); session:hangup(); and it working correctly, **now i want to use lua command -not freeswitch command -in lua for example run: op='+' if op == "+" then r = a + b elseif op == "-" then r = a - b elseif op == "*" then r = a*b elseif op == "/" then r = a/b else error("invalid operation") end but how can do that? thanks alot
Thats a very good question, let me show you how you can do it. session:answer(); session:streamFile("blah.wav"); op='+' if op == "+" then r = a + b session:streamFile("finally-I-did-this.wav"); elseif op == "-" then r = a - b session:streamFile("It-was-vry-difficult.wav"); elseif op == "*" then r = a*b session:streamFile("just-kidding.wav"); elseif op == "/" then r = a/b session:streamFile("only-took-5-hrs-for-this.wav"); else error("invalid operation") end session:hangup(); But whatever you want to do if it requires you to include some header/library on top don't forget to add it. Regards, Sammy Go. On Tue, May 29, 2012 at 2:38 PM, Samira Mh <saami_mh@ymail.com> wrote:
i have created the file named "helloworld.lua" like this: session:answer(); session:streamFile("blah.wav"); session:hangup(); and it working correctly, **now i want to use lua command -not freeswitch command -in lua for example run:
op='+'
if op == "+" then r = a + b elseif op == "-" then r = a - b elseif op == "*" then r = a*b elseif op == "/" then r = a/b else error("invalid operation") end
but how can do that?
thanks alot
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
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 http://www.freeswitch.org
hi SamyGo, thanks for your help, it is kind of you to answer my questions,but i have one question again. i am going to put the result of "select query" on the text file and insert the result in array on lua how can i do that ? is it possible to use lua commands directly? i know how to connect to database ,but i don't know how to put the select query result in array or text file and match the number i want on the array or text file? ________________________________ From: SamyGo <govoiper@gmail.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Sent: Tuesday, May 29, 2012 2:24 PM Subject: Re: [Freeswitch-users] how to run Lua commands in freeswitch? Thats a very good question, let me show you how you can do it. session:answer(); session:streamFile("blah.wav"); op='+' if op == "+" then r = a + b session:streamFile("finally-I-did-this.wav"); elseif op == "-" then r = a - b session:streamFile("It-was-vry-difficult.wav"); elseif op == "*" then r = a*b session:streamFile("just-kidding.wav"); elseif op == "/" then r = a/b session:streamFile("only-took-5-hrs-for-this.wav"); else error("invalid operation") end session:hangup(); But whatever you want to do if it requires you to include some header/library on top don't forget to add it. Regards, Sammy Go. On Tue, May 29, 2012 at 2:38 PM, Samira Mh <saami_mh@ymail.com>wrote: i have created the file named "helloworld.lua" like this:
session:answer(); session:streamFile("blah.wav"); session:hangup(); and it working correctly, **now i want to use lua command -not freeswitch command -in lua for example run:
op='+' if op == "+" then r = a + b elseif op == "-" then r = a - b elseif op == "*" then r = a*b elseif op == "/" then r = a/b else error("invalid operation") end but how can do that? thanks alot _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 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 http://www.freeswitch.org
participants (2)
-
Samira Mh
-
SamyGo