Lua in asterisk

Asterisk] PBX/NewFeature

2007-11-01 18:49

Summary 0011140: [patch] a lua pbx switch that allows dialplans written in pure lua

Description This module allows users to write dialplans completely in lua, see the included extensions.lua.sample file for more information. I have lightly tested the code and it has worked for me.

Additional Information In order to implement this module I had to export the ext_cmp() function from pbx.c. I did this by adding an additional function named ast_extension_cmp() that calls ext_cmp(). This was necessary to that my pbx_lua module knows what order to match extensions in.

I updated as well as several of the other build and menuconfig related files. I updated the ./configure script as well using autoreconf, but I am not sure if that was done correctly.

The code is fully documented internally, and the syntax for extensions.lua is documented in the sample file, it might be worthwhile to add an extensions.lua.tex or pbx_lua.tex file, but this patch does not include one.

I have also included the utils/build-extensions-conf.lua which can be used to include the proper contexts from your extensions.lua file into extensions.conf using #exec (requires execincludes=yes in asterisk.conf). This is documented in the extensions.lua.sample file and in the script itself.

I am looking forward to the inclusion of this code in asterisk as it will make writing complex dialplans much easier.

notes from Ken Blog Archive Embedding Lua 5.1 in Asterisk

Author: Matthew Nicholson
Date:  To: Asterisk Developers Mailing List
Subject: Re: [asterisk-dev] Asterisk Lua Reference
On Wed, 2009-04-15 at 22:46 -0700, Lahav Savir wrote:

> Does anyone know where can I find the Asterisk Lua reference, for all
> the Asterisk commands that can be used within Lua ?

There is no official reference. See the comments in the extensions.lua
example file. All asterisk applications and functions can be used in
the following manner:

app.dial("arg1", "arg2")
Matthew Nicholson
Digium, Inc. | Software Developer