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

SamyGo govoiper at gmail.com
Tue May 29 13:54:10 MSD 2012


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120529/73be099e/attachment.html 


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