[asterisk-bugs] [Asterisk 0012961]: [patch] allow pbx_lua to be used without pbx_config loaded

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Sep 25 15:48:56 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12961 
====================================================================== 
Reported By:                mnicholson
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   12961
Category:                   PBX/General
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 126574 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-06-30 15:04 CDT
Last Modified:              2008-09-25 15:48 CDT
====================================================================== 
Summary:                    [patch] allow pbx_lua to be used without pbx_config
loaded
Description: 
This patch allows pbx_lua to be used without pbx_config being loaded by
directly creating the required dialplan switches in the pbx_lua.so module.
====================================================================== 

---------------------------------------------------------------------- 
 (0092872) murf (administrator) - 2008-09-25 15:48
 http://bugs.digium.com/view.php?id=12961#c92872 
---------------------------------------------------------------------- 
Not to worry; I looked at your code and it seems to be OK. I tested it
against
a case where extensions.lua adds an extension to a context that already
exists,
via extensions.ael. The switch is added to the existing context, which is
what I'd expect.

The local_table and local_extens are gone the moment you return from
merge_contexts_and_delete. The procedure goes this way:

a. read in your input file, have a local hashtab, and a local extensions
list;
b. create all the contexts/extens/prios via the add_exten, etc. func
calls,
   which add these items to the local list and table.
c. call merge_contexts_and_delete(), which will:
    1. traverse the existing dialplan, and copy all the stuff that 
       has a different registrar into your local_hashtab and local_extens

       list. 
    2. lock the local dialplan, save the hashtab and list pointers, then
       set the global dialplan hashtab and exten list pointers to be your
       local table and exten list. It will then release the lock. Takes
       around 4 micoroseconds on 3GHz machines.
    3. it then destroys what used to be the global hashtab and exten
tree.
d. then you set the local hashtab and exten tree pointers to NULL. They
no
   longer belong to you.

and the ast_context_destroy(NULL, "registrar") is a good way to unload;
it will remove anything that your module registrar'd into the table.

I've dropped some detail, but this is roughly how it works. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-09-25 15:48 murf           Note Added: 0092872                          
======================================================================




More information about the asterisk-bugs mailing list