Home Forum Developers IP0x Lua in Switchfin

JRPassphrase Registration Control

In order to register on this site, you must first submit the passphrase below.

TODO list for each hardware target can be found as sticky topic in the corresponding forum


admin
useravatar
User Info

Lua in Switchfin

Hi Guys,

Lua interpreter and Lua PBX switch was added in Switchfin (svn trunk).
The experiments was done for BR4-Appliance but it should work for all supported targets.
I have added the standard extension.lua sample from Asterisk 1.6.
It seems it loads properly but I don't know Lua so I can not say for sure

BR4*CLI> core show switches
    -= Registered Asterisk Alternative Switches =-
Lua: Lua PBX Switch
IAX2: IAX Remote Dialplan Switch
Loopback: Loopback Dialplan Switch

Gilles, now it is your turn to check if Lua is working smile
It will be very helpful if you post your test cases when available.

If you wish feel free to prepare an anouncement that we have Lua and put in the Switchfin front page.

Thank you
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

Very cool :-) Thanks Dimitar. With my non-existent knowledge of Lua, I'll start playing with it tomorrow anyway and report back.

To allow other users to add applications to Switchfin, it'd be very useful if you could explain basically how you did it (checking that the Lua source code can run on Atcom devices, writing the rigth Makefile, etc.)


Administrator has disabled public posting
admin
useravatar
User Info

Re: Lua in Switchfin

Hi Gilles,

Basically what i did is back-porting the pbx_lua switch from Asterisk 1.6 to our Asterisk 1.4.32. I also had to enable the lua interpreter from uClinux so we can link it statically with pbx_lua.

Now in Switchfin we have Lua interpreter as well (most probably we will not need it and we will remove it later on so reduce the rootfs a bit)   

root@br4:~> lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>

Our regards to "Departamento de Informática, PUC-Rio, Brazil" for the Lua language.

Dimitar


Administrator has disabled public posting
spiga
useravatar
User Info

Re: Lua in Switchfin

After LUA apdate i have this error in switchfin trunk

svn co https://switchfin.svn.sourceforge.net/s … fin/trunk/ switchfin

[root@localhost switchfin]# make menuconfig
package/Config.in:45: can't open file "package/lua/Config.in"
make: *** [menuconfig] Error 1


Administrator has disabled public posting
admin
useravatar
User Info

Re: Lua in Switchfin

Hi Spiga,

I forgot to add package/lua, Fixed since 5 h.

Best Regards
Dimitar


Administrator has disabled public posting
luckman212
useravatar
User Info

Re: Lua in Switchfin

Can u guys tell me what the benefit of adding Lua to switchfin can be?  I'm not too familiar with it.  Is this going to add some kind of more advanced rule parsing or something like that?  sorry If I am ignorant of this thing sad


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

Lua is a rich while compact scripting language which will let you easily write sophisticated dialplans (called through AGI in extensions.conf).


Administrator has disabled public posting
luckman212
useravatar
User Info

Re: Lua in Switchfin

Hmm sounds very cool.  Have to do more reading up about Lua.
I had heard of it some years back but didn't pay close attention.
Now it seems that it could be quite useful in this context.

Gilles can you tell me how you plan to make use of it?  I mean what feature is missing in asterisk that you cannot achieve using builtin functions, I am curious


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

I need to build an IVR so that extensions.conf will need to call code that would do things like:
- broadcast information to all hosts on the LAN to display a pop-up on people's screens
- log all calls into an SQLite database (for easy setup + backup)
- send e-mail notifications
etc.

Based on my (shallow) experience with extensions.conf, the native syntax makes this either impossible or really not fun.

And since the IP01 has only 64MB total, there's a need for a small, albeit powerful scripting language.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

Thank you Dimitar for adding Lua and pbx_lua to Switchfin :-)

I updated the source code to release 267, compiled the project for Atcom IP01. Next, I copied the Lua interpreter to my Atcom IP01, and got a prompt. Cool!

A few notes I took:

1. Unless most people are likely to use libcurl.so.4, I think it'd be useful to update this file so it looks for libcurl.so.5 instead, and avoid breaking "make":

build_ip01/uClinux-dist/lib/libcurl/Makefile

2. Altough I chose Asterisk PBX in "make menuconfig", I didn't find pbx_lua:

/usr/src/switchfin# find . -name "pbx*"
./build_ip01/root/usr/lib/asterisk/modules/pbx_realtime.so
./build_ip01/root/usr/lib/asterisk/modules/pbx_spool.so
./build_ip01/root/usr/lib/asterisk/modules/pbx_config.so
./build_ip01/root/usr/lib/asterisk/modules/pbx_loopback.so

3. Dimitar mentionned above that "most probably we will not need [lua] and we will remove it later on so reduce the rootfs a bit)".

If so, what other compact and easy-to-use scripting language do you suggest should be available so people can write AGI scripts? What do people use to write good IVR's?

4. Generally speaking, I need to learn how to import Linux x86 applications into Switchin/uClinux, so that I can add other modules that I need such as LuaSocket, LuaSQL, etc.
Besides the wiki section below, if someone knows of good documents on how to do this, I'm interested:

http://docs.blackfin.uclinux.org/doku.p … _of_topics
(documents with an empty second column are orphans, ie. not listed in the left-hand tree)

Thank you.


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Lua in Switchfin

Hi Gilles

Quick note if you run make menuconfig you will find lua at the bottom enabling this will compile and install lua into your uImage.

You are probably right about the libcurl issue as most new distros are moving to 5


Administrator has disabled public posting
admin
useravatar
User Info

Re: Lua in Switchfin

Hi Guys,

Oh, do you still have curl issues, so you get the compilation stops?
Is this a clean built?

Well there are 2 main possibilities (without being expert in this)
- use lua_switch and implement your complete dialplan in lua using extensions.lua file
- use agi and invoke something written in lua. This is why I have included separate lua interpreter and if usefull we will keep it in the image

Gilles, I personally don't have experience with agi and lua_pbx so please post your successful test examples.

Thanks
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

Hello

Previously, I simply ran "svn update" which did compile lua + luac but didn't compile pbx_lua.so.

So I rm -Rf /usr/src/switchfin, added Lua to menuconfig, ran make, and it did compile as expected:

/usr/src/switchfin/build_ip01/root/usr/lib/asterisk/modules/pbx_lua.so

There isn't much information on using this feature brought by Asterisk 1.6. I'll report back what I found.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

BTW, I notice that the build directory doesn't contain Asterisk's extensions.conf file:

Code:


/usr/src/switchfin/build_ip01/root# find . -name "extension*"
/usr/src/switchfin/build_ip01/root#

Are Asterisk configuration files stuck elsewhere and added to uImage when running "make image"?


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Lua in Switchfin

To learn more about Lua on Asterisk, either through AGI or pbx_lua, I downloaded the latest Asterisk 1.6 source code and tried compiling Asterisk on the Ubuntu workstation.

"make menuconfig" won't let me select "pbx_lua", even though I think I have all the packages required.

However, this long thread from 2009, and the lack of feedback leads me to conclude that pbx_lua is not a good option at this point at least for a production server:

"Installing LUA"
http://thread.gmane.org/gmane.comp.tele … ser/230617

I'll play with Lua through the AGI interface instead, and report what I found.


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 2587  Total Topics: 299  Total Polls: 1  Total Posts: 1727  Dormant
User Info:   Newest User :  user2553   Members Online: 0   Guests Online: 242
Online  There are no members online
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked