[asterisk-users] Accessing Asterisk gosub arguments in extensions.lua

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Aug 19 12:11:30 CDT 2009


On Wednesday 19 August 2009 11:29:58 Brian Camp wrote:
> On Monday 17 August 2009 18:03:10 pm Tilghman Lesher wrote:
>  >> How does one go about accessing gosub arguments from Asterisk in
>  >> extensions.lua?
>  >
>  > You cannot.  The various methods of dialplan creation are not
>  > designed to be
>  > interoperable.  Some people have made various methods work (such as
>  > between
>  > extensions.conf and extensions.ael) but those methods are not
>  > guaranteed to
>  > work, nor are they supported.
>
> Why does Asterisk even have functions in pbx_lua like app.return and
> app.gosub, which jump between extensions.conf and extensions.lua if its
> not supported or guaranteed to work.

Because it's a generic interface to call applications.  It's that you have
app_stack.so loaded, which creates those two applications, and LUA doesn't
limit which applications you can run.  Applications are black boxes, as far as
LUA is concerned.  Would you want it that if you load MyCustomApp, that LUA
won't let you run it, without modifying the LUA source?

> Theres nothing in extensions.lua 
> or pbx_lua.c, which so far as I can tell are the only available sources
> of documentation for pbx_lua, that suggests extensions.conf
> interoperability doesn't work.

There's nothing that says it will, either.

> Deciding to switch between a 10,000+ line dialplan in an assembly-like
> language (extensions.conf) over to one in Lua in one all at once is not
> a good position to be in.

Here's where I would suggest that if you've got 10,000 lines in a dialplan,
you've probably already gone the wrong direction and you should probably
refactor a good amount of that into a database, with proper abstraction
techniques.

-- 
Tilghman & Teryl
with Peter, Cottontail, Midnight, Thumper, & Johnny (bunnies)
and Harry, BB, & George (dogs)



More information about the asterisk-users mailing list