[asterisk-dev] Module pbx_lua not loading extensions.lua on startup

Dennis Guse dennis.guse at qu.tu-berlin.de
Wed May 14 15:58:13 CDT 2014


Hi,

using the pbx_lua module for almost everything we have found a little
annoying "bug". On Asterisk startup the module is loaded - however the
configuration (extensions.lua) is not loaded and therefore the lua-defined
dialplan is not available. By applying "module reload pbx_lua" the dialplan
is loaded as expected (lua dialplan is correct).


------
How to reproduce the problem.

Details: Asterisk 11.7 running on Ubuntu 14.04

- Module is loaded on start
# asterisk -fvvv
..SNIP
[1;30m    -- [0mRegistered extension context 'default'; registrar: pbx_lua
[1;30m    -- [0mIncluding switch 'Lua/' in context 'default'
 [1;30m    -- [0mRegistered extension context 'parkedcalls'; registrar:
features
[1;30m    -- [0mmerging incls/swits/igpats from old(parkedcalls) to
new(parkedcalls) context, registrar = pbx_lua
 [1;30m    -- [0mAdded extension '700' priority 1 to parkedcalls
[1;30m    -- [0mTime to scan old dialplan and merge leftovers back into the
new: 0.000043 sec
[1;30m    -- [0mTime to restore hints and swap in new dialplan: 0.000003 sec
 [1;30m    -- [0mTime to delete the old dialplan: 0.000005 sec
[1;30m    -- [0mTotal time merge_contexts_delete: 0.000051 sec
[1;30m [0mpbx_lua.so => ( [0;33mLua PBX Switch [0m)
..SNIP

- Module is really loaded and thus fails:
#asterisk -rc "module load pbx_lua"

- Let the started Asterisk reload pbx_lua
# sudo asterisk -rxvvvvv
> module reload pbx_lua.so
    -- Reloading module 'pbx_lua.so' (Lua PBX Switch)
    -- Registered extension context 'default'; registrar: pbx_lua
    -- Including switch 'Lua/' in context 'default'
    -- Registered extension context 'parkedcalls'; registrar: features
    -- merging incls/swits/igpats from old(parkedcalls) to new(parkedcalls)
context, registrar = pbx_lua
    -- Added extension '700' priority 1 to parkedcalls
    -- Registered extension context 'ael-builtin-h-bubble'; registrar:
pbx_ael
    -- merging incls/swits/igpats from old(ael-builtin-h-bubble) to
new(ael-builtin-h-bubble) context, registrar = pbx_lua
    -- Added extension 'h' priority 9996 to ael-builtin-h-bubble
    -- Added extension 'h' priority 9995 to ael-builtin-h-bubble
    -- Added extension 'h' priority 9994 to ael-builtin-h-bubble
    -- Added extension 'h' priority 9993 to ael-builtin-h-bubble
    -- Added extension 'h' priority 9992 to ael-builtin-h-bubble
    -- Added extension 'h' priority 9991 to ael-builtin-h-bubble
    -- Added extension 'h' priority 1 to ael-builtin-h-bubble
    -- Registered extension context 'ael-default'; registrar: pbx_ael
    -- merging incls/swits/igpats from old(ael-default) to new(ael-default)
context, registrar = pbx_lua
    -- Including context 'ael-demo' in context 'ael-default'
    -- Registered extension context 'ael-demo'; registrar: pbx_ael
    -- merging incls/swits/igpats from old(ael-demo) to new(ael-demo)
context, registrar = pbx_lua
...SNIP


----
Investigation:

I took a look into pbx/pbx_lua.c and actually "load" identical to reload +
registering the module at Asterisk. Looks neat.

static int reload(void)
{
return load_or_reload_lua_stuff();
}

static int load_module(void)
{
int res;

if ((res = load_or_reload_lua_stuff()))
return res;

if (ast_register_switch(&lua_switch)) {
ast_log(LOG_ERROR, "Unable to register LUA PBX switch\n");
 return AST_MODULE_LOAD_DECLINE;
}

return AST_MODULE_LOAD_SUCCESS;
}

----

Could it be that the pbx_lua is loaded to early and the dialplan
overwritten by some other dialplan-module that is later loaded?

PS: Work done together with Frank Haase.

Kind regards

Dennis Guse

Quality and Usability Lab
Telekom Innovation Laboratories
TU Berlin
Ernst-Reuter-Platz 7
D-10587 Berlin, Germany
Tel: +49 30 8353 58874
Fax: +49 30 8353 58409
E-mail: dennis.guse at telekom.de
Web: www.qu.tlabs.tu-berlin.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140514/f7bd4c33/attachment.html>


More information about the asterisk-dev mailing list