Correction for bug 8128 in trunk
[asterisk/asterisk.git] / pbx / ael / ael-test / ael-vtest17 / extensions.ael
1 context dialextens
2 {
3         /* 
4                 101 thru 123, 149 thru 152
5         */
6         _10X => Dial(Zap/${EXTEN:2},30,tw);
7         _1ZX => Dial(Zap/${EXTEN:1},30,tw);
8 }
9 /* 
10     Due to extenal wiring:
11
12   dialing 125 will ring 101
13   dialing 126 will ring 102
14    and so on until
15   dialing 147 will ring 123
16
17 We can dial out on zap 69 thru 72; and 25-47
18
19 */
20
21 context dialthrus
22 {
23         /*  369-372; 325-347 */
24         _3XX => Dial(Zap/${EXTEN:1},30,tw);
25 }
26
27 context t1incoming
28 {
29         includes
30         {
31                 dialextens;
32                 parkedcalls;
33         }
34         s => {
35                 Answer();
36                 Background(welcome-to-test-machine);
37         }
38
39 }
40
41 context t1extension
42 {
43         includes
44         {
45                 dialextens;
46                 dialthrus;
47         }
48
49 }
50
51 context incoming
52 {
53         includes
54         {
55                 dialextens;
56                 parkedcalls;
57         }
58         s => {
59                 Answer();
60                 Background(welcome-to-test-machine);
61         }
62 }
63
64 context extension
65 {
66         includes
67         {
68                 dialextens;
69                 dialthrus;
70         }
71         5 => {
72                 Record(recording:gsm);
73                 Background(recording);
74         }
75
76         81 => {
77                 iterations=1000000;
78                 Set(time1=${EPOCH});
79                 for(i=1; ${i}<${iterations}; i=${i}+1)
80                 {
81                         NoOp(Hello);
82                 }
83                 Set(time2=${EPOCH});
84                 Verbose(The time diff is $[${time2} - ${time1} ] seconds);
85                 Verbose(Which means that the priorities/sec = $[4* ${iterations} / (${time2} - ${time1}) ]);
86                 SayNumber($[4 * ${iterations} / (${time2} - ${time1}) ]);
87         }
88         82 => {
89                         &ndeep(100000);
90                         Verbose(Finished 100000 levels deep call!);
91                 }
92         83 => {
93                 switch (${EXTEN}) 
94                 {
95                 pattern 8X:
96                         Verbose(do something to prepare it);
97                 pattern 9X:
98                         Verbose(handle both 8x and 9x calls);
99                 pattern [4-7]X:
100                         Verbose(and this too!);
101
102                 }
103
104         }
105 }
106
107 macro ndeep(level)
108 {
109         if( ${level} == 0)
110         {
111                 Verbose(2|Got to Level 0);
112                 return;
113         }
114         &ndeep($[${level}-1]);
115         return;
116 }