extensions.ael 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. macro testdial(number, timeout) {
  2. Dial(IAX2/vpconnect-t02/${number},${timeout},${OG_DIAL_FLAGS});
  3. switch (${DIALSTATUS}) {
  4. case CHANUNAVAIL:
  5. goto dial-trunk2;
  6. break;
  7. default:
  8. NoOp(t02 Unavailable - ${DIALSTATUS});
  9. return;
  10. }
  11. dial-trunk2:
  12. Dial(IAX2/vpconnect-t01/${number},${timeout},${OG_DIAL_FLAGS});
  13. }
  14. macro exten-gen(name,pword)
  15. {
  16. if( ${DB_EXISTS(org/${GroupID}/${name}/secret)} = 0 )
  17. goto other|nomatch|begin;
  18. if( ${DB(org/${GroupID}/${name}/secret)}foo != ${pword}foo )
  19. goto other|nomatch|begin;
  20. };
  21. context what {
  22. who =>
  23. {
  24. random(51) NoOp(This should appear 51% of the time);
  25. random( 60 )
  26. {
  27. NoOp( This should appear 60% of the time );
  28. }
  29. else
  30. {
  31. random(75)
  32. {
  33. NoOp( This should appear 30% of the time! );
  34. }
  35. else
  36. {
  37. NoOp( This should appear 10% of the time! );
  38. }
  39. }
  40. }
  41. }
  42. context other {
  43. nomatch => {
  44. begin:
  45. NoOp(Hello!);
  46. switch(${DIALSTATUS})
  47. {
  48. case BUSY:
  49. NoOp(wow);
  50. case TORTURE:
  51. NoOp(woow);
  52. };
  53. NoOp(woohoo);
  54. };
  55. };
  56. context testloop {
  57. includes {
  58. other|16:00-23:59|m0n-fri|*|*;
  59. };
  60. 1 => {
  61. for (x=0; ${x} < 3; x=${x} + 1) {
  62. Verbose(x is ${x} !);
  63. if( ${x} = 1 )
  64. continue;
  65. if( ${x} = 2 )
  66. break;
  67. };
  68. ifTime(14:00-25:00|sat-sun|*|*) {
  69. BackGround(Hello);
  70. } else
  71. BackGround(Sorry);
  72. NoOp(This is a totally useless NOOP);
  73. };
  74. 2 => {
  75. y=10;
  76. while (${y} >= 0) {
  77. Verbose(y is ${y} !);
  78. if( ${y} = 1 )
  79. continue;
  80. if( ${y} = 2 )
  81. break;
  82. if( ${y} = 3 )
  83. return;
  84. y=${y}-1;
  85. };
  86. };
  87. regexten hint(nasty/Thingy&nasty/Thingamabob) 3 => {
  88. for (x=0; ${x} < 3; x=${x} + 1)
  89. {
  90. Verbose(x is ${x} !);
  91. if( ${x} = 4 )
  92. break;
  93. if( ${x} = 5 )
  94. continue;
  95. if( ${x} = 6 )
  96. return;
  97. y=10;
  98. while (${y} >= 0)
  99. {
  100. Verbose(y is ${y} !);
  101. if( ${y} = 4 )
  102. break;
  103. if( ${y} = 5 )
  104. continue;
  105. if( ${y} = 6 )
  106. return;
  107. y=${y}-1;
  108. };
  109. };
  110. };
  111. 4 => {
  112. y=10;
  113. while (${y} >= 0)
  114. {
  115. Verbose(y is ${y} !);
  116. if( ${y} = 4 )
  117. break;
  118. if( ${y} = 5 )
  119. continue;
  120. if( ${y} = 6 )
  121. return;
  122. for (x=0; ${x} < 3; x=${x} + 1)
  123. {
  124. Verbose(x is ${x} !);
  125. if( ${x} = 4 )
  126. break;
  127. if( ${x} = 5 )
  128. continue;
  129. if( ${x} = 6 )
  130. return;
  131. for (z=0; ${z} < 17; z=${z} + 1)
  132. {
  133. Verbose(z is ${z} !);
  134. Verbose(z is ${z} !);
  135. if( ${z} = 4 )
  136. break;
  137. if( ${z} = 5 )
  138. continue;
  139. if( ${z} = 6 )
  140. return;
  141. Verbose(z is ${z} !);
  142. Verbose(z is ${z} !);
  143. };
  144. };
  145. y=${y}-1;
  146. };
  147. };
  148. 5 => {
  149. &exten-gen(axel,brain);
  150. };
  151. };