[svn-commits] mjordan: branch 12 r408220 - in /branches/12: ./ main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Feb 15 21:23:16 CST 2014


Author: mjordan
Date: Sat Feb 15 21:23:14 2014
New Revision: 408220

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408220
Log:
pbx: Handle a completely empty dialplan during a context merge

It is highly unlikely, but - at least in Asterisk 12 - theoretically possible
to load Asterisk with no dialplan whatsoever. If that occurs, and some other
module (that is not a pbx module) attempts to merge its contexts into the
dialplan, the existing merge routine will crash. This is because it is not
insane, and rightly believes that you provided some sort of dialplan,
somewhere.

This patch will gracefully merge the contexts in such a case. Note that this
is highly unlikely to occur in 1.8/11, as features will most likely provide
some dialplan via parking. However, in Asterisk 12, parking is now provided
by res_parking, and hence may create its dialplan later.

(closes issue ASTERISK-23297)
Reported by: CJ Oster

Review: https://reviewboard.asterisk.org/r/3222
........

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

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

Modified:
    branches/12/   (props changed)
    branches/12/main/pbx.c

Propchange: branches/12/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: branches/12/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/pbx.c?view=diff&rev=408220&r1=408219&r2=408220
==============================================================================
--- branches/12/main/pbx.c (original)
+++ branches/12/main/pbx.c Sat Feb 15 21:23:14 2014
@@ -8791,6 +8791,16 @@
 	begintime = ast_tvnow();
 	ast_mutex_lock(&context_merge_lock);/* Serialize ast_merge_contexts_and_delete */
 	ast_wrlock_contexts();
+
+	if (!contexts_table) {
+		/* Well, that's odd. There are no contexts. */
+		contexts_table = exttable;
+		contexts = *extcontexts;
+		ast_unlock_contexts();
+		ast_mutex_unlock(&context_merge_lock);
+		return;
+	}
+
 	iter = ast_hashtab_start_traversal(contexts_table);
 	while ((tmp = ast_hashtab_next(iter))) {
 		context_merge(extcontexts, exttable, tmp, registrar);




More information about the svn-commits mailing list