]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Bug 8128 fixed in this release via these changes
authorSteve Murphy <murf@digium.com>
Fri, 13 Oct 2006 20:52:17 +0000 (20:52 +0000)
committerSteve Murphy <murf@digium.com>
Fri, 13 Oct 2006 20:52:17 +0000 (20:52 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@45103 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx/ael/ael-test/ael-vtest17/extensions.ael [new file with mode: 0644]
pbx/ael/ael-test/ref.ael-test3
pbx/ael/ael-test/ref.ael-vtest17 [new file with mode: 0644]
pbx/pbx_ael.c

diff --git a/pbx/ael/ael-test/ael-vtest17/extensions.ael b/pbx/ael/ael-test/ael-vtest17/extensions.ael
new file mode 100644 (file)
index 0000000..d13fe99
--- /dev/null
@@ -0,0 +1,116 @@
+context dialextens
+{
+       /* 
+               101 thru 123, 149 thru 152
+        */
+       _10X => Dial(Zap/${EXTEN:2},30,tw);
+       _1ZX => Dial(Zap/${EXTEN:1},30,tw);
+}
+/* 
+    Due to extenal wiring:
+
+  dialing 125 will ring 101
+  dialing 126 will ring 102
+   and so on until
+  dialing 147 will ring 123
+
+We can dial out on zap 69 thru 72; and 25-47
+
+*/
+
+context dialthrus
+{
+       /*  369-372; 325-347 */
+       _3XX => Dial(Zap/${EXTEN:1},30,tw);
+}
+
+context t1incoming
+{
+       includes
+       {
+               dialextens;
+               parkedcalls;
+       }
+       s => {
+               Answer();
+               Background(welcome-to-test-machine);
+       }
+
+}
+
+context t1extension
+{
+       includes
+       {
+               dialextens;
+               dialthrus;
+       }
+
+}
+
+context incoming
+{
+       includes
+       {
+               dialextens;
+               parkedcalls;
+       }
+       s => {
+               Answer();
+               Background(welcome-to-test-machine);
+       }
+}
+
+context extension
+{
+       includes
+       {
+               dialextens;
+               dialthrus;
+       }
+       5 => {
+               Record(recording:gsm);
+               Background(recording);
+       }
+
+       81 => {
+               iterations=1000000;
+               Set(time1=${EPOCH});
+               for(i=1; ${i}<${iterations}; i=${i}+1)
+               {
+                       NoOp(Hello);
+               }
+               Set(time2=${EPOCH});
+               Verbose(The time diff is $[${time2} - ${time1} ] seconds);
+               Verbose(Which means that the priorities/sec = $[4* ${iterations} / (${time2} - ${time1}) ]);
+               SayNumber($[4 * ${iterations} / (${time2} - ${time1}) ]);
+       }
+       82 => {
+                       &ndeep(100000);
+                       Verbose(Finished 100000 levels deep call!);
+               }
+       83 => {
+               switch (${EXTEN}) 
+               {
+               pattern 8X:
+                       Verbose(do something to prepare it);
+               pattern 9X:
+                       Verbose(handle both 8x and 9x calls);
+               pattern [4-7]X:
+                       Verbose(and this too!);
+
+               }
+
+       }
+}
+
+macro ndeep(level)
+{
+        if( ${level} == 0)
+        {
+                Verbose(2|Got to Level 0);
+                return;
+        }
+        &ndeep($[${level}-1]);
+        return;
+}
index 850a7ab79d2c4efa052dc50c0da7bbe8b2bf1943..0ace5ff9e6df1ddf57af805eb121c4268e0e7d29 100644 (file)
@@ -2,17 +2,20 @@
 (If you find progress and other non-error messages irritating, you can use -q to suppress them)
 
 (You can use the -w option to dump extensions.conf format to extensions.conf.aeldump)
-LOG: lev:2 file:pbx_ael.c  line:3803 func: pbx_load_module  Starting AEL load process.
-LOG: lev:2 file:pbx_ael.c  line:3810 func: pbx_load_module  AEL load process: calculated config file name './extensions.ael'.
+LOG: lev:2 file:pbx_ael.c  line:3856 func: pbx_load_module  Starting AEL load process.
+LOG: lev:2 file:pbx_ael.c  line:3863 func: pbx_load_module  AEL load process: calculated config file name './extensions.ael'.
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./include1.ael2, 78 chars
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./include2.ael2, 98 chars
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./include3.ael2, 57 chars
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./include5.ael2, 56 chars
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./include4.ael2, 87 chars
 LOG: lev:2 file:ael.flex  line:429 func: ael_yylex    --Read in included file ./telemarket_torture.ael2, 28036 chars
-LOG: lev:2 file:pbx_ael.c  line:3818 func: pbx_load_module  AEL load process: parsed config file name './extensions.ael'.
-LOG: lev:2 file:pbx_ael.c  line:3821 func: pbx_load_module  AEL load process: checked config file name './extensions.ael'.
-LOG: lev:2 file:pbx_ael.c  line:3823 func: pbx_load_module  AEL load process: compiled config file name './extensions.ael'.
-LOG: lev:2 file:pbx_ael.c  line:3826 func: pbx_load_module  AEL load process: merged config file name './extensions.ael'.
-LOG: lev:2 file:pbx_ael.c  line:3829 func: pbx_load_module  AEL load process: verified config file name './extensions.ael'.
+LOG: lev:2 file:pbx_ael.c  line:3871 func: pbx_load_module  AEL load process: parsed config file name './extensions.ael'.
+LOG: lev:3 file:pbx_ael.c  line:816 func: check_includes  Warning: file ./extensions.ael, line 2747-2751: The included context 'parkedcalls' cannot be found.
+LOG: lev:3 file:pbx_ael.c  line:816 func: check_includes  Warning: file ./extensions.ael, line 2954-2957: The included context 'parkedcalls' cannot be found.
+LOG: lev:3 file:pbx_ael.c  line:816 func: check_includes  Warning: file ./extensions.ael, line 3005-3012: The included context 'parkedcalls' cannot be found.
+LOG: lev:2 file:pbx_ael.c  line:3874 func: pbx_load_module  AEL load process: checked config file name './extensions.ael'.
+LOG: lev:2 file:pbx_ael.c  line:3876 func: pbx_load_module  AEL load process: compiled config file name './extensions.ael'.
+LOG: lev:2 file:pbx_ael.c  line:3879 func: pbx_load_module  AEL load process: merged config file name './extensions.ael'.
+LOG: lev:2 file:pbx_ael.c  line:3882 func: pbx_load_module  AEL load process: verified config file name './extensions.ael'.
 LOG: lev:4 file:ael2_parse  line:479 func: main  172 contexts, 858 extensions, 2326 priorities
diff --git a/pbx/ael/ael-test/ref.ael-vtest17 b/pbx/ael/ael-test/ref.ael-vtest17
new file mode 100644 (file)
index 0000000..4af1b06
--- /dev/null
@@ -0,0 +1,68 @@
+
+
+[dialextens]
+exten => _10X,1,Dial(Zap/${EXTEN:2}|30|tw)
+exten => _1ZX,1,Dial(Zap/${EXTEN:1}|30|tw)
+
+
+[dialthrus]
+exten => _3XX,1,Dial(Zap/${EXTEN:1}|30|tw)
+
+
+[t1incoming]
+include => dialextens
+include => parkedcalls
+exten => s,1,Answer()
+exten => s,2,Background(welcome-to-test-machine)
+
+
+[incoming]
+include => dialextens
+include => parkedcalls
+exten => s,1,Answer()
+exten => s,2,Background(welcome-to-test-machine)
+
+
+[extension]
+include => dialextens
+include => dialthrus
+exten => 5,1,Record(recording:gsm)
+exten => 5,2,Background(recording)
+exten => 81,1,Set(iterations=$[1000000])
+exten => 81,2,Set(time1=${EPOCH})
+exten => 81,3,Set(i=$[1])
+exten => 81,4,GotoIf($[${i}<${iterations}]?5:8)
+exten => 81,5,NoOp(Hello)
+exten => 81,6,Set(i=$[${i}+1])
+exten => 81,7,Goto(4)
+exten => 81,8,NoOp(Finish for-extension-1)
+exten => 81,9,Set(time2=${EPOCH})
+exten => 81,10,Verbose(The time diff is $[${time2} - ${time1} ] seconds)
+exten => 81,11,Verbose(Which means that the priorities/sec = $[4* ${iterations} / (${time2} - ${time1}) ])
+exten => 81,12,SayNumber($[4 * ${iterations} / (${time2} - ${time1}) ])
+exten => 82,1,Macro(ndeep|100000)
+exten => 82,2,Verbose(Finished 100000 levels deep call!)
+exten => 83,1,Goto(sw-2-${EXTEN}|1)
+exten => 83,2,NoOp(Finish switch-extension-2)
+exten => _sw-2-[4-7]X,1,Verbose(and this too!)
+exten => _sw-2-[4-7]X,2,Goto(83|2)
+exten => _sw-2-9X,1,Verbose(handle both 8x and 9x calls)
+exten => _sw-2-9X,2,Goto(sw-2-49|1)
+exten => _sw-2-8X,1,Verbose(do something to prepare it)
+exten => _sw-2-8X,2,Goto(sw-2-99|1)
+
+
+[macro-ndeep]
+exten => s,1,Set(level=${ARG1})
+exten => s,2,GotoIf($[${level} == 0]?3:5)
+exten => s,3,Verbose(2|Got to Level 0)
+exten => s,4,Goto(8)
+exten => s,5,NoOp(Finish if-ndeep-3)
+exten => s,6,Macro(ndeep|$[${level}-1])
+exten => s,7,Goto(8)
+exten => s,8,NoOp(End of Macro ndeep-s)
+
+
+[t1extension]
+include => dialextens
+include => dialthrus
index 2dc8b37ad5b6a5bf5da67a3cab0638c5678a8fe1..b68322726e0e33708078130c6fcdbe2c400259ef 100644 (file)
@@ -2785,6 +2785,29 @@ static void remove_spaces_before_equals(char *str)
        }
 }
 
