[asterisk-commits] tilghman: branch 1.6.0 r222279 - in /branches/1.6.0: ./ res/ael/pval.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 6 14:19:20 CDT 2009


Author: tilghman
Date: Tue Oct  6 14:19:18 2009
New Revision: 222279

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222279
Log:
Recorded merge of revisions 222273 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r222273 | tilghman | 2009-10-06 14:17:11 -0500 (Tue, 06 Oct 2009) | 5 lines
  
  When we call a gosub routine, the variables should be scoped to avoid contaminating the caller.
  This affected the ~~EXTEN~~ hack, where a subroutine might have changed the
  value before it was used in the caller.
  Patch by myself, tested by ebroad on #asterisk
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/res/ael/pval.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/res/ael/pval.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/res/ael/pval.c?view=diff&rev=222279&r1=222278&r2=222279
==============================================================================
--- branches/1.6.0/res/ael/pval.c (original)
+++ branches/1.6.0/res/ael/pval.c Tue Oct  6 14:19:18 2009
@@ -3360,30 +3360,44 @@
 		if (contains_switch(statement)) { /* only run contains_switch if you haven't checked before */
 			if (mother_exten) {
 				if (!mother_exten->has_switch) {
-					switch_set = new_prio();
-					switch_set->type = AEL_APPCALL;
-					switch_set->app = strdup("Set");
-					switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
-					linkprio(exten, switch_set, mother_exten);
-					mother_exten->has_switch = 1;
-					mother_exten->checked_switch = 1;
-					if (exten) {
-						exten->has_switch = 1;
-						exten->checked_switch = 1;
+					for (first = 1; first >= 0; first--) {
+						switch_set = new_prio();
+						switch_set->type = AEL_APPCALL;
+						switch_set->app = strdup("Set");
+						if (!strcmp(mother_exten->name, "s") && first) {
+							switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
+						} else {
+							switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+							first = 0;
+						}
+						linkprio(exten, switch_set, mother_exten);
+						mother_exten->has_switch = 1;
+						mother_exten->checked_switch = 1;
+						if (exten) {
+							exten->has_switch = 1;
+							exten->checked_switch = 1;
+						}
 					}
 				}
 			} else if (exten) {
 				if (!exten->has_switch) {
-					switch_set = new_prio();
-					switch_set->type = AEL_APPCALL;
-					switch_set->app = strdup("Set");
-					switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
-					linkprio(exten, switch_set, mother_exten);
-					exten->has_switch = 1;
-					exten->checked_switch = 1;
-					if (mother_exten) {
-						mother_exten->has_switch = 1;
-						mother_exten->checked_switch = 1;
+					for (first = 1; first >= 0; first--) {
+						switch_set = new_prio();
+						switch_set->type = AEL_APPCALL;
+						switch_set->app = strdup("Set");
+						if (!strcmp(mother_exten->name, "s") && first) {
+							switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
+						} else {
+							switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+							first = 0;
+						}
+						linkprio(exten, switch_set, mother_exten);
+						exten->has_switch = 1;
+						exten->checked_switch = 1;
+						if (mother_exten) {
+							mother_exten->has_switch = 1;
+							mother_exten->checked_switch = 1;
+						}
 					}
 				}
 			}




More information about the asterisk-commits mailing list