[asterisk-commits] jrose: branch 10 r346955 - in /branches/10: ./ main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 5 09:02:03 CST 2011


Author: jrose
Date: Mon Dec  5 09:02:00 2011
New Revision: 346955

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=346955
Log:
Resolve duplicate label used in multiple priorities for the same extension.

Prior to this patch, if labels with the same name were used for different priorities in
the same extension, the new label would be accepted, but it would be unusable since
attempts to reach that label would just go to the first one. Now pbx.c detects this,
generates a warning in logs, and culls the label before adding it to the dialplan.

(closes issue ASTERISK-18807)
Reported by: Kenneth Shumard
Patches:
	pbx.c.patch uploaded by Kenneth Shumard (License 5077)
........

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

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

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/pbx.c?view=diff&rev=346955&r1=346954&r2=346955
==============================================================================
--- branches/10/main/pbx.c (original)
+++ branches/10/main/pbx.c Mon Dec  5 09:02:00 2011
@@ -8276,11 +8276,23 @@
 {
 	struct ast_exten *ep;
 	struct ast_exten *eh=e;
+	int repeated_label = 0; /* Track if this label is a repeat, assume no. */
 
 	for (ep = NULL; e ; ep = e, e = e->peer) {
-		if (e->priority >= tmp->priority)
+		if (e->label && tmp->label && e->priority != tmp->priority && !strcmp(e->label, tmp->label)) {
+			ast_log(LOG_WARNING, "Extension '%s', priority %d in '%s', label '%s' already in use at "
+					"priority %d\n", tmp->exten, tmp->priority, con->name, tmp->label, e->priority);
+			repeated_label = 1;
+		}
+		if (e->priority >= tmp->priority) {
 			break;
-	}
+		}
+	}
+
+	if (repeated_label) {	/* Discard the label since it's a repeat. */
+		tmp->label = NULL;
+	}
+
 	if (!e) {	/* go at the end, and ep is surely set because the list is not empty */
 		ast_hashtab_insert_safe(eh->peer_table, tmp);
 




More information about the asterisk-commits mailing list