+static void gen_match_to_pattern(char *pattern, char *result)
+{
+       /* the result will be a string that will be matched by pattern */
+       char *p=pattern, *t=result;
+       while (*p) {
+               if (*p == 'x' || *p == 'n' || *p == 'z' || *p == 'X' || *p == 'N' || *p == 'Z')
+                       *t++ = '9';
+               else if (*p == '[') {
+                       char *z = p+1;
+                       while (*z != ']')
+                               z++;
+                       if (*(z+1)== ']')
+                               z++;
+                       *t++=*(p+1); /* use the first char in the set */
+                       p = z;
+               } else {
+                       *t++ = *p;
+               }
+               p++;
+       }
+       *t++ = 0; /* cap it off */
+}
+
 static void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *this_context )
 {
        pval *p,*p2,*p3;
@@ -3031,14 +3054,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+                                                       gen_match_to_pattern(p2->next->u1.str, buf2);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-%s|1", local_control_statement_count, buf2);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (p2->next && p2->next->type == PV_DEFAULT) {
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (!p2->next) {
@@ -3092,14 +3116,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+                                                       gen_match_to_pattern(p2->next->u1.str, buf2);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",local_control_statement_count, buf2);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (p2->next && p2->next->type == PV_DEFAULT) {
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (!p2->next) {
@@ -3155,14 +3180,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+                                                       gen_match_to_pattern(p2->next->u1.str, buf2);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",local_control_statement_count, buf2);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (p2->next && p2->next->type == PV_DEFAULT) {
                                                        fall_thru = new_prio();
                                                        fall_thru->type = AEL_APPCALL;
                                                        fall_thru->app = strdup("Goto");
-                                                       snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+                                                       snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
                                                        fall_thru->appargs = strdup(buf1);
                                                        linkprio(switch_case, fall_thru);
                                                } else if (!p2->next) {