[Freeswitch-users] how to run Lua commands in freeswitch?

Samira Mh saami_mh at ymail.com
Tue May 29 14:25:15 MSD 2012


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 at gmail.com>
To: FreeSWITCH Users Help <freeswitch-users at 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 at 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 at freeswitch.org
>http://www.freeswitchsolutions.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 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://wiki.freeswitch.org
http://www.cluecon.com

Join Us At ClueCon - Aug 7-9, 2012

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/20120529/b0df76dd/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list