[svn-commits] gtjoseph: branch 1.8 r420146 - in /branches/1.8: main/pbx.c pbx/pbx_lua.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 6 11:05:45 CDT 2014


Author: gtjoseph
Date: Wed Aug  6 11:05:39 2014
New Revision: 420146

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=420146
Log:
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/

Modified:
    branches/1.8/main/pbx.c
    branches/1.8/pbx/pbx_lua.c

Modified: branches/1.8/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/pbx.c?view=diff&rev=420146&r1=420145&r2=420146
==============================================================================
--- branches/1.8/main/pbx.c (original)
+++ branches/1.8/main/pbx.c Wed Aug  6 11:05:39 2014
@@ -7868,6 +7868,11 @@
 			ast_hashtab_end_traversal(prio_iter);
 		}
 		ast_hashtab_end_traversal(exten_iter);
+	} else if (new) {
+		/* If the context existed but had no extensions, we still want to merge
+		 * the includes, switches and ignore patterns.
+		 */
+		context_merge_incls_swits_igps_other_registrars(new, context, registrar);
 	}
 
 	if (!insert_count && !new && (strcmp(context->registrar, registrar) != 0 ||

Modified: branches/1.8/pbx/pbx_lua.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_lua.c?view=diff&rev=420146&r1=420145&r2=420146
==============================================================================
--- branches/1.8/pbx/pbx_lua.c (original)
+++ branches/1.8/pbx/pbx_lua.c Wed Aug  6 11:05:39 2014
@@ -1562,7 +1562,7 @@
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Lua PBX Switch",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Lua PBX Switch",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,




More information about the svn-commits mailing list