-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathextensions-pngnpbx-abc-v16d.ael2
1072 lines (932 loc) · 48.2 KB
/
extensions-pngnpbx-abc-v16d.ael2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************************************
* *
* Always Be Conferencing (ABC) *
* *
* Creator: chris @ Penguin PBX Solutions *
* Version: 16d "Super Palindrome Tin Can Bowl Edition" *
* Release: 2020-02-02 *
* License: Creative Commons Zero v1.0 Universal (CC0 1.0) *
* *
****************************************************************************/
/*
Howdy
=====
ABC starts your Conference Bridge in ASTERISK(R) by Originating calls
to other participants. Friends will be joined *before* they answer the call
and they will hear an A4-B4-C4 tune upon entering. Conference will continue
until all parties disconnect - so the original caller can hang up, even
before the call is connected to any other participants, and those
yet-to-answer participants can chat amongst themselves when they finally
do answer the call. (There are no marked or admin users.)
If this is your first time using AEL, the ASTERISK Extension Language, then
you may need to manually load the module, or take other steps. This may include
rebuilding from source code eg. selecting the module when using "make menuconfig".
Tin Can Mode
============
If you choose this mode, then ABC will use Dial() instead of Originate() at the
start of the call to the remote end. This is to help satisfy requirements in
some situations where it is deemed desirable to only route the call and not
answer the caller via immediate bridging. This works by adding a ChanSpy() on
the caller, so that friends who answer can talk to the caller, and other
friends, even *before* the remote end answers the phone.
Tin Can Mode WARNING
====================
There are several potential shortcomings in Tin Can mode compared to Simple
Mode, including the following caveats:
1. In Simple Mode, everyone always gets access to DTMF menu options, because
they are always in the conference.
2. In Tin Can Mode, callers will not get access to DTMF menu options until
the remote end answers. Then, everyone will get the access, same as Simple
Mode. However, at any time, callers can ask friends on the bridge to press
options like splat YOU ARE HERE -- even before the remote end answers.
3. In Tin Can Mode, there may be a few more frames of feedback immediately
after the remote end answers. (TODO: Fix this in a future release.)
4. In Tin Can Mode ONLY, when caller hangs up before remote end answers, then
the call will drop. (TODO: Fix this in a future release.)
DTMF WARNING
============
DTMF pass through is currently not tested well. DTMF is restricted to menu
options. (TODO: should the need arise to navigate an IVR, you can press 1 then
the number and the single digit will be transmitted: 11 to send 1, 12 -> 2, etc.)
LOGGING
=======
Call Detail Records will be saved in files based on whatever ABC type name
you specify ie. the account code will be set to this name on all channels.
In the examples (below) it would be "abctest.csv" in the same directory
as your "Master.csv" (assuming you are using CSV for CDRs.)
Optionally you can record the call (see example #2 below).
Look for the recordings in "/var/spool/asterisk/monitor/" directory.
The ABC type name will be used to prefix the files (one file per leg.)
CAREFUL when recording eg. legal issues, drive space, privacy, etc.
EXAMPLES
========
This file is configured in the ASTERISK Extension Language. But you should not
need to edit this file very often, if ever. It only needs to be included into
your dialplan. Please set your copy to read-only permission during install.
Then, you'll want to edit (or create) this file: /etc/asterisk/extensions.ael
And add this line: #include "extensions-pngnpbx-abc-CURRENTVERSION.ael2"
...replacing CURRENTVERSION with, for example, v16d
If this is your first AEL file, then you can probably make this the only line.
Otherwise, place the line immediately following any existing "general" context.
After that, then you can use it from standard dial plan in "extensions.conf"
-- or "extensions_custom.conf" if you are using FreePBX(R) -- via a context
similar to the following...
Example #1:
-----------
[from-internal-custom-abc-example-1]
exten = 922,1,NoOp() ; Choose your own extension numbers.
same = n,NoOp(placeholder) ; TBD
same = n,Log(VERBOSE,Always Be Conferencing - PenguinPBX.com) ; Please copy and change as you wish!
same = n,Set(ABCTO=933) ; CHANGE ME! Remapping of the dial to another number (if any.)
same = n,Set(path=PJSIP/${ABCTO}@#YOUR-TRUNK#) ; CHANGE ME! Endpoint section defined in your PJSIP configuration.
same = n,Set(callback=3035557729) ; CHANGE ME! Your call-back telephone number (probably 10 digits in the USA.)
same = n,Set(friend=PJSIP/1113) ; CHANGE ME! The local PJSIP endpoint to bridge into the call.
same = n,Set(abctypename=abctest) ; CHANGE ME! Use abctest as the conf type name.
same = n,Set(ringtime=120) ; MAYBE CHANGE ME! Rings remote end / path for 2 minutes.
same = n,AELSub(pngnpbx-abc-simple,${abctypename}) ; Simple setup. (Either "abc-simple", "abc-init" or "abc-tincan" must be first.)
same = n,AELSub(pngnpbx-abc-path,1,${ringtime},${path}) ; Set the first (and only) call path to use on call to remote end.
same = n,AELSub(pngnpbx-abc-remote,${callback},static) ; Originate out the path/trunk using your call-back number as the Caller ID number.
same = n,AELSub(pngnpbx-abc-friend,1,${friend}) ; Bridge in the other attendee automatically.
same = n,AELSub(pngnpbx-abc-howdy-yall) ; Enter the conference. No more dial plan processing occurs for caller.
Once something like that is in your dial plan, check for errors, and reload the
PBX configuration. Then check for errors again. (Test your ABC on a test system.)
You can do this on the Asterisk CLI> dialplan reload
Then, if you have a PBX GUI, you'd want to open that up and point something at
the extension number. Probably a Custom Destination or Custom Extension. Please
refer to the best way to include custom dial plan into your existing PBX setup.
Also, here is the same Example #1, but in extensions.AEL configuration,
instead of standard extensions.CONF format:
context from-internal-custom-abc-example-1-ael {
922 => {
NoOp();
NoOp(placeholder);
Log(VERBOSE,Always Be Conferencing - PenguinPBX.com); // Please copy and change as you wish!
Set(ABCTO=933) // CHANGE ME! Remapping of the dial to another number (if any.)
Set(path=PJSIP/${ABCTO}@#YOUR-TRUNK#); // CHANGE ME! Endpoint section defined in your PJSIP configuration.
Set(callback=3035557729); // CHANGE ME! Your call-back telephone number (probably 10 digits in the USA.)
Set(friend=PJSIP/1113); // CHANGE ME! The local PJSIP endpoint to bridge into the call.
Set(abctypename=abctest); // CHANGE ME! Use abctest as the conf type name.
Set(ringtime=120); // MAYBE CHANGE ME! Rings remote end / path for 2 minutes.
&pngnpbx-abc-simple(${abctypename}); // Simple setup. (Either "abc-simple", "abc-init" or "abc-tincan" must be first.)
&pngnpbx-abc-path(1,${ringtime},${path}); // Set the first (and only) call path to use on call to remote end.
&pngnpbx-abc-remote(${callback},static); // Originate out the path/trunk using your call-back number as the Caller ID number.
&pngnpbx-abc-friend(1,${friend}); // Bridge in the other attendee automatically.
&pngnpbx-abc-howdy-yall(); // Enter the conference. No more dial plan processing occurs for caller.
}
}
; Including this line, there are currently 175 example lines below.
; You can use vim in command mode, then enter: 175yy
; That will copy them (and then paste out into new file window with "p".)
; Example #2:
; -----------
; * Adds multiple remote paths.
; * Adds call recording.
; * Adds geolocation.
; * Adds additional friend phones.
; * Adds all 15 extension numbers 1101-1115 from basic-pbx sample
; pjsip.conf file as found in Asterisk certified version 16.3-cert1
; from Dec 2019.
[from-internal-custom-abc-example-2]
exten = 922,1,NoOp()
same = n,NoOp(placeholder)
same = n,Log(VERBOSE,Always Be Conferencing - PenguinPBX.com) ; Please copy and change as you wish!
same = n,Set(ABCTO=933) ; CHANGE ME! Remapping of the dial to another number (if any.)
same = n,Set(gpsurl=https://abc.penguinpbx.com/loc/) ; CHANGE ME! URL that will be included in Geolocation SIP header.
same = n,Set(path1=DAHDI/#YOUR-TRUNK-1#/${ABCTO}) ; CHANGE ME! Endpoint section defined in your DAHDI configuration.
same = n,Set(path2=PJSIP/${ABCTO}@#YOUR-TRUNK-2#) ; CHANGE ME! A PJSIP endpoint section - used if first path is down/unreachable.
same = n,Set(path3=PJSIP/${ABCTO}@#YOUR-TRUNK-3#) ; CHANGE ME! Yet another endpoint section defined in your PJSIP configuration.
same = n,AELSub(pngnpbx-abc-init,abctest,record,3600,,announce,) ; Use abctest as the conf type name, save WAVs, limit to 1 hour, and announce GPS.
same = n,AELSub(pngnpbx-abc-path,1,10,${path1}) ; Set the first call path / trunk name to use on call to remote end. Ring 10 seconds.
same = n,AELSub(pngnpbx-abc-path,2,60,${path2}) ; Set the second call path - used only on failover of first call path. Ring 1 minute.
same = n,AELSub(pngnpbx-abc-path,3,300,${path3}) ; Set the third call path - used only on failover of second call path. Ring 5 minutes.
same = n,NoOp(About to change flow based on caller ID number.)
same = n,Set(cleancid=${FILTER(a-zA-Z0-9,${CALLERID(num)})})
same = n,Set(gotdp=${DIALPLAN_EXISTS(${CONTEXT},${EXTEN},x${cleancid})})
same = n,GotoIf($[${gotdp}]?x${cleancid})
; C-Level
; These two phones are in the same 10m square open area.
same = n(x1107),NoOp()
same = n(x1111),NoOp()
same = n,AELSub(pngnpbx-abc-gps,39.739,-104.990,${gpsurl}) ; Set Geolocation SIP header to URL and GPS co-ordinates #1.
same = n,AELSub(pngnpbx-abc-sa,144 W Colfax Ave,Denver,CO,80202) ; Street Address, city name, state abbreviation, zip code
same = n,AELSub(pngnpbx-abc-ai,W side of Park) ; Additional Information. SA + AI = Dispatchable Location
same = n,AELSub(pngnpbx-abc-remote,3035557729,static) ; Originate out the trunk(s).
same = n,Goto(friends)
; Customer Experience - Picnic Shelter 4
; These four other phones are in another 10m square open area.
; With Different Additional Information. SA + AI = Dispatchable Location
same = n(x1101),NoOp()
same = n(x1102),NoOp()
same = n(x1115),NoOp()
same = n,AELSub(pngnpbx-abc-gps,39.739,-104.990,${gpsurl})
same = n,AELSub(pngnpbx-abc-sa,144 W Colfax Ave,Denver,CO,80202)
same = n,AELSub(pngnpbx-abc-ai,Picnic Shelter 4)
same = n,AELSub(pngnpbx-abc-remote,3035557729,static)
same = n,Goto(friends)
; Park Gazebo for Software Engineers
same = n(x1110),NoOp()
same = n(x1104),NoOp()
same = n(x1113),NoOp()
same = n(x1114),NoOp()
same = n,AELSub(pngnpbx-abc-gps,39.739,-104.990,${gpsurl})
same = n,AELSub(pngnpbx-abc-sa,144 W Colfax Ave,Denver,CO,80202)
same = n,AELSub(pngnpbx-abc-ai,Gazebo)
same = n,AELSub(pngnpbx-abc-remote,3035557729,static)
same = n,Goto(friends)
; Directors and all others sit together in the Ampitheater
same = n(x1103),NoOp()
same = n(x1106),NoOp()
same = n(x1108),NoOp()
same = n,AELSub(pngnpbx-abc-gps,39.739,-104.990,${gpsurl})
same = n,AELSub(pngnpbx-abc-sa,144 W Colfax Ave,Denver,CO,80202)
same = n,AELSub(pngnpbx-abc-ai,Ampitheater)
same = n,AELSub(pngnpbx-abc-remote,3035557729,static)
same = n,Goto(friends)
; Remote office location in the Mountains for Sales
same = n(x1105),NoOp()
same = n(x1109),NoOp()
same = n(x1112),NoOp()
same = n,AELSub(pngnpbx-abc-gps,39.588,-105.644,${gpsurl}) ; Set Geolocation SIP header to URL and GPS co-ordinates #2.
same = n,AELSub(pngnpbx-abc-sa,Mount Evans Ridge,Idaho Springs,CO,80452) ; Street Address, city name, state abbreviation, zip Code
same = n,AELSub(pngnpbx-abc-ai,Floor 42) ; Additional Information. SA + AI = Dispatchable Location
same = n,AELSub(pngnpbx-abc-remote,7205557729,static) ; Originate out the trunk(s) using a different call-back number as the Caller ID number.
same = n,Goto(friends)
same = n(friends),NoOp()
same = n,Log(VERBOSE,Remote dial started. Now adding friends to call.) ; Most critical is the remote call.
same = n,AELSub(pngnpbx-abc-friend,1,PJSIP/1113) ; Bridge in friend.
same = n,AELSub(pngnpbx-abc-friend,2,PJSIP/1111) ; Bridge in another friend.
same = n,AELSub(pngnpbx-abc-friend,3,PJSIP/1109) ; Bridge in yet another friend. (Up to 20 total participants by default.)
same = n,AELSub(pngnpbx-abc-howdy-yall) ; Enter the conference. No more dial plan processing occurs for caller.
; Example #3:
; -----------
; * Needs two contexts.
; * Adds nine Dynamic Call Back numbers.
; * Adds local call back option with 922*EXTENSION
; * Requires call backs be registered by dialing 123222*NUMBER
[from-external-custom-abc-example-3]
exten = 3035551111,1,AELSub(pngnpbx-abc-reentry,1,${EXTEN},${abclo}) ; Place the dynamic call back DIDs here, one per line (copy/paste/edit.)
exten = 3035552222,1,AELSub(pngnpbx-abc-reentry,2,${EXTEN},${abclo}) ; Do not change anything except for the phone numbers and position number.
exten = 3035553333,1,AELSub(pngnpbx-abc-reentry,3,${EXTEN},${abclo}) ; You should not provision these DIDs anywhere else in your PBX.
exten = 3035554444,1,AELSub(pngnpbx-abc-reentry,4,${EXTEN},${abclo}) ; This is particularly useful for waiting areas without call back numbers.
exten = 3035555555,1,AELSub(pngnpbx-abc-reentry,5,${EXTEN},${abclo}) ; The abclo variable is for loading new call backs into internal AstDB.
exten = 3035556666,1,AELSub(pngnpbx-abc-reentry,6,${EXTEN},${abclo})
exten = 3035557777,1,AELSub(pngnpbx-abc-reentry,7,${EXTEN},${abclo})
exten = 3035558888,1,AELSub(pngnpbx-abc-reentry,8,${EXTEN},${abclo})
exten = 3035559999,1,AELSub(pngnpbx-abc-reentry,9,${EXTEN},${abclo})
[from-internal-custom-abc-example-3]
exten = 922,1,NoOp()
same = n,NoOp(placeholder)
same = n,Log(VERBOSE,Always Be Conferencing - PenguinPBX.com) ; Please copy and change as you wish!
same = n,Set(ABCTO=933) ; CHANGE ME! Remapping of the dial to another number (if any.)
same = n,Set(path=PJSIP/${ABCTO}@#YOUR-TRUNK#) ; CHANGE ME! Endpoint section defined in your PJSIP configuration.
same = n,Set(defaultcallback=3035550000) ; CHANGE ME! Default call back number used if dynamic allocation fails.
same = n,Set(friend=PJSIP/1113) ; CHANGE ME! The local PJSIP endpoint to bridge into the call.
same = n,Set(abctypename=abctest) ; CHANGE ME! Use abctest as the conf type name.
same = n,Set(ringtime=120) ; MAYBE CHANGE ME! Rings remote end / path for 2 minutes.
same = n,AELSub(pngnpbx-abc-simple,${abctypename}) ; Simple setup. (Either "abc-simple", "abc-init" or "abc-tincan" must be first.)
same = n,AELSub(pngnpbx-abc-path,1,${ringtime},${path}) ; Set the first (and only) call path to use on call to remote end.
same = n,AELSub(pngnpbx-abc-remote,${defaultcallback},dynamic) ; Originate out the path/trunk using a dynamic call-back number as the Caller ID number.
same = n,AELSub(pngnpbx-abc-friend,1,${friend}) ; Bridge in the other attendee automatically.
same = n,AELSub(pngnpbx-abc-howdy-yall) ; Enter the conference. No more dial plan processing occurs for caller.
exten = _922*XXXX,1,NoOp(get back to conf locally) ; Useful if a friend falls off the wagon. They can get back on the bridge themselves.
exten = _922*XXXX/1113,n,NoOp() ; Check if they are your friend. Based on caller ID number.
exten = _922*XXXX/1107,s,NoOp() ; Didn't try to automatically bridge this friend but let them join later manually.
exten = _922*XXXX/1111,s,NoOp() ; Didn't try to automatically bridge this friend but let them join later manually.
exten = _922*XXXX/1103,s,NoOp() ; Didn't try to automatically bridge this friend but let them join later manually.
exten = _922*XXXX/1106,s,NoOp() ; Didn't try to automatically bridge this friend but let them join later manually.
exten = _922*XXXX,s,Hangup() ; No non-friends allowed.
exten = _922*XXXX,n,NoOp()
same = n,Set(abcconfid=${FILTER(a-zA-Z0-9,${EXTEN:4})})
same = n,Goto(pngnpbx-abc-bridge,${abcconfid},1)
exten = _123222*NXXNXXXXXX,1,NoOp(number loading) ; Dial this each time you change dynamic call back DIDs.
same = n,Set(abclo=yes)
same = n,Set(did=${CUT(EXTEN,*,2)})
same = n,Goto(from-external-custom-abc-example-3,${did},1)
; Example #4:
; -----------
; Using "Tin Can" mode for Dial to remote instead of Originate.
; Please see "Tin Can Mode WARNING" near the top of this file.
[from-internal-custom-abc-example-4]
exten = 922,1,NoOp()
same = n,NoOp(placeholder)
same = n,Log(VERBOSE,Always Be Conferencing - PenguinPBX.com) ; Please copy and change as you wish!
same = n,Set(ABCTO=933) ; CHANGE ME! Remapping of the dial to another number (if any.)
same = n,Set(ABCTRUNK=#YOUR-TRUNK#) ; CHANGE ME! Remapping of the dial to another number (if any.)
same = n,Set(ABCPATH=PJSIP/${ABCTO}@${ABCTRUNK}) ; CHANGE ME! Endpoint section defined in your PJSIP configuration.
same = n,Set(ABCCALLBACK=3035550000) ; CHANGE ME! Default call back number used if dynamic allocation fails.
same = n,Set(ABCFRIEND=PJSIP/1113) ; CHANGE ME! The local PJSIP endpoint to bridge into the call.
same = n,Set(ABCTYPENAME=abctest) ; CHANGE ME! Use abctest as the conf type name.
same = n,Set(ABCRINGTIME=120) ; MAYBE CHANGE ME! Rings remote end / path for 2 minutes.
same = n,AELSub(pngnpbx-abc-tincan,${ABCTYPENAME}) ; Tin Can mode. Uses Dial instead of Originate to the remote.
same = n,AELSub(pngnpbx-abc-path,1,${ABCRINGTIME},${ABCPATH}) ; Set the first (and only) call path to use on call to remote end.
same = n,AELSub(pngnpbx-abc-remote,${ABCCALLBACK},static) ; In Tin Can mode, this spawns Originate to a ChanSpy dummy not the remote end.
same = n,AELSub(pngnpbx-abc-friend,1,${ABCFRIEND}) ; Bridge in the other attendee automatically.
same = n,AELSub(pngnpbx-abc-howdy-yall) ; In Tin Can mode, this dials the remote and then enters the conference after they answer.
; End of Examples sub-section
IMPORTANT NOTES ABOUT THE EXAMPLES
==================================
YOU MUST CHANGE #YOUR-TRUNK-s#, the "ABCTO" number,
and choose valid Call-Back numbers !!!
ALSO PLEASE CHANGE the extension numbers from the
11xx range to match your extension numbers.
(Examples in this file use extension numbers from the
Asterisk Basic PBX sample configuration files upstream.)
AND if you want to send GPS co-ordinates, then please change those, too!
Mostly tested with PJSIP on ASTERISK certified version 16.3-cert1.
It should also work with any channel technology (see DAHDI in example #2.)
Non-numeric extension numbers should work, but you should test it yourself.
Actually you should probably test and verify with multiple test calls.
Frequently Asked Questions
==========================
Question:
What are the conference menu options ?
Answer:
* YOU ARE HERE! Speaks GPS co-ordinates of the caller into the conference.
0 Operator (TODO: Play back all of the menu options. Just to your phone.)
1 (empty) (TODO: Might be option to pass DTMF through and/or mute/unmute)
2 "A"dditional information (eg. Room Number) is spoken into the conference.
3 "D"ecrease listening volume - only on your phone.
4 "I"ncrease listening volume - only on your phone.
5 "L"ocal extension number is spoken into the conference.
6 "N"umber to call back and reach the caller is spoken into the conference.
7 "S"treet address and additional information of caller is spoken into the conference.
8 (empty) (TODO: Might be option for friends to add in a new "T"elephone number.)
9 "W"hat the? Redial the remote destination phone number into the conference.
# Halts any automated message playbacks (may have to press it twice sometimes.)
Question:
Why do I hear ring back tone until the friend(s) pick up and answer ?
Answer:
You'll need to add a new line to indications.conf for each tone zone
you offer to your users in order to produce a 'silent' ringer.
(...scroll down to find the section...)
[us]
description = United States / North America
silent = 0/15000
(...the rest of the tones...)
...but to avoid a restart, for testing, on the Asterisk CLI, you can do:
CLI> indication add us silent 0/15000
Question:
Why use 922 as the example extension that users will dial to reach 933 ?
Answer:
It might help users distinguish between competing providers of
operator services at the remote end. Any number in the following
ranges should be good to test with in most countries:
901-910
912-932
934-998
Please consult your local numbering plan rules before making changes.
Thank you for reading!
This long descriptive AEL comment ends right here at the splat hash. */
/****************************************************************************
* BEGIN PUBLIC SECTION *
* This section contains macros and contexts that should be entered from *
* somewhere outside of this file. *
****************************************************************************/
/* PUBLIC */
/* Either "simple", "tincan" or "init" macro needs to be entered first,
* from somewhere outside of this file, in order to activate the conf room. */
macro pngnpbx-abc-simple(type_) {
&pngnpbx-abc-init(${type_},,,,,);
return;
}
/* PUBLIC */
/* SMH but IANAL */
macro pngnpbx-abc-tincan(type_) {
&pngnpbx-abc-init(${type_},,,,,tincan);
return;
}
/* PUBLIC */
/* The "init" macro (re)sets up several things for the conference room. */
macro pngnpbx-abc-init(type_,record_,conftimeout_,abcid_,announce_,tincan_) {
Set(LOCAL(startstamp)=${STRFTIME(,UTC,%F %H:%M:%S.%3q)} UTC);
local cnftmt=;
DumpChan(5);
if( ${LEN(${type_})} > 0 ) {
Set(pngnpbx_abc_type=${type_});
} else {
Set(pngnpbx_abc_type=default);
}
Set(CHANNEL(accountcode)=${pngnpbx_abc_type});
if( ${LEN(${abcid_})} > 0 ) {
Set(pngnpbx_abc_id=${FILTER(a-zA-Z0-9,${abcid_})});
} else {
// This default only works if each phone has a unique caller ID number.
// Otherwise, you'll need to specify your own conference ID number.
// (But if your extensions have matching numbers... please just stop that.)
Set(pngnpbx_abc_id=${FILTER(a-zA-Z0-9,${CALLERID(num)})});
}
Set(cnftmt=${FILTER(0-9,${conftimeout_})});
if( ${LEN(${cnftmt})} == 0 ) {
Set(cnftmt=14400);
}
// TODO: Check if the conference is already/still running.
DBdeltree(pngnpbx/abc/${pngnpbx_abc_id});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/init)=${startstamp});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/ogchan)=${CHANNEL(name)});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/type)=${pngnpbx_abc_type});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/cidnum)=${CALLERID(num)});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/cidname)=${CALLERID(name)});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dnid)=${CALLERID(DNID)});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/conftimeout)=${cnftmt});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/ttsactive)=0);
if( "x${TOLOWER(${record_})}" == "xrecord" ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/record)=yes);
} else {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/record)=no);
}
if( "x${TOLOWER(${announce_})}" == "xannounce" ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/announce)=yes);
} else {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/announce)=no);
}
if( "x${TOLOWER(${tincan_})}" == "xtincan" ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/tincan)=yes);
} else {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/tincan)=no);
}
return;
}
/* PUBLIC */
/* The "remote" macro should be entered once per conference.
* It is (arguably) the most important destination and probably what the user dialed. */
macro pngnpbx-abc-remote(cidnum_,usedynamiccid_) {
local gotdyno=no;
local maybedid=${cidnum_};
local mytincan=${DB(pngnpbx/abc/${pngnpbx_abc_id}/tincan)};
if( "x${TOLOWER(${usedynamiccid_})}" == "xdynamic" ) {
// TODO: Use LOCK function with Dynamic CID-DID.
for( i=1; ${i} <= 9; i=${i} + 1 ) {
Set(maybedid=${DB(pngnpbx/abc/dynodid/callback/${i})});
if( ${LEN(${maybedid})} > 0 ) {
Set(LOCAL(og)=${DB(pngnpbx/abc/dynodid/${maybedid}/ogcaller)});
Set(LOCAL(lastcall)=${DB(pngnpbx/abc/dynodid/${maybedid}/lastcall)});
Set(LOCAL(difftime)=$[${EPOCH}-${lastcall}]);
if( ${LEN(${og})} == 0 || ${difftime} >= 3600 ) {
Set(LOCAL(ognow)=${DB(pngnpbx/abc/${pngnpbx_abc_id}/cidnum)});
Set(DB(pngnpbx/abc/dynodid/${maybedid}/lastcall)=${EPOCH});
Set(DB(pngnpbx/abc/dynodid/${maybedid}/ogcaller)=${ognow});
Set(gotdyno=yes);
break;
}
}
}
if( "x${gotdyno}" == "xno" ) {
// Dynamic CID-DID allocation failed.
maybedid=${cidnum_};
}
}
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/outboundcidnum)=${maybedid});
if( "x${mytincan}" == "xyes" ) {
Originate(Local/${pngnpbx_abc_id}@pngnpbx-abc-bridge,exten,pngnpbx-abc-spy,${pngnpbx_abc_id},1,1);
} else {
Originate(Local/${pngnpbx_abc_id}@pngnpbx-abc-bridge,exten,pngnpbx-abc-dial,${pngnpbx_abc_id}-0ABC,1,1);
}
return;
}
/* PUBLIC */
/* The "friend" macro can be entered multiple times, once per each additional participant. */
macro pngnpbx-abc-friend(position_,dialstr_) {
local myexten=${CUT(dialstr_,/,2)};
local mycidnum=${DB(pngnpbx/abc/${pngnpbx_abc_id}/cidnum)};
// TODO: more loop prevention using GROUP function (need to test bad forwarding scenarios)
if( "x${myexten}" != "x${mycidnum}" ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/friend/${position_}/dialstr)=${dialstr_});
Originate(Local/${pngnpbx_abc_id}@pngnpbx-abc-bridge,exten,pngnpbx-abc-dial,${pngnpbx_abc_id}-${position_},1,1);
}
return;
}
/* PUBLIC */
/* The "paths" macro supports multiple dial strings to try and
* reach the far end, in a failover manner, in case some routes are down. */
macro pngnpbx-abc-path(position_,timeout_,dialstr_) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/outpath/${position_}/dialstr)=${dialstr_});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/outpath/${position_}/timeout)=${timeout_});
return;
}
/* PUBLIC */
/* The "gps" macro is optional; if used it should be entered immediately after "init". */
macro pngnpbx-abc-gps(lat_,lon_,url_) {
if( ${LEN(${lat_})} > 0 ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/gps/lat)=${lat_});
if( ${LEN(${lon_})} > 0 ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/gps/lon)=${lon_});
}
}
if( ${LEN(${url_})} > 0 ) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/gps/url)=${url_});
}
return;
}
/* PUBLIC */
/* The "sa" macro is to add the street address. */
macro pngnpbx-abc-sa(street_,city_,state_,zip_) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dloc/street)=${street_});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dloc/city)=${city_});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dloc/state)=${state_});
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dloc/zip)=${zip_});
return;
}
/* PUBLIC */
/* The "ai" macro is to add additional information to the street address. */
macro pngnpbx-abc-ai(info_) {
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/dloc/ainfo)=${info_});
return;
}
/* PUBLIC */
/* The "reentry" macro is for dynamic callback number mapping. */
macro pngnpbx-abc-reentry(position_,didcid_,abcloadingonly_) {
Set(dynodid=${FILTER(a-zA-Z0-9,${didcid_})});
Set(ogcaller=${DB(pngnpbx/abc/dynodid/${dynodid}/ogcaller)});
Set(currdid=${DB(pngnpbx/abc/dynodid/callback/${position_})});
if( ${LEN(${currdid})} == 0 || "x${currdid}" != "x${dynodid}" ) {
Set(DB(pngnpbx/abc/dynodid/callback/${position_})=${dynodid});
}
if( "x${abcloadingonly_}" == "xyes" ) {
&pngnpbx-abc-tunes();
SayDigits(${didcid_});
Playback(position);
SayNumber(${position_});
} else {
if( ${LEN(${ogcaller})} > 0 ) {
Dial(${PJSIP_DIAL_CONTACTS(${ogcaller})},300,giI);
Hangup();
} else {
Congestion(10); // TODO: Do more than congestion.
}
}
return;
}
/****************************************************************************
* BEGIN PRIVATE SECTION *
* The rest of the file contains internal macros and contexts that should *
* (usually) only be referenced from elsewhere within this particular file. *
****************************************************************************/
/* The "geohdrs" macro is only utilized in tandem with "gps" macro. */
macro pngnpbx-abc-geohdrs(abcid_) {
local lat=;
local lon=;
local url=;
// TODO: check if this is an outgoing PJSIP channel
Set(lat=${DB(pngnpbx/abc/${abcid_}/gps/lat)});
Set(lon=${DB(pngnpbx/abc/${abcid_}/gps/lon)});
Set(url=${DB(pngnpbx/abc/${abcid_}/gps/url)});
Set(PJSIP_HEADER(add,Geolocation)=<${url}?lat=${lat}&lon=${lon}>);
Set(PJSIP_HEADER(add,Geolocation-Routing)=no);
return;
}
/* The "cbo-user" macro defines only 'user' items for the conference. */
macro pngnpbx-abc-cbo-user(cnftmt_) {
// TODO: play beeperr sound when the OG caller leaves the bridge
CONFBRIDGE(user,admin)=no;
CONFBRIDGE(user,announce_join_leave)=no;
CONFBRIDGE(user,announce_only_user)=no;
CONFBRIDGE(user,announce_user_count)=no;
CONFBRIDGE(user,dsp_drop_silence)=yes;
CONFBRIDGE(user,end_marked)=no;
CONFBRIDGE(user,jitterbuffer)=yes;
CONFBRIDGE(user,music_on_hold_when_empty)=no;
CONFBRIDGE(user,quiet)=yes;
CONFBRIDGE(user,startmuted)=no;
CONFBRIDGE(user,timeout)=${cnftmt_};
CONFBRIDGE(user,wait_marked)=no;
CONFBRIDGE(user,dtmf_passthrough)=yes;
}
/* The "cbo" macro defines human member items for the conference. */
macro pngnpbx-abc-cbo(abcid_) {
local cnftmt=;
local dorecord=;
local abctype=;
local saymenu="silence/1"; // TODO: add prompts for menu
local certversion="${VERSION()}";
Set(cnftmt=${DB(pngnpbx/abc/${abcid_}/conftimeout)});
Set(TIMEOUT(absolute)=${cnftmt});
Set(dorecord=${DB(pngnpbx/abc/${abcid_}/record)});
if( "x${dorecord}" == "xyes" ) {
Set(abctype=${DB(pngnpbx/abc/${abcid_}/type)});
// TODO: file bug report because certified version number issue
if( ${VERSION(ASTERISK_VERSION_NUM)} >= 160000
|| "${CUT(certversion,/,2)}" == "16.3-cert1" ) {
MixMonitor(${abctype}-${abcid_}-${UNIQUEID}.wav);
} else {
Monitor(wav,${abctype}-${abcid_}-${UNIQUEID});
}
}
&pngnpbx-abc-cbo-user(${cnftmt});
CONFBRIDGE(bridge,max_members)=20;
// Dynamic menu change requires first choosing template.
// TODO: file a bug report because no template = crash
CONFBRIDGE(menu,template)=default_menu;
//CONFBRIDGE(menu,clear)=hmm;
Set(CONFBRIDGE(menu,*)=dialplan_exec(pngnpbx-abc-hola-gps,${abcid_},1)); // HERE!
Set(CONFBRIDGE(menu,0)=playback_and_continue(${saymenu})); // Operator
Set(CONFBRIDGE(menu,1)=no_op); // (blank)
Set(CONFBRIDGE(menu,2)=dialplan_exec(pngnpbx-abc-hola-ainfo,${abcid_},1)); // A
Set(CONFBRIDGE(menu,3)=decrease_listening_volume); // D
Set(CONFBRIDGE(menu,4)=increase_listening_volume); // I
Set(CONFBRIDGE(menu,5)=dialplan_exec(pngnpbx-abc-hola-exten,${abcid_},1)); // L
Set(CONFBRIDGE(menu,6)=dialplan_exec(pngnpbx-abc-hola-cbnum,${abcid_},1)); // N
Set(CONFBRIDGE(menu,7)=dialplan_exec(pngnpbx-abc-hola-dloc,${abcid_},1)); // S
Set(CONFBRIDGE(menu,8)=no_op); // TUV
Set(CONFBRIDGE(menu,9)=dialplan_exec(pngnpbx-abc-redial,${abcid_},1)); // W
return;
}
/* The "howdy-yall" macro is the final needed step for connecting the caller. */
macro pngnpbx-abc-howdy-yall() {
local mytincan=${DB(pngnpbx/abc/${pngnpbx_abc_id}/tincan)};
CONNECTEDLINE(num,i) = ${CALLERID(DNID)};
CONNECTEDLINE(name,i) = "${TOUPPER(${pngnpbx_abc_type})} ConfCall";
CONNECTEDLINE(pres) = allowed;
&pngnpbx-abc-cbo(${pngnpbx_abc_id});
Set(nowstamp=${STRFTIME(,UTC,%F %H:%M:%S.%3q)} UTC);
Set(DB(pngnpbx/abc/${pngnpbx_abc_id}/howdy)=${nowstamp});
if( "x${mytincan}" == "xyes" ) {
goto pngnpbx-abc-dial,${pngnpbx_abc_id}-0ABC,1;
} else {
ConfBridge(pngnpbx-abc-${pngnpbx_abc_id});
}
return;
}
/* The "account" macro is called internally from several places. */
macro pngnpbx-abc-account(x_) {
Answer();
Set(abcid=${FILTER(a-zA-Z0-9,${x_})});
Set(abctype=${DB(pngnpbx/abc/${abcid}/type)});
Set(CHANNEL(accountcode)=${abctype});
return;
}
/* The "tunes" macro plays a little ditty. Fly birdy, fly! */
macro pngnpbx-abc-tunes() {
Answer();
Playtones(432/120,0/20,485/120,0/20,514/120); // A4, B4, C4
Wait(.420);
return;
}
/* The "tts-status" macro helps keep multiple sounds from playing at the same time. */
macro pngnpbx-abc-tts-status(abcid_,status_) {
Set(ttsact=${DB(pngnpbx/abc/${abcid_}/ttsactive)});
if( "x${ttsact}" == "x1" && "x${status_}" == "x1" ) {
Hangup();
}
Set(DB(pngnpbx/abc/${abcid_}/ttsactive)=${status_});
return;
}
/* The "tts-gps" context Speaks out the GPS co-ordinates of the OG caller. */
context pngnpbx-abc-tts-gps {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
Set(lat=${DB(pngnpbx/abc/${abcid}/gps/lat)});
Set(lon=${DB(pngnpbx/abc/${abcid}/gps/lon)});
&pngnpbx-abc-tunes();
if( ${LEN(${lat})} > 0 && ${LEN(${lon})} > 0 ) {
SayAlpha(gps);
SayNumber(${CUT(lat,.,1)});
Background(point);
SayDigits(${CUT(lat,.,2)});
Background(by);
SayNumber(${CUT(lon,.,1)});
Background(point);
SayDigits(${CUT(lon,.,2)});
}
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* The "tts-dloc" context speaks out the dispatchable location of the OG caller. */
context pngnpbx-abc-tts-dloc {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
Set(street=${DB(pngnpbx/abc/${abcid}/dloc/street)});
Set(city=${DB(pngnpbx/abc/${abcid}/dloc/city)});
Set(state=${DB(pngnpbx/abc/${abcid}/dloc/state)});
Set(zip=${DB(pngnpbx/abc/${abcid}/dloc/zip)});
Set(ainfo=${DB(pngnpbx/abc/${abcid}/dloc/ainfo)});
&pngnpbx-abc-tunes();
if( ${LEN(${street})} == 0
|| ${LEN(${city})} == 0
|| ${LEN(${state})} == 0
|| ${LEN(${zip})} == 0 ) {
Hangup();
}
Background(zip-code);
SayAlpha(${zip});
Background(address);
SayAlpha(${street});
WaitExten(1);
SayAlpha(${city});
WaitExten(0.5);
SayAlpha(${state});
if( ${LEN(${ainfo})} == 0 ) {
Hangup();
}
WaitExten(0.25);
Background(added&information);
SayAlpha(${ainfo});
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* Speaks out the additional address information of the OG caller. */
context pngnpbx-abc-tts-ainfo {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
Set(ainfo=${DB(pngnpbx/abc/${abcid}/dloc/ainfo)});
&pngnpbx-abc-tunes();
if( ${LEN(${ainfo})} == 0 ) {
Hangup();
}
Background(added&information);
SayAlpha(${ainfo});
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* The "tts-exten" context speaks out the extension number of the OG caller. */
context pngnpbx-abc-tts-exten {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
Set(cidnum=${DB(pngnpbx/abc/${abcid}/cidnum)});
&pngnpbx-abc-tunes();
if( ${LEN(${cidnum})} == 0 ) {
Hangup();
}
Background(extension);
SayDigits(${cidnum});
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* The "tts-cbnum" context speaks out the call back number of the OG caller. */
context pngnpbx-abc-tts-cbnum {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
Set(cbnum=${DB(pngnpbx/abc/${abcid}/outboundcidnum)});
&pngnpbx-abc-tunes();
if( ${LEN(${cbnum})} == 0 ) {
Hangup();
}
Background(call&from);
SayDigits(${cbnum});
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* The "tts-genie" context speaks out response from a remote smart process. */
context pngnpbx-abc-tts-genie {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-tts-status(${abcid},1);
Set(SAY_DTMF_INTERRUPT=true);
// TODO: link to some artificial intelligence that helps out verbally on the call
}
# => &pngnpbx-abc-tts-status(${abcid},0);
h => &pngnpbx-abc-tts-status(${abcid},0);
}
/* The "hola-" contexts spools calls into the conference for Text-To-Speech. */
context pngnpbx-abc-hola-gps {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-gps,${abcid},1,1);
}
}
context pngnpbx-abc-hola-dloc {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-dloc,${abcid},1,1);
}
}
context pngnpbx-abc-hola-ainfo {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-ainfo,${abcid},1,1);
}
}
context pngnpbx-abc-hola-exten {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-exten,${abcid},1,1);
}
}
context pngnpbx-abc-hola-cbnum {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-cbnum,${abcid},1,1);
}
}
/* Anchor point for the "hola" shouts into the conference. */
context pngnpbx-abc-hola {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Set(cnftmt=${DB(pngnpbx/abc/${abcid}/conftimeout)});
&pngnpbx-abc-cbo-user(${cnftmt});
ConfBridge(pngnpbx-abc-${abcid});
}
}
/* The "bridge" context puts spooled calls in the conference. */
context pngnpbx-abc-bridge {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
&pngnpbx-abc-cbo(${abcid});
ConfBridge(pngnpbx-abc-${abcid});
}
}
/* The "redial" context is entered from conf menu option 9 to re-attempt
* the outbound remote call, as it was dialed by the OG caller. */
context pngnpbx-abc-redial {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Originate(Local/${abcid}@pngnpbx-abc-bridge,exten,pngnpbx-abc-dial,${abcid}-0ABC,1,1);
}
}
/* The "answered-" contexts are for after the dial picks up on remote end. */
context pngnpbx-abc-answered-common {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})}); // where the callee enters
Set(doannounce=${DB(pngnpbx/abc/${abcid}/announce)});
if( "x${doannounce}" == "xyes" ) {
Originate(Local/${abcid}@pngnpbx-abc-hola,exten,pngnpbx-abc-tts-gps,${abcid},1,1);
}
&pngnpbx-abc-cbo(${abcid});
ConfBridge(pngnpbx-abc-${abcid});
}
}
/* The "answered-originate" context should *not* be used in Tin Can Mode.
* It should be entered only from a Dial option 'G' which is why it looks weird.
* Do not be fooled by the Hangup in the first line when Originating. KEEP IT THERE. */
context pngnpbx-abc-answered-originate {
_[a-zA-Z0-9]. => {
Hangup(); // caller enters here but their leg is not needed with Originate
goto pngnpbx-abc-answered-common,${EXTEN},1; // where the callee enters
}
}
/* The "answered-tincan" context should only be used when in Tin Can Mode.
* It should be entered only from a Dial option 'G' which is why it looks weird.
* Do not be fooled by the NoOp in the first line when Dialing. KEEP IT THERE. */
context pngnpbx-abc-answered-tincan {
_[a-zA-Z0-9]. => {
goto pngnpbx-abc-answered-common,${EXTEN},1; // where the caller enters
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Set(spychan=${DB(pngnpbx/abc/${abcid}/spychan)}); // where the callee enters
ChannelRedirect(${spychan},${CONTEXT},h,1);
goto pngnpbx-abc-answered-common,${EXTEN},1; // where the callee enters
}
h => Hangup();
}
/* The "answered-friend" context is executed when the friend answers the call.
* Friends are only ever called with Originate. */
context pngnpbx-abc-answered-friend {
_[a-zA-Z0-9]. => {
Hangup(); // caller enters here but their leg is not needed with Originate
&pngnpbx-abc-tunes();
goto pngnpbx-abc-answered-common,${EXTEN},1; // where the callee enters
}
}
/* The "afterword-tincan" context is the place to send the remote caller to
* when the caller hangs up *before* the remote end answers. */
context pngnpbx-abc-afterword-tincan {
_[a-zA-Z0-9]. => {
// TODO: Hold the call up better!
NoOp();
}
}
/* The "spy" context should only be used in Tin Can mode. */
context pngnpbx-abc-spy {
_[a-zA-Z0-9]. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${EXTEN})});
Set(chan=${DB(pngnpbx/abc/${abcid}/ogchan)});
Set(DB(pngnpbx/abc/${abcid}/spychan)=${CHANNEL(name)});
ChanSpy(${chan},EqsSuw);
}
}
/* The "dial" context actually makes the phones ring. */
context pngnpbx-abc-dial {
_[a-zA-Z0-9].-. => {
&pngnpbx-abc-account(${FILTER(a-zA-Z0-9,${CUT(EXTEN,-,1)})});
Set(position=${FILTER(0-9,${CUT(EXTEN,-,2)})});
Set(usetincan=${DB(pngnpbx/abc/${abcid}/tincan)});
Set(tofriend=${DB(pngnpbx/abc/${abcid}/friend/${position}/dialstr)});
Set(outboundcidnum=${DB(pngnpbx/abc/${abcid}/outboundcidnum)});
Set(abctype=${DB(pngnpbx/abc/${abcid}/type)});
Set(abccidnum=${DB(pngnpbx/abc/${abcid}/cidnum)});
Set(abccidname=${DB(pngnpbx/abc/${abcid}/cidname)});
Set(abcdnid=${DB(pngnpbx/abc/${abcid}/dnid)});
Set(cnftmt=${DB(pngnpbx/abc/${abcid}/conftimeout)});
Set(CHANNEL(accountcode)=${abctype});
Set(TIMEOUT(absolute)=${cnftmt});
Set(abcdialopts=iI); // no forwards or connected line updates
if( ${LEN(${tofriend})} > 0 ) {
Set(CALLERID(num)=${abccidnum});