Merge Steve Murphy's (murf) complete re-implementation of AEL, which is now no longer...
[asterisk/asterisk.git] / pbx / ael / ael-test / ael-test5 / extensions.ael
1 ///////////////////////////////////////////////////////////////////////////////
2 // Helpdesk Queue
3
4 context hd-queue {
5         s => {
6                 NoOp(Add a background sound to tell the user their options);
7                 Queue(helpdesk|t);
8                 NoOp(Put in options to apologize and send user to voicemail);
9         };
10
11         0 => goto default|0|1;
12         1 => {
13                 Dial(u41950@svm1.shsu.edu);
14                 Congestion(10);
15                 Hangup;
16         };
17 };
18
19
20 context l903-calling {
21         _9903NXXXXXX => {
22                 Realtime(l903_ext,exchange,${EXTEN:4:3},l903_);
23                 if ("${l903_exchange}foo" = "foo") {
24                         Playback(num-outside-area);
25                         SayDigits(1);
26                         Playback(and-area-code);
27                         Playback(before-the-number);
28                         Hangup;
29                 };
30                 &dialout(${EXTEN});
31                 Congestion(10);
32                 Hangup;
33         };
34 };
35 ///////////////////////////////////////////////////////////////////////////////
36 // Extensions pulled from houston.conf
37 // Converted the extension list to the database
38
39 context houston-calling {
40         _9713NXXXXXX => {
41                 Realtime(hou_713_ext,exchange,${EXTEN:4:3},hou_713_);
42                 if ("${hou_713_exchange}foo" = "foo") {
43                         Playback(num-outside-area);
44                         SayDigits(1);
45                         Playback(and-area-code);
46                         Playback(before-the-number);
47                         Hangup;
48                 };
49                 &dialout(${EXTEN});
50                 Congestion(10);
51                 Hangup;
52         };
53
54         _9281NXXXXXX => {
55                 Realtime(hou_281_ext,exchange,${EXTEN:4:3},hou_281_);
56                 if ("${hou_281_exchange}foo" = "foo") {
57                         Playback(num-outside-area);
58                         SayDigits(1);
59                         Playback(and-area-code);
60                         Playback(before-the-number);
61                         Hangup;
62                 };
63                 &dialout(${EXTEN});
64                 Congestion(10);
65                 Hangup;
66         };
67
68         _9832NXXXXXX => {
69                 Realtime(hou_832_ext,exchange,${EXTEN:4:3},hou_832_);
70                 if ("${hou_832_exchange}foo" = "foo") {
71                         Playback(num-outside-area);
72                         SayDigits(1);
73                         Playback(and-area-code);
74                         Playback(before-the-number);
75                         Hangup;
76                 };
77                 &dialout(${EXTEN});
78                 Congestion(10);
79                 Hangup;
80         };
81 };
82
83
84 ///////////////////////////////////////////////////////////////////////////////
85 // Extensions pulled from huntsville.conf
86 // Converted the extension list to the database
87
88 context huntsville-calling {
89         _9NXXXXXX => {
90                 Realtime(hv_ext,exchange,${EXTEN:1:3},hv_);
91                 if ("${hv_exchange}foo" = "foo") {
92                         Playback(num-outside-area);
93                         SayDigits(1);
94                         Playback(and-area-code);
95                         Playback(before-the-number);
96                         Hangup;
97                 };
98                 &dialout(${EXTEN});
99                 Congestion(10);
100                 Hangup;
101         };
102
103         _NXXXXXX => {
104                 NoOp(Stripping last four to see what extension we're dialing);
105                 Set(LAST4=${EXTEN:3});
106                 StripLSD(4);
107         };
108
109         i => Playback(pbx-invalid);
110         h => Hangup;
111 };
112
113 ///////////////////////////////////////////////////////////////////////////////
114 // Extensions pulled from macros.conf
115
116 macro dialout( number ) {
117         Realtime(call_info,exten,${CALLERIDNUM:5},mon_);
118         if ("${mon_monitor}" = "YES") {
119                 Dial(SIP/${number}@sgw1.shsu.edu,,wW);
120                 Dial(SIP/${number}@sgw2.shsu.edu,,wW);
121         } else {
122                 Dial(SIP/${number}@sgw1.shsu.edu);
123                 Dial(SIP/${number}@sgw2.shsu.edu);
124         };
125 };
126
127 // Standard extension macro:
128 //  ${ext} - Extension
129 macro stdexten( ext ) {
130         Realtime(sipusers,name,${ext},sip_user_);
131         Realtime(call_info,exten|${ext},info_);
132         if ("${sip_user_name}foo" = "foo") {
133                 Wait(1);
134                 &dialout(${ext});
135                 Congestion(10);
136                 Hangup;
137         };
138         NoOp(${CALLERIDNUM});
139         RealtimeUpdate(call_info,exten,${ext},calltrace,${CALLERIDNUM});
140         System(/usr/local/bin/db_update.sh call_info calltrace ${CALLERIDNUM} exten ${ext} &);
141         &checkdnd(${ext});
142         &checkcf(${ext});
143         Realtime(call_info,exten,${CALLERIDNUM:5},mon_);
144         if ("${mon_monitor}" = "YES") {
145                 Dial(SIP/${info_forwardto},25,wW);
146         } else {
147                 Dial(SIP/${info_forwardto},25);
148         };
149         switch ("${DIALSTATUS}") {
150                 case "BUSY":
151                         &checkcfb(${ext});
152                         break;
153                 case "CHANUNAVAIL":
154                         Dial(IAX2/asterisk:password@scm2.shsu.edu/${info_forwardto},25,wW);
155                         MailboxExists(${ext});
156 //                      if ("${VMBOXEXISTSSTATUS}" = "FAILED") {
157 //                              Congestion(10);
158 //                              Hangup;
159 //                      };
160                         &uvm(${ext});
161                         Hangup;
162                         break;
163                 case "CONGESTION":
164                         MailboxExists(${ext});
165                         if ("${VMBOXEXISTSSTATUS}" = "FAILED") {
166                                 Congestion(10);
167                                 Hangup;
168                         };
169                         &bvm(${ext});
170                         Hangup;
171                         break;
172                 default:
173                         MailboxExists(${ext});
174                         if ("${VMBOXEXISTSSTATUS}" = "FAILED") {
175                                 Congestion(10);
176                                 Hangup;
177                         };
178                         &uvm(${ext});
179                         Hangup;
180         };
181         Hangup;
182 };
183
184 macro uvm( ext ) {
185         Dial(SIP/u${ext}@svm1.shsu.edu);
186         Playback(im-sorry);
187         Playback(voice-mail-system);
188         Playback(down);
189         Congestion(10);
190         Hangup;
191 };
192
193 macro bvm( ext ) {
194         Dial(SIP/b${ext}@svm1.shsu.edu);
195         Playback(im-sorry);
196         Playback(voice-mail-system);
197         Playback(down);
198         Congestion(10);
199         Hangup;
200 };
201
202 macro checkdnd( ext ) {
203         if ("${info_donotdisturb}foo" = "foo") {
204                 NoOp(Do Not Disturb is not active);
205         } else
206                 &uvm(${ext});
207 };
208
209 macro checkcf( ext ) {
210         if ("${info_forwardto}foo" = "foo")
211                 if ("${ext}" = "43974") {
212                         Set(info_forwardto=${ext}&SCCP/${ext});
213                 } else {
214                         Set(info_forwardto=${ext}&SIP/${ext}w);
215                 };
216 };
217
218 macro checkcfb( ext ) {
219         if ("${info_forwardbusy}foo" = "foo") {
220                 Wait(1);
221                 MailboxExists(${ext});
222                 if ("${VMBOXEXISTSSTATUS}" = "FAILED") {
223                         &dialout(${ext});
224                         Hangup;
225                 };
226                 &bvm(${ext});
227                 Hangup;
228         };
229         &stdexten(${info_forwardbusy});
230 };
231
232 ///////////////////////////////////////////////////////////////////////////////
233 // Extensions pulled from test.conf
234
235 context test-include {
236         includes {
237                 test-digium;
238                 test-sounds;
239                 test-phinfo;
240         };
241 };
242
243 context test-digium {
244         *500 => {
245                 Dial(IAX2/guest@misery.digium.com/s@default);
246                 Playback(demo-nogo);
247                 Hangup;
248         };
249 };
250
251 context test-sounds {
252         *501 => {
253                 Answer;
254                 Musiconhold;
255                 Wait(1);
256                 Hangup;
257         };
258 };
259
260 context test-phinfo {
261         *505 => {
262                 Answer;
263                 NoOp(${CALLERIDNUM:5});
264                 SayDigits(${CALLERIDNUM:5});
265                 Hangup;
266         };
267 };
268
269 ///////////////////////////////////////////////////////////////////////////////
270 // Extensions pulled from external.conf
271
272 context long-distance {
273         includes {
274                 local;
275         };
276
277         _91XXXXXXXXXX => &dialout(${EXTEN});
278         _9011. => &dialout(${EXTEN});
279 };
280
281 context local {
282         includes {
283                 default;
284         };
285
286         911 => &dialout(911);
287         9911 => &dialout(9911);
288
289         _9NXXXXXX => goto huntsville-calling|${EXTEN}|1;
290         _936NXXXXXX => {
291                 goto 9${EXTEN:3}|1;
292                 Congestion(10);
293                 Hangup;
294         };
295
296         _832NXXXXXX => {
297                 goto 9${EXTEN}|1;
298                 Congestion(10);
299                 Hangup;
300         };
301
302         _713NXXXXXX => {
303                 goto 9${EXTEN}|1 ;
304                 Congestion(10);
305                 Hangup;
306         };
307
308         _281NXXXXXX => {
309                 goto 9${EXTEN}|1;
310                 Congestion(10);
311                 Hangup;
312
313         };
314
315         _NXXNXXXXXX => {
316                 goto 9${EXTEN}|1;
317                 goto 91${EXTEN}|1;
318                 Congestion(10);
319                 Hangup;
320         };
321
322         _91800NXXXXXX => &dialout(${EXTEN});
323         _91866NXXXXXX => &dialout(${EXTEN});
324         _91877NXXXXXX => &dialout(${EXTEN});
325         _91888NXXXXXX => &dialout(${EXTEN});
326         _91900NXXXXXX => &dialout(${EXTEN});
327         _91976NXXXXXX => &dialout(${EXTEN});
328         _9713NXXXXXX => goto houston-calling|${EXTEN}|1;
329         _9281NXXXXXX => goto houston-calling|${EXTEN}|1;
330         _9832NXXXXXX => goto houston-calling|${EXTEN}|1;
331         _9903NXXXXXX => goto l903-calling|${EXTEN}|1;
332
333         _31NXXNXXXXXX => &dialout(${EXTEN});
334
335         h => Hangup;
336 };
337
338 ///////////////////////////////////////////////////////////////////////////////
339 // Extensions pulled from internal.conf
340
341 context from-scm2 {
342         _4XXXX => {
343                 NoOp(DIALING SIP EXTENSION ${EXTEN} - FROM ${CALLERIDNUM});
344                 Dial(SIP/${EXTEN},20,wW);
345                 Hangup;
346         };
347
348         _6XXXX => {
349                 NoOp(DIALING SIP EXTENSION ${EXTEN} - FROM ${CALLERIDNUM});
350                 Dial(SIP/${EXTEN},20,wW);
351                 Hangup;
352         };
353 };
354
355 ///////////////////////////////////////////////////////////
356 // All internal extensions work through the default context
357 // Phones that can only make internal calls should be in
358 // this context.
359 ///////////////////////////////////////////////////////////
360
361 context default {
362 // Include the contexts in the files that allow us to make these phone calls
363         includes {
364                 vm-include;
365                 apps-include;
366                 test-include;
367         };
368
369 // ALWAYS have an 'h' extension
370         h => {
371                 NoOp(Hangup cause was: ${HANGUPCAUSE});
372                 Hangup;
373         };
374
375 // We like to hear that we dialed an invalid extension
376         i => Playback(pbx-invalid);
377
378 // Dial the operator
379         0 => &dialout(0);
380
381 // Send voicemail calls to the vm-* contexts to be handled
382         voicemail => goto vm-direct|s|1;
383         5555 => goto vm-direct|s|1;
384         62100 => goto vm-extension|s|1;
385
386 // These are our campus extensions, send them to the macro
387         _6XXXX => &stdexten(${EXTEN});
388         _4XXXX => &stdexten(${EXTEN});
389 // These are campus extensions as well, might need to take this out though.
390         _9294XXXX => goto _4XXXX|1;
391         _9496XXXX => goto _6XXXX|1;
392
393 // These allows us to dial from the directory in our phone without worrying about dialing 9
394         _936294XXXX => {
395                 goto ${EXTEN:5}|1;
396                 goto 9${EXTEN:3}|1;
397                 Congestion(10);
398                 Hangup;
399         };
400
401         _936496XXXX => {
402                 goto ${EXTEN:5}|1;
403                 goto 9${EXTEN:3}|1;
404                 Congestion(10);
405                 Hangup;
406         };
407 };
408
409 ///////////////////////////////////////////////////////////////////////////////
410 // Extensions pulled from apps.conf
411
412 context apps-include {
413         includes {
414                 app-agents;
415                 app-dnd;
416                 app-callforward;
417                 app-calltrace;
418                 app-conferences;
419                 app-ssd;
420                 app-psd;
421                 app-idblock;
422                 app-helpdesk;
423                 app-dictate;
424                 app-set-monitor;
425         };
426 };
427
428 context app-agents {
429         *54 => {
430                 Answer;
431                 Wait(1);
432                 Read(agent_no|agent-user);
433                 AgentCallbackLogin(${agent_no}|s${CALLERIDNUM:5});
434                 Playback(agent-loginok);
435                 Hangup;
436         };
437
438         *55 => {
439                 Answer;
440                 Wait(1);
441                 AgentCallbackLogin(${agent_no});
442                 Hangup;
443         };
444 };
445
446 context app-calltrace {
447 // caller dials this to find out the last call missed and possibly call back
448         *69 => goto app-calltrace-perform|s|1;
449 };
450
451 context app-calltrace-perform {
452         s => {
453                 Answer;
454                 Wait(1);
455                 Background(info-about-last-call);
456                 Background(telephone-number);
457                 RealTime(call_info|exten|${CALLERIDNUM:5}|ct_);
458                 if ("${ct_calltrace}foo" = "foo") {
459                         Playback(loligo/from-unknown-caller);
460                         Hangup;
461                 } else {
462                         SayDigits("${ct_calltrace}");
463                         Set(TIMEOUT(digit)=3);
464                         Set(TIMEOUT(response)=7);
465                         Background(loligo/to-call-this-number);
466                         Background(press-1);
467                         Background(loligo/silence/5);
468                 };
469         };
470
471         1 => goto local|${ct_calltrace}|1;
472
473         i => {
474                 Playback(vm-goodbye);
475                 Hangup;
476         };
477
478         t => {
479                 Playback(vm-goodbye);
480                 Hangup;
481         };
482 };
483
484 context app-set-monitor {
485         *50 => {
486                 Realtime(call_info,exten,${CALLERIDNUM:5},mon_set_);
487                 if ("${mon_set_monitor}" = "YES") {
488                         RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},monitor|);
489                         System(/usr/local/bin/db_update.sh call_info monitor '' exten ${CALLERIDNUM:5} &);
490                 } else {
491                         RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},monitor,YES);
492                         System(/usr/local/bin/db_update.sh call_info monitor YES exten ${CALLERIDNUM:5} &);
493                 };
494                 NoOp(${mon_set_monitor});
495                 Hangup;
496         };
497 };
498
499 context app-dnd {
500         *78 => {
501                 Answer;
502                 Wait(1);
503                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},donotdisturb,YES);
504                 System(/usr/local/bin/db_update.sh call_info donotdisturb YES exten ${CALLERIDNUM:5} &);
505                 Playback(do-not-disturb);
506                 Playback(loligo/activated);
507                 Hangup;
508         };
509
510         *79 => {
511                 Answer;
512                 Wait(1);
513                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},donotdisturb|);
514                 System(/usr/local/bin/db_update.sh call_info donotdisturb '' exten ${CALLERIDNUM:5} &);
515                 Playback(do-not-disturb);
516                 Playback(loligo/de-activated);
517                 Hangup;
518         };
519 };
520
521 context app-callforward {
522         // forwards calling extension to input number *72{EXTEN}
523         _*72. => {
524                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},forwardto,${EXTEN:3});
525                 System(/usr/local/bin/db_update.sh call_info forwardto ${EXTEN:3} exten ${CALLERIDNUM:5} &);
526                 Answer;
527                 Wait(1);
528                 Playback(loligo/call-fwd-unconditional);
529                 Playback(loligo/for);
530                 Playback(loligo/extension);
531                 SayDigits(${CALLERIDNUM:5});
532                 Playback(loligo/is-set-to);
533                 SayDigits(${EXTEN:3});
534                 Hangup;
535         };
536
537         // prompts for extension to forward to
538         *72 => {
539                 Answer;
540                 Wait(1);
541                 Playback(please-enter-your);
542                 Playback(extension);
543                 Background(then-press-pound);
544                 VMAuthenticate(|s);
545                 Background(loligo/ent-target-attendant);
546                 Read(toext,loligo/then-press-pound);
547                 Wait(1);
548                 RealtimeUpdate(call_info,exten,${AUTH_MAILBOX},forwardto,${toext});
549                 System(/usr/local/bin/db_update.sh call_info forwardto ${toext} exten ${AUTH_MAILBOX} &);
550                 Playback(loligo/call-fwd-unconditional);
551                 Playback(loligo/for);
552                 Playback(loligo/extension);
553                 SayDigits(${AUTH_MAILBOX});
554                 Playback(loligo/is-set-to);
555                 SayDigits(${toext});
556                 Hangup;
557         };
558
559         // cancels dialed extension call forward
560         _*73. => {
561                 Realtime(voicemail,mailbox,${EXTEN:3},auth_);
562                 Answer;
563                 Wait(1);
564                 Authenticate(${auth_password});
565                 RealtimeUpdate(call_info,exten,${EXTEN:3},forwardto,);
566                 System(/usr/local/bin/db_update.sh call_info forwardto '' exten ${EXTEN:3} &);
567                 Wait(1);
568                 SayDigits(${EXTEN:3});
569                 Playback(loligo/call-fwd-cancelled);
570                 Hangup;
571         };
572
573         // cancels call forward for calling extension
574         *73 => {
575                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},forwardto,);
576                 System(/usr/local/bin/db_update.sh call_info forwardto '' exten ${CALLERIDNUM:5} &);
577                 Answer;
578                 Wait(1);
579                 Playback(loligo/call-fwd-cancelled);
580                 Hangup;
581         };
582
583         // dialed call forward on busy
584         _*90. => {
585                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},forwardbusy,${EXTEN:3});
586                 System(/usr/local/bin/db_update.sh call_info forwardbusy ${EXTEN:3} exten ${CALLERIDNUM:5} &);
587                 Answer;
588                 Wait(1);
589                 Playback(loligo/call-fwd-on-busy);
590                 Playback(loligo/for);
591                 Playback(loligo/extension);
592                 SayDigits(${CALLERIDNUM:5});
593                 Playback(loligo/is-set-to);
594                 SayDigits(${EXTEN:3});
595                 Hangup;
596         };
597
598         // cancels call forward on busy for calling extension
599         *91 => {
600                 RealtimeUpdate(call_info,exten,${CALLERIDNUM:5},forwardbusy|);
601                 System(/usr/local/bin/db_update.sh call_info forwardbusy '' exten ${CALLERIDNUM:5} &);
602                 Answer;
603                 Wait(1);
604                 Playback(loligo/call-fwd-on-busy);
605                 Playback(loligo/de-activated);
606                 Hangup;
607         };
608
609         h => Hangup;
610 };
611
612 context app-idblock {
613         _*67. => {
614                 Set(CALLERID(name)=Anonymous);
615                 &stdexten(${EXTEN:3});
616         };
617 };
618
619 context app-dictate {
620         *1 => {
621                 Dictate();
622                 Hangup;
623         };
624 };
625
626 context app-ssd {
627 // *59 <xx> <y.> - Set system speed dial <xx> to digits <y.>
628 // *59 <xx> 0    - Delete system speed dial <xx>
629 // *59 <xx>      - Review system speed dial <xx>
630 // *1xx          - Dial speed dial <xx>
631         _*59XXX. => {
632                 Answer;
633                 RealtimeUpdate(ssd,sd,${EXTEN:3:2},extension,${EXTEN:5});
634                 System(/usr/local/bin/db_update.sh systemsd extension ${EXTEN:5} sd ${EXTEN:3:2} &);
635                 Wait(1);
636                 Playback(loligo/speed-dial);
637                 SayDigits(${EXTEN:3:2});
638                 Playback(loligo/has-been-set-to);
639                 SayDigits(${EXTEN:5});
640                 Hangup;
641         };
642
643         _*59XX0 => {
644                 Answer;
645                 RealtimeUpdate(ssd,sd,${EXTEN:3:2},extension,);
646                 System(/usr/local/bin/db_update.sh systemsd extension '' sd ${EXTEN:3:2} &);
647                 Wait(1);
648                 Playback(loligo/speed-dial);
649                 SayDigits(${EXTEN:3:2});
650                 Playback(loligo/has-been-cleared);
651                 Hangup;
652         };
653
654         _*59XX => {
655                 Answer;
656                 Realtime(ssd,sd,${EXTEN:3},ssd_);
657                 if ("${ssd_extension}foo" = "foo") {
658                         Playback(loligo/speed-dial);
659                         SayDigits(${EXTEN:3:2});
660                         Playback(loligo/is-not-set);
661                         Hangup;
662                 };
663                 Wait(1);
664                 Playback(loligo/speed-dial);
665                 SayDigits(${EXTEN:3:2});
666                 Playback(loligo/is-set-to);
667                 SayDigits(${ssd_extension});
668                 Hangup;
669         };
670
671         // NTC = number to call
672         _*1XX => {
673                 Realtime(ssd,sd,${EXTEN:2},ssd_);
674                 if ("${ssd_extension}foo" = "foo") {
675                         Answer;
676                         Wait(1);
677                         Playback(loligo/speed-dial);
678                         SayDigits(${EXTEN:2});
679                         Playback(loligo/is-not-set);
680                         Hangup;
681                 };
682                 &stdexten(${ssd_extension});
683                 Congestion(10);
684                 Hangup;
685         };
686 };
687
688 macro check-psd-exists ( ext ) {
689         Realtime(psd,extension,${ext},psd_);
690         if ("${psd_extension}foo" = "foo") {
691                 System(/usr/local/bin/create_psd.sh ${ext});
692         } else
693                 NoOp(PSD set for ${ext});
694 };
695
696 context app-psd {
697 // *89 <xx> <y.> - Set personal speed dial <xx> to digits <y.>
698 // *89 <xx> 0    - Delete personal speed dial <xx>
699 // *89 <xx>      - Review personal speed dial <xx>
700 // *2xx          - Dial personal speed dial <xx>
701         _*89XXX. => {
702                 &check-psd-exists(${CALLERIDNUM:5});
703                 Answer;
704                 RealtimeUpdate(psd,extension,${CALLERIDNUM:5},s${EXTEN:3:2},${EXTEN:5});
705                 System(/usr/local/bin/db_update.sh personalsd s${EXTEN:3:2} ${EXTEN:5} extension ${CALLERIDNUM:5} &);
706                 Wait(1);
707                 Playback(loligo/speed-dial);
708                 SayDigits(${EXTEN:3:2});
709                 Playback(loligo/has-been-set-to);
710                 SayDigits(${EXTEN:5});
711                 Hangup;
712         };
713
714         _*89XX0 => {
715                 &check-psd-exists(${CALLERIDNUM:5});
716                 Answer;
717                 RealtimeUpdate(psd|extension|${CALLERIDNUM:5}|s${EXTEN:3:2}|);
718                 System(/usr/local/bin/db_update.sh personalsd s${EXTEN:3:2} '' extension ${CALLERIDNUM:5} &);
719                 Wait(1);
720                 Playback(loligo/speed-dial);
721                 SayDigits(${EXTEN:3:2});
722                 Playback(loligo/has-been-cleared);
723                 Hangup;
724         };
725
726         _*89XX => {
727                 &check-psd-exists(${CALLERIDNUM:5});
728                 Answer;
729                 Realtime(psd|extension|${CALLERIDNUM:5}|psd_);
730                 Wait(1);
731                 if ("${psd_s${EXTEN:3:2}}foo" = "foo") {
732                         Playback(loligo/speed-dial);
733                         SayDigits(${EXTEN:3:2});
734                         Playback(loligo/is-not-set);
735                         Hangup;
736                 };
737                 Playback(loligo/speed-dial);
738                 SayDigits(${EXTEN:3:2});
739                 Playback(loligo/is-set-to);
740                 SayDigits(${psd_s${EXTEN:3:2}});
741                 Hangup;
742         };
743
744         // NTC = number to call
745         _*2XX => {
746                 &check-psd-exists(${CALLERIDNUM:5});
747                 Realtime(psd|extension|${CALLERIDNUM:5}|psd_);
748                 if ("${psd_s${EXTEN:2}}foo" = "foo") {
749                         Answer;
750                         Wait(1);
751                         Playback(loligo/speed-dial);
752                         SayDigits(${EXTEN:2});
753                         Playback(loligo/is-not-set);
754                         Hangup;
755                 };
756                 &stdexten(${psd_s${EXTEN:2}});
757                 Congestion(10);
758                 Hangup;
759         };
760 };
761
762 context app-helpdesk {
763         *4357 => {
764                 &stdexten(41950);
765                 Congestion;
766         };
767 };
768
769 context app-conferences {
770 // waiting for room number announcement
771         *86 => goto app-conf-hidden|s|1;
772 };
773
774 context app-conf-hidden {
775         s => {
776                 Wait(1);
777                 Playback(loligo/please-enter-the);
778                 Playback(loligo/extension);
779                 read(roomtoenter,loligo/then-press-pound);
780                 Meetme(${roomtoenter});
781                 Waitexten(8);
782                 Hangup;
783         };
784
785         _1. => Meetme(${EXTEN});
786 };
787
788 ///////////////////////////////////////////////////////////////////////////////
789 // Extensions pulled from vm.conf:
790
791 context vm-include {
792         includes {
793                 vm-direct;
794                 vm-extension;
795                 vm-directory;
796         };
797 };
798
799 context vm-direct {
800         s => {
801                 Dial(SIP/5555@svm1.shsu.edu,20);
802                 Playback(im-sorry);
803                 Playback(voice-mail-system);
804                 Playback(down);
805                 Playback(extra/pls-try-call-later);
806                 Congestion(10);
807                 Hangup;
808         };
809 };
810
811 context vm-extension {
812         s => {
813                 Dial(SIP/62100@svm1.shsu.edu,20);
814                 Playback(im-sorry);
815                 Playback(voice-mail-system);
816                 Playback(down);
817                 Playback(extra/pls-try-call-later);
818                 Congestion(10);
819                 Hangup;
820         };
821 };
822
823 context vm-directory {
824         5556 => {
825                 Dial(SIP/5556@svm1.shsu.edu);
826                 Playback(im-sorry);
827                 Playback(voice-mail-system);
828                 Playback(down);
829                 Playback(extra/pls-try-call-later);
830                 Congestion(10);
831                 Hangup;
832         };
833 };