asterisk/pbx
George Joseph 3e5ab6ca39 pbx_lua: fix regression with global sym export and context clash by pbx_config.
ASTERISK-23818 (lua contexts being overwritten by contexts of the same name in
pbx_config) surfaced because pbx_lua, having the AST_MODFLAG_GLOBAL_SYMBOLS
set, was always force loaded before pbx_config.  Since I couldn't find any
reason for pbx_lua to export it's symbols to the rest of Asterisk, I simply
changed the flag to AST_MODFLAG_DEFAULT.  Problem solved.  What I didn't
realize was that the symbols need to be exported not because Asterisk needs
them but because any external Lua modules like luasql.mysql need the base
Lua language APIs exported (ASTERISK-17279).

Back to ASTERISK-23818...  It looks like there's an issue in pbx.c where
context_merge was only merging includes, switches and ignore patterns if
the context was already existing AND has extensions, or if the context was
brand new.  If pbx_lua is loaded before pbx_config, the context will exist
BUT pbx_lua, being implemented as a switch, will never place extensions in
it, just the switch statement.  The result is that when pbx_config loads,
it never merges the switch statement created by pbx_lua into the final
context.

This patch sets pbx_lua's modflag back to AST_MODFLAG_GLOBAL_SYMBOLS and adds
an "else if" in context_merge that catches the case where an existing context
has includes, switchs or ingore patterns but no actual extensions.

ASTERISK-23818 #close
Reported by: Dennis Guse
Reported by: Timo Teräs
Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3891/
........

Merged revisions 420146 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 420147 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 420148 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 16:12:26 +00:00
..
ael/ael-test Merged revisions 299449 via svnmerge from 2010-12-22 20:10:34 +00:00
Makefile Title update 2012-10-14 21:56:13 +00:00
dundi-parser.c Allow Asterisk to compile under GCC 4.10 2014-05-09 22:49:26 +00:00
dundi-parser.h Remove built-in AES code and use optional_api instead 2010-07-21 19:11:32 +00:00
pbx_ael.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
pbx_config.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
pbx_dundi.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
pbx_loopback.c Check result of ast_var_assign() calls for memory allocation failure. 2013-08-06 08:36:15 +00:00
pbx_lua.c pbx_lua: fix regression with global sym export and context clash by pbx_config. 2014-08-06 16:12:26 +00:00
pbx_realtime.c Stasis: Allow message types to be blocked 2014-08-06 12:55:28 +00:00
pbx_spool.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00