Top-Themen

Aktuelle Themen (A bis Z)

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit

gelöst Asterisk (FreePBX) Kein Raustelefonieren möglich "Busy"

Mitglied: jeschero

jeschero (Level 1) - Jetzt verbinden

26.10.2016, aktualisiert 27.10.2016, 2375 Aufrufe, 20 Kommentare

Hallo alle zusammen,

und zwar harbe ich ein Problem. Ich habe einen VOIP-Telekom-Anschluss und möchte jetzt Asterisk als VOIP-Server nutzen.
Als Router wird Pfsense genutzt, Ports werden zu dem Asterisk-Server weitergeleitet.

Rein telefonieren kann ich.

Pfsense Nat Port-Forward:
pfsense_nat - Klicke auf das Bild, um es zu vergrößern


Wenn ich jetzt raus telefonieren möchte, bekomme ich die Ansage das der Anruf "busy" ist.
Errorlog:
01.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:1] Macro("PJSIP/300-00000012", "user-callerid,LIMIT,EXTERNAL,") in new stack
02.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:1] Set("PJSIP/300-00000012", "TOUCH_MONITOR=1477514006.92") in new stack
03.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:2] Set("PJSIP/300-00000012", "AMPUSER=300") in new stack
04.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:3] GotoIf("PJSIP/300-00000012", "0?report") in new stack
05.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:4] ExecIf("PJSIP/300-00000012", "1?Set(REALCALLERIDNUM=300)") in new stack
06.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:5] Set("PJSIP/300-00000012", "AMPUSER=300") in new stack
07.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:6] GotoIf("PJSIP/300-00000012", "0?limit") in new stack
08.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:7] Set("PJSIP/300-00000012", "AMPUSERCIDNAME=User") in new stack
09.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:8] GotoIf("PJSIP/300-00000012", "0?report") in new stack
10.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:9] Set("PJSIP/300-00000012", "AMPUSERCID=300") in new stack
11.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:10] Set("PJSIP/300-00000012", "__DIAL_OPTIONS=Ttr") in new stack
12.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:11] Set("PJSIP/300-00000012", "CALLERID(all)="User" <300>") in new stack
13.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:12] GotoIf("PJSIP/300-00000012", "0?limit") in new stack
14.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:13] ExecIf("PJSIP/300-00000012", "1?Set(GROUP(concurrency_limit)=300)") in new stack
15.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:14] GosubIf("PJSIP/300-00000012", "7?sub-ccss,s,1(from-internal,)") in new stack
16.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-ccss:1] ExecIf("PJSIP/300-00000012", "0?Return()") in new stack
17.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-ccss:2] Set("PJSIP/300-00000012", "CCSS_SETUP=TRUE") in new stack
18.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-ccss:3] GosubIf("PJSIP/300-00000012", "0?monitor_config,1(from-internal,):monitor_default,1(from-internal,)") in new stack
19.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [monitor_default@sub-ccss:1] GotoIf("PJSIP/300-00000012", "0?is_exten") in new stack
20.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [monitor_default@sub-ccss:2] StackPop("PJSIP/300-00000012", "") in new stack
21.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [monitor_default@sub-ccss:3] Return("PJSIP/300-00000012", "FALSE") in new stack
22.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:15] ExecIf("PJSIP/300-00000012", "0?Set(CHANNEL(language)=)") in new stack
23.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:16] GotoIf("PJSIP/300-00000012", "1?continue") in new stack
24.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-user-callerid,s,30)
25.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:30] Set("PJSIP/300-00000012", "CALLERID(number)=300") in new stack
26.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:31] Set("PJSIP/300-00000012", "CALLERID(name)=User") in new stack
27.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:32] Set("PJSIP/300-00000012", "CDR(cnum)=300") in new stack
28.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:33] Set("PJSIP/300-00000012", "CDR(cnam)=User") in new stack
29.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-user-callerid:34] Set("PJSIP/300-00000012", "CHANNEL(language)=en") in new stack
30.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:2] Gosub("PJSIP/300-00000012", "sub-record-check,s,1(out,+49{Telefonnummer Extern},dontcare)") in new stack
31.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:1] GotoIf("PJSIP/300-00000012", "0?initialized") in new stack
32.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:2] Set("PJSIP/300-00000012", "__REC_STATUS=INITIALIZED") in new stack
33.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:3] Set("PJSIP/300-00000012", "NOW=1477514006") in new stack
34.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:4] Set("PJSIP/300-00000012", "__DAY=26") in new stack
35.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:5] Set("PJSIP/300-00000012", "__MONTH=10") in new stack
36.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:6] Set("PJSIP/300-00000012", "__YEAR=2016") in new stack
37.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:7] Set("PJSIP/300-00000012", "__TIMESTR=20161026-223326") in new stack
38.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:8] Set("PJSIP/300-00000012", "__FROMEXTEN=300") in new stack
39.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:9] Set("PJSIP/300-00000012", "__MON_FMT=wav") in new stack
40.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:10] NoOp("PJSIP/300-00000012", "Recordings initialized") in new stack
41.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:11] ExecIf("PJSIP/300-00000012", "0?Set(ARG3=dontcare)") in new stack
42.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:12] Set("PJSIP/300-00000012", "REC_POLICY_MODE_SAVE=") in new stack
43.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:13] ExecIf("PJSIP/300-00000012", "0?Set(REC_STATUS=NO)") in new stack
44.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:14] GotoIf("PJSIP/300-00000012", "3?checkaction") in new stack
45.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (sub-record-check,s,17)
46.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@sub-record-check:17] GotoIf("PJSIP/300-00000012", "1?sub-record-check,out,1") in new stack
47.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (sub-record-check,out,1)
48.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [out@sub-record-check:1] NoOp("PJSIP/300-00000012", "Outbound Recording Check from 300 to +49{Telefonnummer Extern}") in new stack
49.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [out@sub-record-check:2] Set("PJSIP/300-00000012", "RECMODE=dontcare") in new stack
50.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [out@sub-record-check:3] ExecIf("PJSIP/300-00000012", "1?Goto(routewins)") in new stack
51.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (sub-record-check,out,7)
52.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [out@sub-record-check:7] Gosub("PJSIP/300-00000012", "recordcheck,1(dontcare,out,+49{Telefonnummer Extern})") in new stack
53.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/300-00000012", "Starting recording check against dontcare") in new stack
54.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:2] Goto("PJSIP/300-00000012", "dontcare") in new stack
55.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (sub-record-check,recordcheck,3)
56.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:3] Return("PJSIP/300-00000012", "") in new stack
57.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [out@sub-record-check:8] Return("PJSIP/300-00000012", "") in new stack
58.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:3] ExecIf("PJSIP/300-00000012", "0 ?Set(CDR(accountcode)=)") in new stack
59.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:4] Set("PJSIP/300-00000012", "MOHCLASS=default") in new stack
60.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:5] ExecIf("PJSIP/300-00000012", "1?Set(TRUNKCIDOVERRIDE="User" <0{Telefonnummer Intern}>)") in new stack
61.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:6] Set("PJSIP/300-00000012", "_NODEST=") in new stack
62.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:7] Macro("PJSIP/300-00000012", "dialout-trunk,2,+49{Telefonnummer Extern},,off") in new stack
63.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:1] Set("PJSIP/300-00000012", "DIAL_TRUNK=2") in new stack
64.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:2] GosubIf("PJSIP/300-00000012", "0?sub-pincheck,s,1()") in new stack
65.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:3] GotoIf("PJSIP/300-00000012", "0?disabletrunk,1") in new stack
66.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:4] Set("PJSIP/300-00000012", "DIAL_NUMBER=+49{Telefonnummer Extern}") in new stack
67.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:5] Set("PJSIP/300-00000012", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
68.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:6] Set("PJSIP/300-00000012", "OUTBOUND_GROUP=OUT_2") in new stack
69.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:7] GotoIf("PJSIP/300-00000012", "0?nomax") in new stack
70.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:8] GotoIf("PJSIP/300-00000012", "0?chanfull") in new stack
71.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:9] GotoIf("PJSIP/300-00000012", "0?skipoutcid") in new stack
72.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:10] Set("PJSIP/300-00000012", "DIAL_TRUNK_OPTIONS=Tt") in new stack
73.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:11] Macro("PJSIP/300-00000012", "outbound-callerid,2") in new stack
74.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:1] ExecIf("PJSIP/300-00000012", "0?Set(CALLERPRES()=)") in new stack
75.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:2] ExecIf("PJSIP/300-00000012", "0?Set(REALCALLERIDNUM=300)") in new stack
76.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:3] GotoIf("PJSIP/300-00000012", "1?normcid") in new stack
77.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-outbound-callerid,s,6)
78.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:6] Set("PJSIP/300-00000012", "USEROUTCID=") in new stack
79.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:7] Set("PJSIP/300-00000012", "EMERGENCYCID=") in new stack
80.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:8] Set("PJSIP/300-00000012", "TRUNKOUTCID=0{Telefonnummer Intern}") in new stack
81.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:9] GotoIf("PJSIP/300-00000012", "1?trunkcid") in new stack
82.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-outbound-callerid,s,14)
83.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:14] ExecIf("PJSIP/300-00000012", "1?Set(CALLERID(all)=0{Telefonnummer Intern})") in new stack
84.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:15] ExecIf("PJSIP/300-00000012", "0?Set(CALLERID(all)=)") in new stack
85.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:16] ExecIf("PJSIP/300-00000012", "1?Set(CALLERID(all)=User <0{Telefonnummer Intern}>)") in new stack
86.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:17] ExecIf("PJSIP/300-00000012", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
87.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:18] Set("PJSIP/300-00000012", "CDR(outbound_cnum)=0{Telefonnummer Intern}") in new stack
88.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:19] Set("PJSIP/300-00000012", "CDR(outbound_cnam)=User") in new stack
89.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:12] GosubIf("PJSIP/300-00000012", "0?sub-flp-2,s,1()") in new stack
90.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:13] Set("PJSIP/300-00000012", "OUTNUM=+49{Telefonnummer Extern}") in new stack
91.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:14] Set("PJSIP/300-00000012", "custom=PJSIP") in new stack
92.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:15] ExecIf("PJSIP/300-00000012", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Tt)") in new stack
93.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:16] ExecIf("PJSIP/300-00000012", "0?Set(DIAL_TRUNK_OPTIONS=TtM(confirm))") in new stack
94.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:17] Macro("PJSIP/300-00000012", "dialout-trunk-predial-hook,") in new stack
95.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/300-00000012", "") in new stack
96.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:18] GotoIf("PJSIP/300-00000012", "0?bypass,1") in new stack
97.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:19] ExecIf("PJSIP/300-00000012", "1?Set(CONNECTEDLINE(num,i)=+49{Telefonnummer Extern})") in new stack
98.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:20] ExecIf("PJSIP/300-00000012", "1?Set(CONNECTEDLINE(name,i)=CID:0{Telefonnummer Intern})") in new stack
99.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:21] GotoIf("PJSIP/300-00000012", "0?customtrunk") in new stack
100.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:22] Dial("PJSIP/300-00000012", "PJSIP/+49{Telefonnummer Extern}@Telekom,300,Tt") in new stack
101.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] app_dial.c: Called PJSIP/+49{Telefonnummer Extern}@Telekom
102.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] app_dial.c: Everyone is busy/congested at this time (1:0/0/1)
103.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:23] NoOp("PJSIP/300-00000012", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 21") in new stack
104.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:24] GotoIf("PJSIP/300-00000012", "0?continue,1:s-CHANUNAVAIL,1") in new stack
105.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
106.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set("PJSIP/300-00000012", "RC=21") in new stack
107.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("PJSIP/300-00000012", "21,1") in new stack
108.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-dialout-trunk,21,1)
109.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [21@macro-dialout-trunk:1] Goto("PJSIP/300-00000012", "continue,1") in new stack
110.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx_builtins.c: Goto (macro-dialout-trunk,continue,1)
111.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [continue@macro-dialout-trunk:1] NoOp("PJSIP/300-00000012", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 21 - failing through to other trunks") in new stack
112.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [continue@macro-dialout-trunk:2] Set("PJSIP/300-00000012", "CALLERID(number)=300") in new stack
113.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [+49{Telefonnummer Extern}@from-internal:8] Macro("PJSIP/300-00000012", "outisbusy,") in new stack
114.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outisbusy:1] Progress("PJSIP/300-00000012", "") in new stack
115.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outisbusy:2] GotoIf("PJSIP/300-00000012", "0?emergency,1") in new stack
116.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outisbusy:3] GotoIf("PJSIP/300-00000012", "0?intracompany,1") in new stack
117.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outisbusy:4] Playback("PJSIP/300-00000012", "all-circuits-busy-now&pls-try-call-later, noanswer") in new stack
118.
[2016-10-26 22:33:26] VERBOSE[22441][C-00000009] file.c: <PJSIP/300-00000012> Playing 'all-circuits-busy-now.ulaw' (language 'en')
119.
[2016-10-26 22:33:28] VERBOSE[22441][C-00000009] file.c: <PJSIP/300-00000012> Playing 'pls-try-call-later.ulaw' (language 'en')
120.
[2016-10-26 22:33:30] VERBOSE[22441][C-00000009] pbx.c: Executing [s@macro-outisbusy:5] Congestion("PJSIP/300-00000012", "20") in new stack
121.
[2016-10-26 22:33:30] WARNING[22441][C-00000009] channel.c: Prodding channel 'PJSIP/300-00000012' failed
122.
[2016-10-26 22:33:30] VERBOSE[22441][C-00000009] app_macro.c: Spawn extension (macro-outisbusy, s, 5) exited non-zero on 'PJSIP/300-00000012' in macro 'outisbusy'
123.
[2016-10-26 22:33:30] VERBOSE[22441][C-00000009] pbx.c: Spawn extension (from-internal, +49{Telefonnummer Extern}, 8) exited non-zero on 'PJSIP/300-00000012'
124.
[2016-10-26 22:33:30] VERBOSE[22441][C-00000009] pbx.c: Executing [h@from-internal:1] Hangup("PJSIP/300-00000012", "") in new stack
125.
[2016-10-26 22:33:30] VERBOSE[22441][C-00000009] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/300-00000012'
126.
[2016-10-26 22:33:32] WARNING[13227] res_pjsip_pubsub.c: No registered publish handler for event presence
127.
[2016-10-26 22:33:32] WARNING[13227] res_pjsip_pubsub.c: No registered subscribe handler for event presence.winfo
extensions.con:
01.
;--------------------------------------------------------------------------------;
02.
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
03.
; this file must be done via the web gui. There are alternative files to make    ;
04.
; custom modifications, details at: http://freepbx.org/configuration_files       ;
05.
;--------------------------------------------------------------------------------;
06.

07.
;*******************************************************************************
08.
; AUTO-GENERATED AND CUSOTM USER DIALPLAN INCLUDED HERE                        *
09.
;*******************************************************************************
10.

11.
;--------------------------------------------------------------------------------;
12.
; Customizations to this dialplan should be made in extensions_custom.conf
13.
; See extensions_custom.conf.sample for an example.
14.
;
15.
; If you need to use [macro-dialout-trunk-predial-hook], [ext-did-custom], or
16.
; [from-internal-custom] for example, place these in this file or they will get overwritten.
17.
;
18.
; WARNING ABOUT: #include extensions_override_freepbx.conf
19.
;
20.
;  This include file is put first to allow the auto-generated dialplan in FreePBX
21.
;  to be overwritten if necessary. Overriding auto-generated dialplan should be done
22.
;  with extreme caution. In almost all cases any custom dialplan SHOULD be put in
23.
;  extensions_custom.conf which will not hurt a FreePBX generated dialplan. In some
24.
;  very rare and custom situations users may have a need to override what FreePBX
25.
;  automatically generates. If so anything in this file will do that.  If you come up
26.
;  with situations where you need to modify the existing dialplan or macros, put it
27.
;  here.
28.
;
29.
#include extensions_override_freepbx.conf
30.
#include extensions_additional.conf
31.
#include extensions_custom.conf
32.
;--------------------------------------------------------------------------------;
33.

34.

35.

36.
;*******************************************************************************
37.
; DIALPLAN OPEN TO THE PUBLIC, USING INBOUND DIDS AND SIMILAR                  *
38.
;*******************************************************************************
39.
;
40.

41.
;-------------------------------------------------------------------------------
42.
; from-digital:
43.
;
44.
; Context to set for PRI's and equivalent
45.
;
46.
[from-digital]
47.
include => from-pstn
48.
;-------------------------------------------------------------------------------
49.

50.
;-------------------------------------------------------------------------------
51.
; from-analog:
52.
;
53.
; Context to set for analog DAHDi cards and equivalent
54.
;
55.
[from-analog]
56.
include => from-dahdi
57.
;-------------------------------------------------------------------------------
58.

59.
;-------------------------------------------------------------------------------
60.
; from-trunk:
61.
;
62.
; Context is really just an aliax of from-pstn
63.
;
64.
[from-trunk]
65.
include => from-pstn
66.
;-------------------------------------------------------------------------------
67.

68.
;-------------------------------------------------------------------------------
69.
; from-pstn:
70.
;
71.
; Entry context for calls from the outside world to hit FreePBX
72.
[from-pstn]
73.
include => from-pstn-custom		; create this context in extensions_custom.conf to include customizations
74.
include => ext-did
75.
include => ext-did-post-custom
76.
include => from-did-direct
77.
include => ext-did-catchall		; THIS MUST COME AFTER ext-did
78.
;-------------------------------------------------------------------------------
79.

80.
;-------------------------------------------------------------------------------
81.
; from-pstn-e164-us:
82.
;
83.
; The context is designed for providers who send calls in e164 format and is
84.
; biased towards NPA calls, callerid and dialing rules. It will do the following:
85.
;
86.
;  DIDs in an NPA e164 format of +1NXXNXXXXXX will be converted to 10 digit DIDs
87.
;
88.
;  DIDs in any other format will be delivered as they are, including e164 non NPA
89.
;  DIDs which means they will need the full format including the + in the inbound
90.
;  route.
91.
;
92.
;  CallerID(number) presented in e164 NPA format will be trimmed to a 10 digit CID
93.
;
94.
;  CallerID(number) presented in e164 non-NPA (country code other than 1) will be
95.
;  reformated from: +<CountryCode><Number> to 011<CountryCode><Number>
96.
;
97.
[from-pstn-e164-us]
98.
exten => _+1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
99.
exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
100.
exten => _+1NXXNXXXXXX/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
101.
exten => _+1NXXNXXXXXX/_011NX.,n,Goto(from-pstn,${EXTEN:2},1)
102.
exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
103.
exten => _[0-9+]./_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
104.
exten => _[0-9+]./_1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):1})
105.
exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
106.
exten => _[0-9+]./_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
107.
exten => _[0-9+]./_011NX.,n,Goto(from-pstn,${EXTEN},1)
108.
exten => _[0-9+].,1,Goto(from-pstn,${EXTEN},1)
109.
exten => s/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
110.
exten => s/_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
111.
exten => s/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
112.
exten => s/_011NX.,n,Goto(from-pstn,${EXTEN},1)
113.
exten => s,1,Goto(from-pstn,${EXTEN},1)
114.
;-------------------------------------------------------------------------------
115.

116.
;-------------------------------------------------------------------------------
117.
; from-pstn-to-did:
118.
;
119.
; The context is designed for providers who send the DID in the TO: SIP header
120.
; only. The format of this header is:
121.
;
122.
; To: <sip:2125551212@172.31.74.25>
123.
;
124.
; So the DID must be extracted between the sip: and the @, which this does
125.
;
126.
[from-pstn-toheader]
127.
exten => _.,1,Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
128.
;-------------------------------------------------------------------------------
129.

130.
;-------------------------------------------------------------------------------
131.
; from-sip-external
132.
;
133.
; This context is the default SIP context unless otherwise changed in the SIP
134.
; Settings module or other sip configuration locations. This context is hit by
135.
; either anonymous SIP calls or mis-configured SIP trunks when the incoming call
136.
; can not be matched with a SIP section.
137.
;
138.
[from-sip-external]
139.
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
140.
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
141.
exten => _.,n,Goto(s,1)
142.
exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"="yes"]?checklang:noanonymous)
143.
exten => s,n(checklang),GotoIf($["${SIPLANG}"!=""]?setlanguage:from-trunk,${DID},1)
144.
exten => s,n(setlanguage),Set(CHANNEL(language)=${SIPLANG})
145.
exten => s,n,Goto(from-trunk,${DID},1)
146.
exten => s,n(noanonymous),Set(TIMEOUT(absolute)=15)
147.
exten => s,n,Log(WARNING,"Rejecting unknown SIP connection from ${CHANNEL(recvip)}")
148.
exten => s,n,Answer
149.
exten => s,n,Wait(2)
150.
exten => s,n,Playback(ss-noservice)
151.
exten => s,n,Playtones(congestion)
152.
exten => s,n,Congestion(5)
153.
exten => h,1,Hangup
154.
exten => i,1,Hangup
155.
exten => t,1,Hangup
156.
;-------------------------------------------------------------------------------
157.

158.

159.

160.
;*******************************************************************************
161.
; INTERNAL DIALPLAN, NOT OPEN TO THE PUBLIC WORLD                              *
162.
;*******************************************************************************
163.
;
164.

165.
;-------------------------------------------------------------------------------
166.
; from-internal:
167.
;
168.
; Internal dialplan that most internal phones have access to
169.
;
170.
[from-internal]
171.
include => from-internal-noxfer
172.
include => from-internal-xfer
173.
include => bad-number ; auto-generated
174.
;-------------------------------------------------------------------------------
175.

176.
;-------------------------------------------------------------------------------
177.
; from-internal-noxfer:
178.
;
179.
; Place to put internal dialplan that should not be accessible during a blind
180.
; transfer, this context will not be visible during such.
181.
;
182.
[from-internal-noxfer]
183.
include => from-internal-noxfer-custom
184.
include => from-internal-noxfer-additional ; auto-generated
185.
;-------------------------------------------------------------------------------
186.

187.
;-------------------------------------------------------------------------------
188.
; from-internal-xfer:
189.
;
190.
; Place to put most internal dialplan, will be visible during normal calls and
191.
; blind transfers.
192.
;
193.
[from-internal-xfer]
194.
include => from-internal-custom
195.
include => from-internal-additional ; auto-generated
196.
exten => s,1,Macro(hangupcall)
197.
exten => h,1,Macro(hangupcall)
198.
;-------------------------------------------------------------------------------
199.

200.

201.

202.
;*******************************************************************************
203.
; INTERNAL MACROS & SPECIAL CONTEXTS                                           *
204.
;*******************************************************************************
205.
;
206.

207.
;-------------------------------------------------------------------------------
208.
; from-did-direct:
209.
;
210.
; forces ext-findmefollow to take precedence over ext-local. Also exposed to
211.
; the public side to allow an extension number to be used as an external DID
212.
; without requiring inbound routes to be created, common in many PRI installations
213.
; where the last 4 digits are used as the extnension and DIDs are delivered in
214.
; 4 digit formats.
215.
;
216.
[from-did-direct]
217.
include => ext-findmefollow
218.
include => ext-local
219.
;-------------------------------------------------------------------------------
220.

221.
;-------------------------------------------------------------------------------
222.
; macro-dial:
223.
;
224.
; Rings one or more extensions.  Handles things like call forwarding and DND
225.
; We don't call dial directly for anything internal anymore.
226.
; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, ...
227.
; Use a Macro call such as the following:
228.
;
229.
;  Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,...)
230.
;
231.
[macro-dial]
232.
exten => s,1,GotoIf($["${MOHCLASS}" = ""]?dial)
233.
exten => s,n,Set(CHANNEL(musicclass)=${MOHCLASS})
234.
exten => s,n(dial),AGI(dialparties.agi)
235.
exten => s,n,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS})
236.

237.
exten => s,n+2(normdial),Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null
238.
exten => s,n,Set(DIALSTATUS=${IF($["${DIALSTATUS_CW}"!="" ]?${DIALSTATUS_CW}:${DIALSTATUS})})
239.
exten => s,n,GosubIf($[("${SCREEN}" != "" & ("${DIALSTATUS}" = "TORTURE" | "${DIALSTATUS}" = "DONTCALL"))  | "${DIALSTATUS}" = "ANSWER"]?${DIALSTATUS},1)
240.

241.
exten => s,20(huntdial),NoOp(Returned from dialparties with hunt groups to dial )
242.
exten => s,n,Set(HuntLoop=0)
243.
exten => s,n(a22),GotoIf($[${HuntMembers} >= 1]?a30)  ; if this is from rg-group, don't strip prefix
244.
exten => s,n,NoOp(Returning there are no members left in the hunt group to ring)
245.

246.
; dialparties.agi has setup the dialstring for each hunt member in a variable labeled HuntMember0, HuntMember1 etc for each iteration
247.
; and The total number in HuntMembers. So for each iteration, we will update the CALLTRACE Data.
248.
;
249.
exten => s,n+2(a30),Set(HuntMember=HuntMember${HuntLoop})
250.
exten => s,n,GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $[$["${RingGroupMethod}" = "hunt" ] | $["${RingGroupMethod}" = "firstavailable"] | $["${RingGroupMethod}" = "firstnotonphone"]]]?a32:a35)
251.

252.
exten => s,n(a32),Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${HuntLoop} + 1])})
253.
exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
254.
exten => s,n,Goto(s,a42)
255.

256.
;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For" hence the loop
257.
;
258.
exten => s,n(a35),GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?a36:a50)
259.
exten => s,n(a36),Set(CTLoop=0)
260.
exten => s,n(a37),GotoIf($[${CTLoop} > ${HuntLoop}]?a42)  ; if this is from rg-group, don't strip prefix
261.
exten => s,n,Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${CTLoop} + 1])})
262.
exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
263.
exten => s,n,Set(CTLoop=$[1 + ${CTLoop}])
264.
exten => s,n,Goto(s,a37)
265.

266.
exten => s,n(a42),Dial(${${HuntMember}}${ds})
267.
exten => s,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?ANSWER,1)
268.
exten => s,n,Set(HuntLoop=$[1 + ${HuntLoop}])
269.
exten => s,n,GotoIf($[$[$["foo${RingGroupMethod}" != "foofirstavailable"] & $["foo${RingGroupMethod}" != "foofirstnotonphone"]] | $["foo${DialStatus}" = "fooBUSY"]]?a46)
270.
exten => s,n,Set(HuntMembers=0)
271.
exten => s,n(a46),Set(HuntMembers=$[${HuntMembers} - 1])
272.
exten => s,n,Goto(s,a22)
273.

274.
exten => s,n(a50),Noop(Deleting: CALLTRACE/${CT_EXTEN} ${DB_DELETE(CALLTRACE/${CT_EXTEN})})
275.
exten => s,n,Goto(s,a42)
276.

277.
; For call screening
278.
exten => NOANSWER,1,Macro(vm,${SCREEN_EXTEN},BUSY,${IVR_RETVM})
279.
exten => NOANSWER,n,GotoIf($["${IVR_RETVM}" != "RETURN" | "${IVR_CONTEXT}" = ""]?bye)
280.
exten => NOANSWER,n,Return
281.
exten => NOANSWER,n(bye),Macro(hangupcall)
282.
exten => TORTURE,1,Goto(app-blackhole,musiconhold,1)
283.
exten => TORTURE,n,Macro(hangupcall)
284.
exten => DONTCALL,1,Answer
285.
exten => DONTCALL,n,Wait(1)
286.
exten => DONTCALL,n,Zapateller()
287.
exten => DONTCALL,n,Playback(ss-noservice)
288.
exten => DONTCALL,n,Macro(hangupcall)
289.
exten => ANSWER,1,Noop(Call successfully answered - Hanging up now)
290.
exten => ANSWER,n,Macro(hangupcall,)
291.

292.
; make sure hungup calls go here so that proper cleanup occurs from call confirmed calls and the like
293.
;
294.
exten => h,1,Macro(hangupcall)
295.
;-------------------------------------------------------------------------------
296.

297.
;-------------------------------------------------------------------------------
298.
; macro-get-vmcontext:
299.
;
300.
; returns the user's voicemail context
301.
;
302.
[macro-get-vmcontext]
303.
exten => s,1,Set(VMCONTEXT=${DB(AMPUSER/${ARG1}/voicemail)})
304.
exten => s,2,GotoIf($["foo${VMCONTEXT}" = "foo"]?200:300)
305.
exten => s,200,Set(VMCONTEXT=default)
306.
exten => s,300,NoOp()
307.
;-------------------------------------------------------------------------------
308.

309.
;-------------------------------------------------------------------------------
310.
; macro-outisbusy:
311.
;
312.
; called if all trunks are busy.  This macro is overwridden by the
313.
; Outbound Route Messages module if installed and configured to provide
314.
; better messages or choices of tones.
315.
;
316.
[macro-outisbusy]
317.
exten => s,1,Progress
318.
exten => s,n,Playback(all-circuits-busy-now,noanswer)
319.
exten => s,n,Playback(pls-try-call-later,noanswer)
320.
exten => s,n,Macro(hangupcall)
321.
;-------------------------------------------------------------------------------
322.

323.
;-------------------------------------------------------------------------------
324.
; macro-dialout-trunk-predial-hook:
325.
;
326.
; this macro intentionally left blank so it may be safely overwritten for any custom
327.
; requirements that an installation may have.
328.
;
329.
; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
330.
; to a trunk.
331.
;
332.
; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
333.
;                    if set to "BYPASS" then this trunk will be skipped
334.
;
335.
;
336.
[macro-dialout-trunk-predial-hook]
337.
exten => s,1,MacroExit()
338.
;-------------------------------------------------------------------------------
339.

340.
;-------------------------------------------------------------------------------
341.
; macro-dialout-one-predial-hook
342.
;
343.
; this macro intentionally left blank so it may be safely overwritten for any custom
344.
; requirements that an installation may have.
345.
;
346.
; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
347.
; to an individual extension.
348.
;
349.
[macro-dialout-one-predial-hook]
350.
exten => s,1,MacroExit()
351.
;-------------------------------------------------------------------------------
352.

353.
;-------------------------------------------------------------------------------
354.
; macro-dialout-dundi-predial-hook:
355.
;
356.
; this macro intentionally left blank so it may be safely overwritten for any custom
357.
; requirements that an installation may have.
358.
;
359.
; the macro is called by macro-dialout-dundi just prior to making a Dial() attempt
360.
; to a trunk.
361.
;
362.
; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
363.
;                    if set to "BYPASS" then this trunk will be skipped
364.
;
365.
;
366.
[macro-dialout-dundi-predial-hook]
367.
exten => s,1,MacroExit()
368.
;-------------------------------------------------------------------------------
369.

370.
;-------------------------------------------------------------------------------
371.
; macro-user-logon:
372.
;
373.
; Used to log a user onto an adhoc device. Most of the work is done by
374.
; user_login_out.agi AGI script
375.
;
376.
[macro-user-logon]
377.
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
378.
exten => s,n,Answer()
379.
exten => s,n,Wait(1)
380.
exten => s,n,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
381.
; get user's extension
382.
;
383.
exten => s,n,Set(AMPUSER=${ARG1})
384.
exten => s,n,GotoIf($["${AMPUSER}" != ""]?gotpass)
385.
exten => s,n(playagain),Read(AMPUSER,please-enter-your-extension-then-press-pound,,,4)
386.
; get user's password and authenticate
387.
;
388.
exten => s,n,GotoIf($["${AMPUSER}" = ""]?s-MAXATTEMPTS,1)
389.
exten => s,n(gotpass),GotoIf($["${DB_EXISTS(AMPUSER/${AMPUSER}/password)}" = "0"]?s-NOUSER,1)
390.
exten => s,n,Set(AMPUSERPASS=${DB_RESULT})
391.
exten => s,n,GotoIf($[${LEN(${AMPUSERPASS})} = 0]?s-NOPASSWORD,1)
392.
; do not continue if the user has already logged onto this device
393.
;
394.
exten => s,n,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
395.
exten => s,n,GotoIf($["${DEVICEUSER}" = "${AMPUSER}"]?s-ALREADYLOGGEDON,1)
396.
exten => s,n,Authenticate(${AMPUSERPASS})
397.
exten => s,n,AGI(user_login_out.agi,login,${CALLERID(number)},${AMPUSER})
398.
exten => s,n,Playback(agent-loginok)
399.

400.
exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged into)
401.
exten => s-FIXED,n,Playback(ha/phone)
402.
exten => s-FIXED,n,SayDigits(${CALLERID(number)})
403.
exten => s-FIXED,n,Playback(is-curntly-unavail&vm-goodbye)
404.
exten => s-FIXED,n,Hangup ;TODO should play msg indicated device cannot be logged into
405.

406.
exten => s-ALREADYLOGGEDON,1,NoOp(This device has already been logged into by this user)
407.
exten => s-ALREADYLOGGEDON,n,Playback(vm-goodbye)
408.
exten => s-ALREADYLOGGEDON,n,Hangup ;TODO should play msg indicated device is already logged into
409.

410.
exten => s-NOPASSWORD,1,NoOp(This extension does not exist or no password is set)
411.
exten => s-NOPASSWORD,n,Playback(pbx-invalid)
412.
exten => s-NOPASSWORD,n,Goto(s,playagain)
413.

414.
exten => s-MAXATTEMPTS,1,NoOp(Too many login attempts)
415.
exten => s-MAXATTEMPTS,n,Playback(vm-goodbye)
416.
exten => s-MAXATTEMPTS,n,Hangup
417.

418.
exten => s-NOUSER,1,NoOp(Invalid extension ${AMPUSER} entered)
419.
exten => s-NOUSER,n,Playback(pbx-invalid)
420.
exten => s-NOUSER,n,Goto(s,playagain)
421.
;-------------------------------------------------------------------------------
422.

423.
;-------------------------------------------------------------------------------
424.
; macro-user-logoff:
425.
;
426.
; Used to log a user off of an adhoc device. Most of the work is done by
427.
; user_login_out.agi AGI script
428.
;
429.
[macro-user-logoff]
430.
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
431.
exten => s,n,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
432.
exten => s,n,AGI(user_login_out.agi,logout,${CALLERID(number)})
433.
exten => s,n(done),Playback(agent-loggedoff)
434.

435.
exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of)
436.
exten => s-FIXED,n,Playback(an-error-has-occured&vm-goodbye)
437.
exten => s-FIXED,n,Hangup ;TODO should play msg indicated device cannot be logged into
438.
;-------------------------------------------------------------------------------
439.

440.
;-------------------------------------------------------------------------------
441.
; default
442.
;
443.
; FreePBX does not use the default context. This context is used by asterisk when
444.
; it has no other information provided and needs to deliver a call. Hitting this means
445.
; there has been some sort of configuration error, or a potential bug somehwere.
446.
; This context can be reached from either internal or external sources.
447.
;
448.
[default]
449.
include => ext-local
450.
exten => s,1,Playback(vm-goodbye)
451.
exten => s,n,Noop(ERROR: FreePBX Does not use the [default] context, confguration error)
452.
exten => s,n,Macro(hangupcall)
453.
;-------------------------------------------------------------------------------
454.

455.

456.

457.
;*******************************************************************************
458.
; DEPRECATED DIALPLAN - THESE WILL BE REMOVED, NOT USED BY FREEPBX             *
459.
;*******************************************************************************
460.
;
461.

462.
;-------------------------------------------------------------------------------
463.
; macro-fixcid: [DEPRECATED]
464.
;
465.
; For some reason, if I don't run setCIDname, CALLERID(name) will be blank in my AGI
466.
;
467.
[macro-fixcid]
468.
exten => s,1,Set(CALLERID(name)=${CALLERID(name)})
469.
;-------------------------------------------------------------------------------
470.

471.

472.
;-------------------------------------------------------------------------------
473.
; macro-sayXXXX: [DEPRECATED]
474.
;
475.
; Text-To-Speech related macros
476.
; These all follow common actions.  First try to playback a file "tts/custom-md5"
477.
; where "md5" is the md5() of whatever is going to be played. If that doesn't exist,
478.
; try to playback using macro-tts-sayXXXXX (where XXXXX is text/digits/etc, same as
479.
; the macro below). If that macro exits with MACRO_OFFSET=100, then it's done,
480.
; otherwise, fallback to the default asterisk method.
481.
;
482.

483.
;-------------------------------------------------------------------------------
484.
; macro-saytext: [DEPRECATED]
485.
;
486.
; say text is purely for text-to-speech, there is no fallback
487.
;
488.
[macro-saytext]
489.
exten => s,1,Noop(Trying custom SayText playback for "${ARG1}")
490.
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
491.
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
492.
; call tts-saytext. This should set MACRO_OFFSET=101 if it was successful
493.
exten => s,n(tts),Macro(tts-saytext,${ARG1},${ARG2},${ARG3})
494.
exten => s,n,Noop(No text-to-speech handler for SayText, cannot say "${ARG1}")
495.
exten => s,n,Goto(done)
496.
exten => s,tts+101,Noop(tts handled saytext)
497.
;-------------------------------------------------------------------------------
498.

499.
;-------------------------------------------------------------------------------
500.
; macro-sayname: [DEPRECATED]
501.
;
502.
; say name is for saying names typically, but fallsback to using SayAlpha
503.
; (saying the word letter-by-letter)
504.
;
505.
[macro-sayname]
506.
exten => s,1,Noop(Trying custom SayName playback for "${ARG1}")
507.
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
508.
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
509.
; call tts-sayalpha. This should set MACRO_OFFSET=101 if it was successful
510.
exten => s,n(tts),Macro(tts-sayalpha,${ARG1},${ARG2},${ARG3})
511.
exten => s,n,SayAlpha(${ARG1})
512.
exten => s,n,Goto(done)
513.
exten => s,tts+101,Noop(tts handled sayname)
514.
;-------------------------------------------------------------------------------
515.

516.
;-------------------------------------------------------------------------------
517.
; macro-saynumber: [DEPRECATED]
518.
;
519.
; Say number is for saying numbers (eg "one thousand forty six")
520.
;
521.
[macro-saynumber]
522.
exten => s,1,Noop(Trying custom SayNumber playback for "${ARG1}")
523.
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
524.
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
525.
; call tts-saynumber. This should set MACRO_OFFSET=101 if it was successful
526.
exten => s,n(tts),Macro(tts-saynumber,${ARG1},${ARG2},${ARG3})
527.
exten => s,n,SayNumber(${ARG1})
528.
exten => s,n,Goto(done)
529.
exten => s,tts+101,Noop(tts handled saynumber)
530.
;-------------------------------------------------------------------------------
531.

532.
;-------------------------------------------------------------------------------
533.
; macro-saydigits: [DEPRECATED]
534.
;
535.
; Say digits is for saying digits one-by-one (eg, "one zero four six")
536.
;
537.
[macro-saydigits]
538.
exten => s,1,Noop(Trying custom SayDigits playback for "${ARG1}")
539.
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
540.
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
541.
; call tts-saydigits. This should set MACRO_OFFSET=101 if it was successful
542.
exten => s,n(tts),Macro(tts-saydigits,${ARG1},${ARG2},${ARG3})
543.
exten => s,n,SayDigits(${ARG1})
544.
exten => s,n,Goto(done)
545.
;-------------------------------------------------------------------------------
extensions_additional.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
[globals]
10.
CFDEVSTATE = TRUE
11.
CAMPONTOGGLE = *84
12.
DNDDEVSTATE = TRUE
13.
FMDEVSTATE = TRUE
14.
QUEDEVSTATE = TRUE
15.
DYNAMIC_FEATURES = apprecord
16.
INTERCOMCODE = *80
17.
ASTETCDIR = /etc/asterisk
18.
ASTMODDIR = /usr/lib/asterisk/modules
19.
ASTVARLIBDIR = /var/lib/asterisk
20.
ASTAGIDIR = /var/lib/asterisk/agi-bin
21.
ASTSPOOLDIR = /var/spool/asterisk
22.
ASTRUNDIR = /var/run/asterisk
23.
ASTLOGDIR = /var/log/asterisk
24.
CWINUSEBUSY = true
25.
AMPMGRUSER = admin
26.
AMPMGRPASS = amp111
27.
AMPDBENGINE = mysql
28.
AMPDBHOST = localhost
29.
AMPDBNAME = asterisk
30.
AMPDBUSER = freepbxuser
31.
AMPDBPASS = 4afed5a03531
32.
VMX_CONTEXT = from-internal
33.
VMX_PRI = 1
34.
VMX_TIMEDEST_CONTEXT = 
35.
VMX_TIMEDEST_EXT = dovm
36.
VMX_TIMEDEST_PRI = 1
37.
VMX_LOOPDEST_CONTEXT = 
38.
VMX_LOOPDEST_EXT = dovm
39.
VMX_LOOPDEST_PRI = 1
40.
MIXMON_DIR = 
41.
MIXMON_POST = 
42.
DIAL_OPTIONS = Ttr
43.
TRUNK_OPTIONS = Tt
44.
TRUNK_RING_TIMER = 300
45.
MIXMON_FORMAT = wav
46.
REC_POLICY = caller
47.
RINGTIMER_DEFAULT = 15
48.
TRANSFER_CONTEXT = from-internal-xfer
49.
ASTVERSION = 13.9.1
50.
ASTCHANDAHDI = 1
51.
NULL = ""
52.
OUT_2 = PJSIP
53.
OUT_2_SUFFIX = @Telekom
54.
OUTCID_2 = 04074041501
55.
OUTMAXCHANS_2 = 2
56.
OUTFAIL_2 = 
57.
OUTPREFIX_2 = 
58.
OUTDISABLE_2 = off
59.
OUTKEEPCID_2 = off
60.
FORCEDOUTCID_2 = 
61.
PREFIX_TRUNK_2 = 
62.
ALLOW_SIP_ANON = no
63.
SIPLANG = 
64.
#include globals_custom.conf
65.

66.
;end of [globals]
67.

68.
[app-blacklist]
69.
exten => s,1,Macro(user-callerid,)
70.

71.
exten => *32,1,Goto(app-blacklist-last,s,1)
72.

73.
exten => *31,1,Goto(app-blacklist-remove,s,1)
74.

75.
exten => *30,1,Goto(app-blacklist-add,s,1)
76.

77.
;--== end of [app-blacklist] ==--;
78.

79.

80.
[app-blacklist-check]
81.
exten => s,1(check),GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
82.
exten => s,n,Set(CALLED_BLACKLIST=1)
83.
exten => s,n,Return()
84.
exten => s,n(blacklisted),Answer
85.
exten => s,n,Wait(1)
86.
exten => s,n,Zapateller()
87.
exten => s,n,Playback(ss-noservice)
88.
exten => s,n,Hangup
89.

90.
;--== end of [app-blacklist-check] ==--;
91.

92.

93.
[app-blacklist-last]
94.
exten => s,1,Answer
95.
exten => s,n,Macro(user-callerid,)
96.
exten => s,n,Wait(1)
97.
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${AMPUSER})})
98.
exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo)
99.
exten => s,n,Playback(privacy-to-blacklist-last-caller&telephone-number)
100.
exten => s,n,SayDigits(${lastcaller})
101.
exten => s,n,Set(TIMEOUT(digit)=3)
102.
exten => s,n,Set(TIMEOUT(response)=7)
103.
exten => s,n,Playback(if-correct-press&digits/1)
104.
exten => s,n,Goto(end)
105.
exten => s,n(noinfo),Playback(unidentified-no-callback)
106.
exten => s,n,Hangup
107.
exten => s,n,Noop(Waiting for input)
108.
exten => s,n(end),WaitExten(60,)
109.
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
110.

111.
exten => 1,1,Set(DB(blacklist/${lastcaller})=1)
112.
exten => 1,n,Playback(num-was-successfully)
113.
exten => 1,n,Playback(added)
114.
exten => 1,n,Wait(1)
115.
exten => 1,n,Hangup
116.

117.
;--== end of [app-blacklist-last] ==--;
118.

119.

120.
[app-blacklist-remove]
121.
exten => s,1,Answer
122.
exten => s,n,Macro(user-callerid,)
123.
exten => s,n,Wait(1)
124.
exten => s,n,Playback(entr-num-rmv-blklist)
125.
exten => s,n,Set(TIMEOUT(digit)=5)
126.
exten => s,n,Set(TIMEOUT(response)=60)
127.
exten => s,n,Read(blacknr,then-press-pound,,,,)
128.
exten => s,n,SayDigits(${blacknr})
129.
exten => s,n,Playback(if-correct-press&digits/1)
130.
exten => s,n,Noop(Waiting for input)
131.
exten => s,n(end),WaitExten(60,)
132.
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
133.

134.
exten => 1,1,Noop(Deleting: blacklist/${blacknr} ${DB_DELETE(blacklist/${blacknr})})
135.
exten => 1,n,Playback(num-was-successfully&removed)
136.
exten => 1,n,Wait(1)
137.
exten => 1,n,Hangup
138.

139.
;--== end of [app-blacklist-remove] ==--;
140.

141.

142.
[app-blacklist-add]
143.
exten => s,1,Answer
144.
exten => s,n,Macro(user-callerid,)
145.
exten => s,n,Wait(1)
146.
exten => s,n,Set(NumLoops=0)
147.
exten => s,n(start),Playback(enter-num-blacklist)
148.
exten => s,n,Set(TIMEOUT(digit)=5)
149.
exten => s,n,Set(TIMEOUT(response)=60)
150.
exten => s,n,Read(blacknr,then-press-pound,,,,)
151.
exten => s,n,SayDigits(${blacknr})
152.
exten => s,n,Playback(if-correct-press&digits/1)
153.
exten => s,n,Noop(Waiting for input)
154.
exten => s,n(end),WaitExten(60,)
155.
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
156.

157.
exten => 1,1,GotoIf($[ "${blacknr}" != ""]?:app-blacklist-add-invalid,s,1)
158.
exten => 1,n,Set(DB(blacklist/${blacknr})=1)
159.
exten => 1,n,Playback(num-was-successfully&added)
160.
exten => 1,n,Wait(1)
161.
exten => 1,n,Hangup
162.

163.
;--== end of [app-blacklist-add] ==--;
164.

165.

166.
[app-blacklist-add-invalid]
167.
exten => s,1,Set(NumLoops=$[${NumLoops} + 1])
168.
exten => s,n,Playback(pm-invalid-option)
169.
exten => s,n,GotoIf($[${NumLoops} < 3]?app-blacklist-add,s,start)
170.
exten => s,n,Playback(goodbye)
171.
exten => s,n,Hangup
172.

173.
;--== end of [app-blacklist-add-invalid] ==--;
174.

175.

176.
[app-cf-toggle]
177.
exten => *96,1,Answer
178.
exten => *96,n,Wait(1)
179.
exten => *96,n,Macro(user-callerid,)
180.
exten => *96,n,Set(fromext=${AMPUSER})
181.
exten => *96,n,GotoIf($["${DB(CF/${fromext})}" = ""]?activate:deactivate)
182.
exten => *96,n(activate),Read(toext,ent-target-attendant&then-press-pound,,,,)
183.
exten => *96,n,GotoIf($["${toext}"=""]?activate)
184.
exten => *96,n,Wait(1)
185.
exten => *96,n(toext),Set(DB(CF/${fromext})=${toext})
186.
exten => *96,n,Set(STATE=BUSY)
187.
exten => *96,n,Gosub(app-cf-toggle,sstate,1())
188.
exten => *96,n(hook_on),Playback(call-fwd-unconditional&for&extension)
189.
exten => *96,n,SayDigits(${fromext})
190.
exten => *96,n,Playback(is-set-to)
191.
exten => *96,n,SayDigits(${toext})
192.
exten => *96,n,Macro(hangupcall,)
193.
exten => *96,n(setdirect),Answer
194.
exten => *96,n,Wait(1)
195.
exten => *96,n,Macro(user-callerid,)
196.
exten => *96,n,Goto(toext)
197.
exten => *96,n(deactivate),Noop(Deleting: CF/${fromext} ${DB_DELETE(CF/${fromext})})
198.
exten => *96,n,Set(STATE=NOT_INUSE)
199.
exten => *96,n,Gosub(app-cf-toggle,sstate,1())
200.
exten => *96,n(hook_off),Playback(call-fwd-unconditional&de-activated)
201.
exten => *96,n,Macro(hangupcall,)
202.

203.
exten => sstate,1,Set(DEVICE_STATE(Custom:CF${fromext})=${STATE})
204.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${fromext}/device)})
205.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
206.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
207.
exten => sstate,n,Set(ITER=1)
208.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVCF${CUT(DEVICES,&,${ITER})})=${STATE})
209.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
210.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
211.
exten => sstate,n(return),Return()
212.

213.
;--== end of [app-cf-toggle] ==--;
214.

215.

216.
[app-cf-unavailable-prompt-on]
217.
exten => *95,1,Answer
218.
exten => *95,n,Wait(1)
219.
exten => *95,n,Macro(user-callerid,)
220.
exten => *95,n,Read(fromext,call-fwd-no-ans&please-enter-your&extension&then-press-pound,,,,)
221.
exten => *95,n,Set(fromext=${IF($["${fromext}"=""]?${AMPUSER}:${fromext})})
222.
exten => *95,n,Wait(1)
223.
exten => *95,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
224.
exten => *95,n,GotoIf($["${toext}"=""]?startread)
225.
exten => *95,n,Wait(1)
226.
exten => *95,n,Set(DB(CFU/${fromext})=${toext})
227.
exten => *95,n(hook_1),Playback(call-fwd-no-ans&for&extension)
228.
exten => *95,n,SayDigits(${fromext})
229.
exten => *95,n,Playback(is-set-to)
230.
exten => *95,n,SayDigits(${toext})
231.
exten => *95,n,Macro(hangupcall,)
232.

233.
exten => _*95.,1,Answer
234.
exten => _*95.,n,Wait(1)
235.
exten => _*95.,n,Macro(user-callerid,)
236.
exten => _*95.,n,Set(fromext=${AMPUSER})
237.
exten => _*95.,n,Set(toext=${EXTEN:3})
238.
exten => _*95.,n,Set(DB(CFU/${fromext})=${toext})
239.
exten => _*95.,n(hook_2),Playback(call-fwd-no-ans&for&extension)
240.
exten => _*95.,n,SayDigits(${fromext})
241.
exten => _*95.,n,Playback(is-set-to)
242.
exten => _*95.,n,SayDigits(${toext})
243.
exten => _*95.,n,Macro(hangupcall,)
244.

245.
;--== end of [app-cf-unavailable-prompt-on] ==--;
246.

247.

248.
[app-cf-busy-prompting-on]
249.
exten => *94,1,Answer
250.
exten => *94,n,Wait(1)
251.
exten => *94,n,Macro(user-callerid,)
252.
exten => *94,n,Read(fromext,call-fwd-on-busy&please-enter-your&extension&then-press-pound,,,,)
253.
exten => *94,n,Set(fromext=${IF($["${fromext}"=""]?${AMPUSER}:${fromext})})
254.
exten => *94,n,Wait(1)
255.
exten => *94,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
256.
exten => *94,n,GotoIf($["${toext}"=""]?startread)
257.
exten => *94,n,Wait(1)
258.
exten => *94,n,Set(DB(CFB/${fromext})=${toext})
259.
exten => *94,n(hook_1),Playback(call-fwd-on-busy&for&extension)
260.
exten => *94,n,SayDigits(${fromext})
261.
exten => *94,n,Playback(is-set-to)
262.
exten => *94,n,SayDigits(${toext})
263.
exten => *94,n,Macro(hangupcall,)
264.

265.
exten => _*94.,1,Answer
266.
exten => _*94.,n,Wait(1)
267.
exten => _*94.,n,Macro(user-callerid,)
268.
exten => _*94.,n,Set(fromext=${AMPUSER})
269.
exten => _*94.,n,Set(toext=${EXTEN:3})
270.
exten => _*94.,n,Set(DB(CFB/${fromext})=${toext})
271.
exten => _*94.,n(hook_2),Playback(call-fwd-on-busy&for&extension)
272.
exten => _*94.,n,SayDigits(${fromext})
273.
exten => _*94.,n,Playback(is-set-to)
274.
exten => _*94.,n,SayDigits(${toext})
275.
exten => _*94.,n,Macro(hangupcall,)
276.

277.
;--== end of [app-cf-busy-prompting-on] ==--;
278.

279.

280.
[app-cf-prompting-on]
281.
exten => *93,1,Answer
282.
exten => *93,n,Wait(1)
283.
exten => *93,n,Macro(user-callerid,)
284.
exten => *93,n,Read(fromext,call-fwd-unconditional&please-enter-your&extension&then-press-pound,,,,)
285.
exten => *93,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
286.
exten => *93,n,Wait(1)
287.
exten => *93,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
288.
exten => *93,n,GotoIf($["foo${toext}"="foo"]?startread)
289.
exten => *93,n,Wait(1)
290.
exten => *93,n,Set(DB(CF/${fromext})=${toext})
291.
exten => *93,n,Set(STATE=BUSY)
292.
exten => *93,n,Gosub(app-cf-prompting-on,sstate,1())
293.
exten => *93,n(hook_1),Playback(call-fwd-unconditional&for&extension)
294.
exten => *93,n,SayDigits(${fromext})
295.
exten => *93,n,Playback(is-set-to)
296.
exten => *93,n,SayDigits(${toext})
297.
exten => *93,n,Macro(hangupcall,)
298.

299.
exten => _*93.,1,Answer
300.
exten => _*93.,n,Wait(1)
301.
exten => _*93.,n,Macro(user-callerid,)
302.
exten => _*93.,n,Set(fromext=${AMPUSER})
303.
exten => _*93.,n,Set(toext=${EXTEN:3})
304.
exten => _*93.,n,Set(DB(CF/${fromext})=${toext})
305.
exten => _*93.,n,Set(STATE=BUSY)
306.
exten => _*93.,n,Gosub(app-cf-prompting-on,sstate,1())
307.
exten => _*93.,n(hook_2),Playback(call-fwd-unconditional&for&extension)
308.
exten => _*93.,n,SayDigits(${fromext})
309.
exten => _*93.,n,Playback(is-set-to)
310.
exten => _*93.,n,SayDigits(${toext})
311.
exten => _*93.,n,Macro(hangupcall,)
312.

313.
exten => sstate,1,Set(DEVICE_STATE(Custom:CF${fromext})=${STATE})
314.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${fromext}/device)})
315.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
316.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
317.
exten => sstate,n,Set(ITER=1)
318.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVCF${CUT(DEVICES,&,${ITER})})=${STATE})
319.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
320.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
321.
exten => sstate,n(return),Return()
322.

323.
;--== end of [app-cf-prompting-on] ==--;
324.

325.

326.
[app-cf-busy-off-any]
327.
exten => *92,1,Answer
328.
exten => *92,n,Macro(user-callerid,)
329.
exten => *92,n,Wait(1)
330.
exten => *92,n,Read(fromext,please-enter-your&extension&then-press-pound,,,,)
331.
exten => *92,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
332.
exten => *92,n,Wait(1)
333.
exten => *92,n,Noop(Deleting: CFB/${fromext} ${DB_DELETE(CFB/${fromext})})
334.
exten => *92,n(hook_1),Playback(call-fwd-on-busy&for&extension)
335.
exten => *92,n,SayDigits(${fromext})
336.
exten => *92,n,Playback(cancelled)
337.
exten => *92,n,Macro(hangupcall,)
338.

339.
;--== end of [app-cf-busy-off-any] ==--;
340.

341.

342.
[app-cf-busy-off]
343.
exten => *91,1,Answer
344.
exten => *91,n,Wait(1)
345.
exten => *91,n,Macro(user-callerid,)
346.
exten => *91,n,Set(fromext=${AMPUSER})
347.
exten => *91,n,Noop(Deleting: CFB/${fromext} ${DB_DELETE(CFB/${fromext})})
348.
exten => *91,n(hook_1),Playback(call-fwd-on-busy&de-activated)
349.
exten => *91,n,Macro(hangupcall,)
350.

351.
exten => _*91.,1,Answer
352.
exten => _*91.,n,Wait(1)
353.
exten => _*91.,n,Set(fromext=${EXTEN:3})
354.
exten => _*91.,n,Noop(Deleting: CFB/${fromext} ${DB_DELETE(CFB/${fromext})})
355.
exten => _*91.,n(hook_2),Playback(call-fwd-on-busy&for&extension)
356.
exten => _*91.,n,SayDigits(${fromext})
357.
exten => _*91.,n,Playback(cancelled)
358.
exten => _*91.,n,Macro(hangupcall,)
359.

360.
;--== end of [app-cf-busy-off] ==--;
361.

362.

363.
[app-cf-busy-on]
364.
exten => *90,1,Answer
365.
exten => *90,n,Wait(1)
366.
exten => *90,n,Macro(user-callerid,)
367.
exten => *90,n,Set(fromext=${AMPUSER})
368.
exten => *90,n,GotoIf($["${fromext}"!=""]?startread)
369.
exten => *90,n,Playback(agent-loggedoff)
370.
exten => *90,n,Macro(hangupcall,)
371.
exten => *90,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
372.
exten => *90,n,GotoIf($["${toext}"=""]?startread)
373.
exten => *90,n,Wait(1)
374.
exten => *90,n,Set(DB(CFB/${fromext})=${toext})
375.
exten => *90,n(hook_1),Playback(call-fwd-on-busy&for&extension)
376.
exten => *90,n,SayDigits(${fromext})
377.
exten => *90,n,Playback(is-set-to)
378.
exten => *90,n,SayDigits(${toext})
379.
exten => *90,n,Macro(hangupcall,)
380.

381.
exten => _*90.,1,Answer
382.
exten => _*90.,n,Wait(1)
383.
exten => _*90.,n,Macro(user-callerid,)
384.
exten => _*90.,n,Set(fromext=${AMPUSER})
385.
exten => _*90.,n,Set(toext=${EXTEN:3})
386.
exten => _*90.,n,Set(DB(CFB/${fromext})=${toext})
387.
exten => _*90.,n(hook_2),Playback(call-fwd-on-busy&for&extension)
388.
exten => _*90.,n,SayDigits(${fromext})
389.
exten => _*90.,n,Playback(is-set-to)
390.
exten => _*90.,n,SayDigits(${toext})
391.
exten => _*90.,n,Macro(hangupcall,)
392.

393.
;--== end of [app-cf-busy-on] ==--;
394.

395.

396.
[app-cf-off-any]
397.
exten => *74,1,Answer
398.
exten => *74,n,Macro(user-callerid,)
399.
exten => *74,n,Wait(1)
400.
exten => *74,n,Read(fromext,please-enter-your&extension&then-press-pound,,,,)
401.
exten => *74,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
402.
exten => *74,n,Wait(1)
403.
exten => *74,n,Noop(Deleting: CF/${fromext} ${DB_DELETE(CF/${fromext})})
404.
exten => *74,n,Set(STATE=NOT_INUSE)
405.
exten => *74,n,Gosub(app-cf-off-any,sstate,1())
406.
exten => *74,n(hook_1),Playback(call-fwd-unconditional&for&extension)
407.
exten => *74,n,SayDigits(${fromext})
408.
exten => *74,n,Playback(cancelled)
409.
exten => *74,n,Macro(hangupcall,)
410.

411.
exten => sstate,1,Set(DEVICE_STATE(Custom:CF${fromext})=${STATE})
412.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${fromext}/device)})
413.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
414.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
415.
exten => sstate,n,Set(ITER=1)
416.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVCF${CUT(DEVICES,&,${ITER})})=${STATE})
417.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
418.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
419.
exten => sstate,n(return),Return()
420.

421.
;--== end of [app-cf-off-any] ==--;
422.

423.

424.
[app-cf-off]
425.
exten => *73,1,Answer
426.
exten => *73,n,Wait(1)
427.
exten => *73,n,Macro(user-callerid,)
428.
exten => *73,n,Set(fromext=${AMPUSER})
429.
exten => *73,n,Noop(Deleting: CF/${fromext} ${DB_DELETE(CF/${fromext})})
430.
exten => *73,n,Set(STATE=NOT_INUSE)
431.
exten => *73,n,Gosub(app-cf-off,sstate,1())
432.
exten => *73,n(hook_1),Playback(call-fwd-unconditional&de-activated)
433.
exten => *73,n,Macro(hangupcall,)
434.

435.
exten => _*73.,1,Answer
436.
exten => _*73.,n,Wait(1)
437.
exten => _*73.,n,Set(fromext=${EXTEN:3})
438.
exten => _*73.,n,Noop(Deleting: CF/${fromext} ${DB_DELETE(CF/${fromext})})
439.
exten => _*73.,n,Set(STATE=NOT_INUSE)
440.
exten => _*73.,n,Gosub(app-cf-off,sstate,1())
441.
exten => _*73.,n(hook_2),Playback(call-fwd-unconditional&for&extension)
442.
exten => _*73.,n,SayDigits(${fromext})
443.
exten => _*73.,n,Playback(cancelled)
444.
exten => _*73.,n,Macro(hangupcall,)
445.

446.
exten => sstate,1,Set(DEVICE_STATE(Custom:CF${fromext})=${STATE})
447.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${fromext}/device)})
448.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
449.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
450.
exten => sstate,n,Set(ITER=1)
451.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVCF${CUT(DEVICES,&,${ITER})})=${STATE})
452.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
453.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
454.
exten => sstate,n(return),Return()
455.

456.
;--== end of [app-cf-off] ==--;
457.

458.

459.
[app-cf-on]
460.
exten => *72,1,Answer
461.
exten => *72,n,Wait(1)
462.
exten => *72,n,Macro(user-callerid,)
463.
exten => *72,n,Set(fromext=${AMPUSER})
464.
exten => *72,n,GotoIf($["${fromext}"!=""]?startread)
465.
exten => *72,n,Playback(agent-loggedoff)
466.
exten => *72,n,Macro(hangupcall,)
467.
exten => *72,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
468.
exten => *72,n,GotoIf($["foo${toext}"="foo"]?startread)
469.
exten => *72,n,Wait(1)
470.
exten => *72,n,Set(DB(CF/${fromext})=${toext})
471.
exten => *72,n,Set(STATE=BUSY)
472.
exten => *72,n,Gosub(app-cf-on,sstate,1())
473.
exten => *72,n(hook_1),Playback(call-fwd-unconditional&for&extension)
474.
exten => *72,n,SayDigits(${fromext})
475.
exten => *72,n,Playback(is-set-to)
476.
exten => *72,n,SayDigits(${toext})
477.
exten => *72,n,Macro(hangupcall,)
478.

479.
exten => _*72.,1,Answer
480.
exten => _*72.,n,Wait(1)
481.
exten => _*72.,n,Macro(user-callerid,)
482.
exten => _*72.,n,Set(fromext=${AMPUSER})
483.
exten => _*72.,n,Set(toext=${EXTEN:3})
484.
exten => _*72.,n,Set(DB(CF/${fromext})=${toext})
485.
exten => _*72.,n,Set(STATE=BUSY)
486.
exten => _*72.,n,Gosub(app-cf-on,sstate,1())
487.
exten => _*72.,n(hook_2),Playback(call-fwd-unconditional&for&extension)
488.
exten => _*72.,n,SayDigits(${fromext})
489.
exten => _*72.,n,Playback(is-set-to)
490.
exten => _*72.,n,SayDigits(${toext})
491.
exten => _*72.,n,Macro(hangupcall,)
492.

493.
exten => sstate,1,Set(DEVICE_STATE(Custom:CF${fromext})=${STATE})
494.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${fromext}/device)})
495.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
496.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
497.
exten => sstate,n,Set(ITER=1)
498.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVCF${CUT(DEVICES,&,${ITER})})=${STATE})
499.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
500.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
501.
exten => sstate,n(return),Return()
502.

503.
;--== end of [app-cf-on] ==--;
504.

505.

506.
[app-cf-unavailable-off]
507.
exten => *53,1,Answer
508.
exten => *53,n,Wait(1)
509.
exten => *53,n,Macro(user-callerid,)
510.
exten => *53,n,Set(fromext=${AMPUSER})
511.
exten => *53,n,Noop(Deleting: CFU/${fromext} ${DB_DELETE(CFU/${fromext})})
512.
exten => *53,n(hook_1),Playback(call-fwd-no-ans&de-activated)
513.
exten => *53,n,Macro(hangupcall,)
514.

515.
exten => _*53.,1,Answer
516.
exten => _*53.,n,Wait(1)
517.
exten => _*53.,n,Set(fromext=${EXTEN:3})
518.
exten => _*53.,n,Noop(Deleting: CFU/${fromext} ${DB_DELETE(CFU/${fromext})})
519.
exten => _*53.,n(hook_2),Playback(call-fwd-no-ans&for&extension)
520.
exten => _*53.,n,SayDigits(${fromext})
521.
exten => _*53.,n,Playback(cancelled)
522.
exten => _*53.,n,Macro(hangupcall,)
523.

524.
;--== end of [app-cf-unavailable-off] ==--;
525.

526.

527.
[app-cf-unavailable-on]
528.
exten => *52,1,Answer
529.
exten => *52,n,Wait(1)
530.
exten => *52,n,Macro(user-callerid,)
531.
exten => *52,n,Set(fromext=${AMPUSER})
532.
exten => *52,n,GotoIf($["${fromext}"!=""]?startread)
533.
exten => *52,n,Playback(agent-loggedoff)
534.
exten => *52,n,Macro(hangupcall,)
535.
exten => *52,n(startread),Read(toext,ent-target-attendant&then-press-pound,,,,)
536.
exten => *52,n,GotoIf($["${toext}"=""]?startread)
537.
exten => *52,n,Wait(1)
538.
exten => *52,n,Set(DB(CFU/${fromext})=${toext})
539.
exten => *52,n(hook_1),Playback(call-fwd-no-ans&for&extension)
540.
exten => *52,n,SayDigits(${fromext})
541.
exten => *52,n,Playback(is-set-to)
542.
exten => *52,n,SayDigits(${toext})
543.
exten => *52,n,Macro(hangupcall,)
544.

545.
exten => _*52.,1,Answer
546.
exten => _*52.,n,Wait(1)
547.
exten => _*52.,n,Macro(user-callerid,)
548.
exten => _*52.,n,Set(fromext=${AMPUSER})
549.
exten => _*52.,n,Set(toext=${EXTEN:3})
550.
exten => _*52.,n,Set(DB(CFU/${fromext})=${toext})
551.
exten => _*52.,n(hook_2),Playback(call-fwd-no-ans&for&extension)
552.
exten => _*52.,n,SayDigits(${fromext})
553.
exten => _*52.,n,Playback(is-set-to)
554.
exten => _*52.,n,SayDigits(${toext})
555.
exten => _*52.,n,Macro(hangupcall,)
556.

557.
;--== end of [app-cf-unavailable-on] ==--;
558.

559.

560.
[sub-record-cancel]
561.
exten => s,1,Return()
562.

563.
;--== end of [sub-record-cancel] ==--;
564.

565.

566.
[sub-record-check]
567.
exten => s,1,GotoIf($[${LEN(${FROMEXTEN})}]?initialized)
568.
exten => s,n,Set(__REC_STATUS=INITIALIZED)
569.
exten => s,n,Set(NOW=${EPOCH})
570.
exten => s,n,Set(__DAY=${STRFTIME(${NOW},,%d)})
571.
exten => s,n,Set(__MONTH=${STRFTIME(${NOW},,%m)})
572.
exten => s,n,Set(__YEAR=${STRFTIME(${NOW},,%Y)})
573.
exten => s,n,Set(__TIMESTR=${YEAR}${MONTH}${DAY}-${STRFTIME(${NOW},,%H%M%S)})
574.
exten => s,n,Set(__FROMEXTEN=${IF($[${LEN(${AMPUSER})}]?${AMPUSER}:${IF($[${LEN(${REALCALLERIDNUM})}]?${REALCALLERIDNUM}:unknown)})})
575.
exten => s,n,Set(__MON_FMT=${IF($["${MIXMON_FORMAT}"="wav49"]?WAV:${MIXMON_FORMAT})})
576.
exten => s,n(initialized),Noop(Recordings initialized)
577.
exten => s,n,ExecIf($[!${LEN(${ARG3})}]?Set(ARG3=dontcare))
578.
exten => s,n,Set(REC_POLICY_MODE_SAVE=${REC_POLICY_MODE})
579.
exten => s,n,ExecIf($["${BLINDTRANSFER}${ATTENDEDTRANSFER}" != ""]?Set(REC_STATUS=NO))
580.
exten => s,n(next),GotoIf($[${LEN(${ARG1})}]?checkaction)
581.
exten => s,n(recorderror),Playback(something-terribly-wrong,error)
582.
exten => s,n,Hangup
583.
exten => s,n(checkaction),GotoIf($[${DIALPLAN_EXISTS(sub-record-check,${ARG1})}]?sub-record-check,${ARG1},1)
584.
exten => s,n,Noop(Generic ${ARG1} Recording Check - ${FROMEXTEN} ${ARG2})
585.
exten => s,n,Gosub(recordcheck,1(${ARG3},${ARG1},${ARG2}))
586.
exten => s,n,Return()
587.

588.
exten => recordcheck,1,Noop(Starting recording check against ${ARG1})
589.
exten => recordcheck,n,Goto(${ARG1})
590.
exten => recordcheck,n(dontcare),Return()
591.
exten => recordcheck,n(always),Noop(Detected legacy "always" entry. Mapping to "force")
592.
exten => recordcheck,n(force),Set(__REC_POLICY_MODE=FORCE)
593.
exten => recordcheck,n,GotoIf($["${REC_STATUS}"!="RECORDING"]?startrec)
594.
exten => recordcheck,n,Return()
595.
exten => recordcheck,n(delayed),Noop(Detected legacy "delayed" entry. Mapping to "yes")
596.
exten => recordcheck,n(yes),ExecIf($["${REC_POLICY_MODE}" = "NEVER" | "${REC_POLICY_MODE}" = "NO" | "${REC_STATUS}" = "RECORDING"]?Return())
597.
exten => recordcheck,n,Set(__REC_POLICY_MODE=YES)
598.
exten => recordcheck,n,Goto(startrec)
599.
exten => recordcheck,n(no),Set(__REC_POLICY_MODE=NO)
600.
exten => recordcheck,n,Return()
601.
exten => recordcheck,n(never),Set(__REC_POLICY_MODE=NEVER)
602.
exten => recordcheck,n,Goto(stoprec)
603.
exten => recordcheck,n(startrec),Noop(Starting recording: ${ARG2}, ${ARG3})
604.
exten => recordcheck,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
605.
exten => recordcheck,n,Set(__CALLFILENAME=${ARG2}-${ARG3}-${FROMEXTEN}-${TIMESTR}-${UNIQUEID})
606.
exten => recordcheck,n,MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MON_FMT},ai(LOCAL_MIXMON_ID),${MIXMON_POST})
607.
exten => recordcheck,n,Set(__MIXMON_ID=${LOCAL_MIXMON_ID})
608.
exten => recordcheck,n,Set(__RECORD_ID=${CHANNEL(name)})
609.
exten => recordcheck,n,Set(__REC_STATUS=RECORDING)
610.
exten => recordcheck,n,Set(CDR(recordingfile)=${CALLFILENAME}.${MON_FMT})
611.
exten => recordcheck,n,Return()
612.
exten => recordcheck,n(stoprec),Noop(Stopping recording: ${ARG2}, ${ARG3})
613.
exten => recordcheck,n,Set(__REC_STATUS=STOPPED)
614.
exten => recordcheck,n,System(/var/lib/asterisk/bin/stoprecording.php "${CHANNEL(name)}")
615.
exten => recordcheck,n,Return()
616.

617.
exten => out,1,Noop(Outbound Recording Check from ${FROMEXTEN} to ${ARG2})
618.
exten => out,n,Set(RECMODE=${DB(AMPUSER/${FROMEXTEN}/recording/out/external)})
619.
exten => out,n,ExecIf($[!${LEN(${RECMODE})} | "${RECMODE}" = "dontcare"]?Goto(routewins))
620.
exten => out,n,ExecIf($["${ARG3}" = "never" | "${ARG3}" = "force"]?Goto(routewins))
621.
exten => out,n(extenwins),Gosub(recordcheck,1(${RECMODE},out,${ARG2}))
622.
exten => out,n,Return()
623.
exten => out,n(routewins),Gosub(recordcheck,1(${ARG3},out,${ARG2}))
624.
exten => out,n,Return()
625.

626.
exten => in,1,Noop(Inbound Recording Check to ${ARG2})
627.
exten => in,n,Set(FROMEXTEN=unknown)
628.
exten => in,n,ExecIf($[${LEN(${CALLERID(num)})}]?Set(FROMEXTEN=${CALLERID(num)}))
629.
exten => in,n,Gosub(recordcheck,1(${ARG3},in,${ARG2}))
630.
exten => in,n,Return()
631.

632.
exten => exten,1,Noop(Exten Recording Check between ${FROMEXTEN} and ${ARG2})
633.
exten => exten,n,Set(CALLTYPE=${IF($[${LEN(${FROM_DID})}]?external:internal)})
634.
exten => exten,n,ExecIf(${LEN(${CALLTYPE_OVERRIDE})}?Set(CALLTYPE=${CALLTYPE_OVERRIDE}))
635.
exten => exten,n,Set(CALLEE=${DB(AMPUSER/${ARG2}/recording/in/${CALLTYPE})})
636.
exten => exten,n,ExecIf($[!${LEN(${CALLEE})}]?Set(CALLEE=dontcare))
637.
exten => exten,n,GotoIf($["${CALLTYPE}"="external"]?callee)
638.
exten => exten,n,GotoIf($["${CALLEE}"="dontcare"]?caller)
639.
exten => exten,n,ExecIf($[${LEN(${DB(AMPUSER/${FROMEXTEN}/recording/priority)})}]?Set(CALLER_PRI=${DB(AMPUSER/${FROMEXTEN}/recording/priority)}):Set(CALLER_PRI=0))
640.
exten => exten,n,ExecIf($[${LEN(${DB(AMPUSER/${ARG2}/recording/priority)})}]?Set(CALLEE_PRI=${DB(AMPUSER/${ARG2}/recording/priority)}):Set(CALLEE_PRI=0))
641.
exten => exten,n,GotoIf($["${CALLER_PRI}"="${CALLEE_PRI}"]?${REC_POLICY}:${IF($[${CALLER_PRI}>${CALLEE_PRI}]?caller:callee)})
642.
exten => exten,n(callee),Gosub(recordcheck,1(${CALLEE},${CALLTYPE},${ARG2}))
643.
exten => exten,n,Return()
644.
exten => exten,n(caller),Set(RECMODE=${DB(AMPUSER/${FROMEXTEN}/recording/out/internal)})
645.
exten => exten,n,ExecIf($[!${LEN(${RECMODE})}]?Set(RECMODE=dontcare))
646.
exten => exten,n,ExecIf($["${RECMODE}"="dontcare"]?Set(RECMODE=${CALLEE}))
647.
exten => exten,n,Gosub(recordcheck,1(${RECMODE},${CALLTYPE},${ARG2}))
648.
exten => exten,n,Return()
649.

650.
exten => conf,1,Noop(Conference Recording Check ${FROMEXTEN} to ${ARG2})
651.
exten => conf,n,Gosub(recconf,1(${ARG2},${ARG2},${ARG3}))
652.
exten => conf,n,Return()
653.

654.
exten => page,1,Noop(Paging Recording Check ${FROMEXTEN} to ${ARG2})
655.
exten => page,n,GosubIf($["${REC_POLICY_MODE}"="always"]?recconf,1(${ARG2},${FROMEXTEN},${ARG3}))
656.
exten => page,n,Return()
657.

658.
exten => recconf,1,Noop(Setting up recording: ${ARG1}, ${ARG2}, ${ARG3})
659.
exten => recconf,n,Set(__CALLFILENAME=${IF($[${CONFBRIDGE_INFO(parties,${ARG2})}]?${DB(RECCONF/${ARG2})}:${ARG1}-${ARG2}-${ARG3}-${TIMESTR}-${UNIQUEID})})
660.
exten => recconf,n,ExecIf($[!${CONFBRIDGE_INFO(parties,${ARG2})}]?Set(DB(RECCONF/${ARG2})=${CALLFILENAME}))
661.
exten => recconf,n,Set(CONFBRIDGE(bridge,record_file)=${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MON_FMT})
662.
exten => recconf,n,ExecIf($["${ARG3}"!="always"]?Return())
663.
exten => recconf,n,Set(CONFBRIDGE(bridge,record_conference)=yes)
664.
exten => recconf,n,Set(__REC_STATUS=RECORDING)
665.
exten => recconf,n,Set(CDR(recordingfile)=${CALLFILENAME}.${MON_FMT})
666.
exten => recconf,n,Return()
667.

668.
exten => recq,1,Noop(Setting up recording: ${ARG1}, ${ARG2}, ${ARG3})
669.
exten => recq,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
670.
exten => recq,n,Set(MONITOR_FILENAME=${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME})
671.
exten => recq,n,MixMonitor(${MONITOR_FILENAME}.${MON_FMT},${MONITOR_OPTIONS},${MIXMON_POST})
672.
exten => recq,n,Set(__REC_STATUS=RECORDING)
673.
exten => recq,n,Set(CDR(recordingfile)=${CALLFILENAME}.${MON_FMT})
674.
exten => recq,n,Return()
675.

676.
exten => parking,1,Noop(User ${ARG2} picked up a parked call)
677.
exten => parking,n,Set(USER=${ARG2})
678.
exten => parking,n,ExecIf($[!${LEN(${ARG2})}]?Set(USER=unknown))
679.
exten => parking,n,Set(RECMODE=${DB(AMPUSER/${ARG2}/recording/out/internal)})
680.
exten => parking,n,ExecIf($[!${LEN(${RECMODE})}]?Set(RECMODE=dontcare))
681.
exten => parking,n,Gosub(recordcheck,1(${RECMODE},parked,${USER}))
682.
exten => parking,n,Return()
683.

684.
;--== end of [sub-record-check] ==--;
685.

686.

687.
[macro-one-touch-record]
688.
exten => s,1,Set(ONETOUCH_REC_SCRIPT_STATUS=)
689.
exten => s,n,System(/var/lib/asterisk/bin/one_touch_record.php "${CHANNEL(name)}")
690.
exten => s,n,Noop(ONETOUCH_REC_SCRIPT_STATUS: [${ONETOUCH_REC_SCRIPT_STATUS}])
691.
exten => s,n,ExecIf($["${REC_STATUS}"="RECORDING"]?Playback(beep))
692.
exten => s,n,ExecIf($["${REC_STATUS}"="STOPPED"]?Playback(beep&beep))
693.
exten => s,n,ExecIf($["${ONETOUCH_REC_SCRIPT_STATUS:0:6}"="DENIED"]?Playback(access-denied))
694.
exten => s,n,MacroExit()
695.

696.
;--== end of [macro-one-touch-record] ==--;
697.

698.

699.
[app-callwaiting-cwoff]
700.
exten => *71,1,Answer
701.
exten => *71,n,Wait(1)
702.
exten => *71,n,Macro(user-callerid,)
703.
exten => *71,n,Noop(Deleting: CW/${AMPUSER} ${DB_DELETE(CW/${AMPUSER})})
704.
exten => *71,n(hook_1),Playback(call-waiting&de-activated)
705.
exten => *71,n,Macro(hangupcall,)
706.

707.
;--== end of [app-callwaiting-cwoff] ==--;
708.

709.

710.
[app-callwaiting-cwon]
711.
exten => *70,1,Answer
712.
exten => *70,n,Wait(1)
713.
exten => *70,n,Macro(user-callerid,)
714.
exten => *70,n,Set(DB(CW/${AMPUSER})=ENABLED)
715.
exten => *70,n(hook_1),Playback(call-waiting&activated)
716.
exten => *70,n,Macro(hangupcall,)
717.

718.
;--== end of [app-callwaiting-cwon] ==--;
719.

720.

721.
[app-campon-toggle]
722.
exten => *84,1,Answer
723.
exten => *84,n,Set(CCSS_SETUP=TRUE)
724.
exten => *84,n,Macro(user-callerid,)
725.
exten => *84,n,ExecIf($["${EXTENSION_STATE(*84${AMPUSER}@ext-local)}" = "INUSE"]?CallCompletionCancel():CallCompletionRequest())
726.
exten => *84,n,Playback(beep)
727.
exten => *84,n,Macro(hangupcall,)
728.

729.
;--== end of [app-campon-toggle] ==--;
730.

731.

732.
[ext-local]
733.
exten => *84300,1,Goto(app-campon-toggle,*84,1)
734.
exten => *84300,hint,ccss:PJSIP/300
735.

736.
exten => *300,1,Macro(vm,300,DIRECTDIAL,${IVR_RETVM})
737.
exten => *300,n,Goto(vmret,1)
738.

739.
exten => 300,1,Set(__RINGTIMER=${IF($["${DB(AMPUSER/300/ringtimer)}" > "0"]?${DB(AMPUSER/300/ringtimer)}:${RINGTIMER_DEFAULT})})
740.
exten => 300,n,Macro(exten-vm,300,300,0,0,0)
741.
exten => 300,n(dest),Set(__PICKUPMARK=)
742.
exten => 300,n,Macro(vm,300,${DIALSTATUS},${IVR_RETVM})
743.
exten => 300,n,Goto(vmret,1)
744.
exten => 300,hint,PJSIP/300&Custom:DND300,CustomPresence:300
745.

746.
exten => vmb300,1,Macro(vm,300,BUSY,${IVR_RETVM})
747.
exten => vmb300,n,Goto(vmret,1)
748.

749.
exten => vmu300,1,Macro(vm,300,NOANSWER,${IVR_RETVM})
750.
exten => vmu300,n,Goto(vmret,1)
751.

752.
exten => vms300,1,Macro(vm,300,NOMESSAGE,${IVR_RETVM})
753.
exten => vms300,n,Goto(vmret,1)
754.

755.
exten => vmi300,1,Macro(vm,300,INSTRUCT,${IVR_RETVM})
756.
exten => vmi300,n,Goto(vmret,1)
757.

758.
exten => vmret,1,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
759.
exten => vmret,n,Hangup
760.
exten => vmret,n(playret),Playback(exited-vm-will-be-transfered&silence/1)
761.
exten => vmret,n,Goto(${IVR_CONTEXT},return,1)
762.

763.
exten => h,1,Macro(hangupcall,)
764.

765.
;--== end of [ext-local] ==--;
766.

767.

768.
[app-campon-cancel]
769.
exten => *83,1,Answer
770.
exten => *83,n,Set(CCSS_SETUP=TRUE)
771.
exten => *83,n,Macro(user-callerid,)
772.
exten => *83,n,CallCompletionCancel()
773.
exten => *83,n,Playback(beep)
774.
exten => *83,n,Macro(hangupcall,)
775.

776.
;--== end of [app-campon-cancel] ==--;
777.

778.

779.
[app-campon-request]
780.
exten => *82,1,Answer
781.
exten => *82,n,Set(CCSS_SETUP=TRUE)
782.
exten => *82,n,Macro(user-callerid,)
783.
exten => *82,n,CallCompletionRequest()
784.
exten => *82,n,Playback(beep)
785.
exten => *82,n,Macro(hangupcall,)
786.

787.
;--== end of [app-campon-request] ==--;
788.

789.

790.
[sub-ccss]
791.
exten => s,1,ExecIf($[${LEN(${CCSS_SETUP})}]?Return())
792.
exten => s,n,Set(CCSS_SETUP=TRUE)
793.
exten => s,n(monitor),GosubIf($[${LEN(${DB(AMPUSER/${ARG2}/ccss/cc_monitor_policy)})}]?monitor_config,1(${ARG1},${ARG2}):monitor_default,1(${ARG1},${ARG2}))
794.
exten => s,n(agent),GosubIf($[${LEN(${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)})}]?agent_config,1():agent_default,1())
795.
exten => s,n,Set(DB(AMPUSER/${AMPUSER}/ccss/last_number)=${ARG2})
796.
exten => s,n,Return(${GOSUB_RETVAL})
797.

798.
exten => monitor_config,1,Set(CALLCOMPLETION(cc_monitor_policy)=${DB(AMPUSER/${ARG2}/ccss/cc_monitor_policy)})
799.
exten => monitor_config,n,GotoIf($["CALLCOMPLETION(cc_monitor_policy)" != "never"]?set_monitor)
800.
exten => monitor_config,n,StackPop()
801.
exten => monitor_config,n,Return(FALSE)
802.
exten => monitor_config,n(set_monitor),Set(CALLCOMPLETION(cc_max_monitors)=${DB(AMPUSER/${ARG2}/ccss/max_monitors)})
803.
exten => monitor_config,n,Return(TRUE)
804.

805.
exten => monitor_default,1,GotoIf($["${DB(AMPUSER/${ARG2}/cidname)}" != ""]?is_exten)
806.
exten => monitor_default,n,StackPop()
807.
exten => monitor_default,n,Return(FALSE)
808.
exten => monitor_default,n(is_exten),Set(CALLCOMPLETION(cc_monitor_policy)=generic)
809.
exten => monitor_default,n,Set(CALLCOMPLETION(cc_max_monitors)=5)
810.
exten => monitor_default,n,Return(TRUE)
811.

812.
exten => agent_config,1,Set(CALLCOMPLETION(cc_agent_policy)=${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)})
813.
exten => agent_config,n,Set(CALLCOMPLETION(cc_offer_timer)=${DB(AMPUSER/${AMPUSER}/ccss/cc_offer_timer)})
814.
exten => agent_config,n,Set(CALLCOMPLETION(ccbs_available_timer)=${DB(AMPUSER/${AMPUSER}/ccss/ccbs_available_timer)})
815.
exten => agent_config,n,Set(CALLCOMPLETION(ccnr_available_timer)=${DB(AMPUSER/${AMPUSER}/ccss/ccnr_available_timer)})
816.
exten => agent_config,n,Set(CALLCOMPLETION(cc_callback_macro)=ccss-default)
817.
exten => agent_config,n,ExecIf($["${CALLCOMPLETION(cc_agent_policy)}" = "generic"]?Set(CALLCOMPLETION(cc_recall_timer)=${DB(AMPUSER/${AMPUSER}/ccss/cc_recall_timer)}))
818.
exten => agent_config,n,ExecIf($["${CALLCOMPLETION(cc_agent_policy)}" = "generic"]?Set(CALLCOMPLETION(cc_max_agents)=${DB(AMPUSER/${AMPUSER}/ccss/cc_max_agents)}))
819.
exten => agent_config,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_dialstring)}" != ""]?Set(CALLCOMPLETION(cc_agent_dialstring)=Local/${AMPUSER}_${CALLERID(dnid)}@from-ccss-${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_dialstring)}))
820.
exten => agent_config,n,Set(CALLCOMPLETION(cc_callback_macro)=ccss-default)
821.
exten => agent_config,n,Return()
822.

823.
exten => agent_default,1,Set(CALLCOMPLETION(cc_agent_policy)=generic)
824.
exten => agent_default,n,Set(CALLCOMPLETION(cc_offer_timer)=30)
825.
exten => agent_default,n,Set(CALLCOMPLETION(ccbs_available_timer)=4800)
826.
exten => agent_default,n,Set(CALLCOMPLETION(ccnr_available_timer)=7200)
827.
exten => agent_default,n,Set(CALLCOMPLETION(cc_callback_macro)=ccss-default)
828.
exten => agent_default,n,Set(CALLCOMPLETION(cc_recall_timer)=15)
829.
exten => agent_default,n,Set(CALLCOMPLETION(cc_agent_dialstring)=Local/${AMPUSER}_${CALLERID(dnid)}@from-ccss-extension)
830.
exten => agent_default,n,Return(TRUE)
831.

832.
;--== end of [sub-ccss] ==--;
833.

834.

835.
[macro-ccss-default]
836.
exten => s,1,Playback(beep&calling&extension)
837.
exten => s,n,SayDigits(${CC_EXTEN})
838.
exten => s,n(siprm),SIPRemoveHeader(${CC_HEADER})
839.
exten => s,n,Set(CALLERID(dnid)=${CC_EXTEN})
840.
exten => s,n,Set(CALLERID(name)=${CALLERID(name)})
841.
exten => s,n,MacroExit()
842.

843.
;--== end of [macro-ccss-default] ==--;
844.

845.

846.
[from-ccss-internal]
847.
exten => _X._X.,1,Gosub(sub-from-ccss,s,1(${CUT(EXTEN,_,2)}))
848.
exten => _X._X.,n(no_alert),Goto(from-internal,${CUT(EXTEN,_,1)},1)
849.

850.
;--== end of [from-ccss-internal] ==--;
851.

852.

853.
[from-ccss-extension]
854.
exten => _X._X.,1,Gosub(sub-from-ccss,s,1(${CUT(EXTEN,_,2)}))
855.
exten => _X._X.,n,Goto(ext-local,${CUT(EXTEN,_,1)},1)
856.

857.
;--== end of [from-ccss-extension] ==--;
858.

859.

860.
[sub-from-ccss]
861.
exten => s,1,Macro(blkvm-set,)
862.
exten => s,n,Set(__CC_RECALL=1)
863.
exten => s,n,Set(CALLERID(name)=${IF($[${LEN(${DB(AMPUSER/${ARG1}/cidname)})}]?${DB(AMPUSER/${ARG1}/cidname)}:CALLBACK)})
864.
exten => s,n,Set(CALLERID(number)=${ARG1})
865.
exten => s,n,Return()
866.
exten => s,n,SIPAddHeader(Alert-Info: ${CC_HEADER})
867.
exten => s,n,Return()
868.

869.
;--== end of [sub-from-ccss] ==--;
870.

871.

872.
[cidlookup]
873.
exten => cidlookup_2,1,Set(CURLOPT(httptimeout)=7)
874.
exten => cidlookup_2,n,Set(CALLERID(name)=${CURL(https://api.opencnam.com/v2/phone/${CALLERID(num)}?format=pbx&ref=freepbx)})
875.
exten => cidlookup_2,n,Set(current_hour=${STRFTIME(,,%Y-%m-%d %H)})
876.
exten => cidlookup_2,n,Set(last_query_hour=${DB(cidlookup/opencnam_last_query_hour)})
877.
exten => cidlookup_2,n,Set(total_hourly_queries=${DB(cidlookup/opencnam_total_hourly_queries)})
878.
exten => cidlookup_2,n,ExecIf($["${last_query_hour}" != "${current_hour}"]?Set(DB(cidlookup/opencnam_total_hourly_queries)=0))
879.
exten => cidlookup_2,n,ExecIf($["${total_hourly_queries}" = ""]?Set(DB(cidlookup/opencnam_total_hourly_queries)=0))
880.
exten => cidlookup_2,n,Set(DB(cidlookup/opencnam_total_hourly_queries)=${MATH(${DB(cidlookup/opencnam_total_hourly_queries)}+1,i)})
881.
exten => cidlookup_2,n,ExecIf($[${DB(cidlookup/opencnam_total_hourly_queries)} >= 60]?System(${ASTVARLIBDIR}/bin/opencnam-alert.php))
882.
exten => cidlookup_2,n,Set(DB(cidlookup/opencnam_last_query_hour)=${current_hour})
883.
exten => cidlookup_2,n,Return()
884.

885.
exten => cidlookup_return,1,ExecIf($["${DB(cidname/${CALLERID(num)})}" != ""]?Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})}))
886.
exten => cidlookup_return,n,Return()
887.

888.
;--== end of [cidlookup] ==--;
889.

890.

891.
[c-x-3-operator-panel-hold]
892.
exten => 432111,1,MusicOnHold(${XMLNamespaceMusicOnHoldClass})
893.
exten => 432111,n,Hangup
894.

895.
;--== end of [c-x-3-operator-panel-hold] ==--;
896.

897.

898.
[c-x-3-operator-panel-voice-mail]
899.
exten => 432112,1,VoiceMail(${XMLNamespaceVoiceMailBox}@${XMLNamespaceVoiceMailBoxContext},u)
900.
exten => 432112,n,Hangup
901.

902.
;--== end of [c-x-3-operator-panel-voice-mail] ==--;
903.

904.

905.
[c-x-3-operator-panel-meetme]
906.
exten => 432113,1,ConfBridge(${XMLNamespaceMeetMeRoomNumber},${XMLNamespaceMeetMeRoomOptions},,)
907.
exten => 432113,n,Hangup
908.

909.
;--== end of [c-x-3-operator-panel-meetme] ==--;
910.

911.

912.
[c-x-3-operator-panel-confbridge]
913.
exten => 432113,1,ConfBridge(${XMLNamespaceMeetMeRoomNumber},,,)
914.
exten => 432113,n,Hangup
915.

916.
;--== end of [c-x-3-operator-panel-confbridge] ==--;
917.

918.

919.
[c-x-3-operator-panel-park]
920.
exten => 432114,1,ParkAndAnnounce(pbx-transfer:PARKED,200,Local/432116@c-x-3-operator-panel-park-announce-answer,${XMLNamespaceParkContext},${XMLNamespaceParkExtension},1)
921.
exten => 432114,n,Hangup
922.

923.
;--== end of [c-x-3-operator-panel-park] ==--;
924.

925.

926.
[c-x-3-operator-panel-park-announce-answer]
927.
exten => 432116,1,Answer
928.
exten => 432116,n,Hangup
929.

930.
;--== end of [c-x-3-operator-panel-park-announce-answer] ==--;
931.

932.

933.
[c-x-3-operator-panel-listen-to-voice-mail]
934.
exten => 432115,1,ControlPlayback(${XMLNamespaceVoiceMailPath},1000,*,#,7,8,9)
935.
exten => 432115,n,Hangup
936.

937.
;--== end of [c-x-3-operator-panel-listen-to-voice-mail] ==--;
938.

939.

940.
[c-x-3-operator-panel-listen-to-recording]
941.
exten => 432118,1,ControlPlayback(${XMLNamespaceRecordingPath},1000,*,#,7,8,9)
942.
exten => 432118,n,Hangup
943.

944.
;--== end of [c-x-3-operator-panel-listen-to-recording] ==--;
945.

946.

947.
[c-x-3-operator-panel-spy]
948.
exten => 432117,1,ChanSpy(${XMLNamespaceChanSpyChannel},${XMLNamespaceChanSpyOptions})
949.
exten => 432117,n,Hangup
950.

951.
;--== end of [c-x-3-operator-panel-spy] ==--;
952.

953.

954.
[c-x-3-operator-panel-pjsip-auto-answer-headers]
955.
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=<http://www.notused.com>\;info=alert-autoanswer\;delay=0)
956.
exten => addheader,n,Set(PJSIP_HEADER(add,Alert-Info)=Ring Answer)
957.
exten => addheader,n,Set(PJSIP_HEADER(add,Alert-Info)=ring-answer)
958.
exten => addheader,n,Set(PJSIP_HEADER(add,Call-Info)=\;answer-after=0)
959.

960.
;--== end of [c-x-3-operator-panel-pjsip-auto-answer-headers] ==--;
961.

962.

963.
[c-x-3-operator-panel-pjsip-auto-answer-redirect]
964.
exten => _X!,1,ExecIf($["${D_OPTIONS}"==""]?Set(D_OPTIONS=TtrI))
965.
exten => _X!,n,Dial(${CX_AUTOANSWER_REDIRECT_PEER},,${D_OPTIONS}b(c-x-3-operator-panel-pjsip-auto-answer-headers^addheader^1))
966.

967.
;--== end of [c-x-3-operator-panel-pjsip-auto-answer-redirect] ==--;
968.

969.

970.
[app-dictate-send]
971.
exten => *35,1,Answer
972.
exten => *35,n,Macro(user-callerid,)
973.
exten => *35,n,Noop(CallerID is ${AMPUSER})
974.
exten => *35,n,Set(DICTENABLED=${DB(AMPUSER/${AMPUSER}/dictate/enabled)})
975.
exten => *35,n,GotoIf($[$["x${DICTENABLED}"="x"]|$["x${DICTENABLED}"="xdisabled"]]?nodict:dictok)
976.
exten => *35,n(nodict),Playback(feature-not-avail-line)
977.
exten => *35,n,Hangup
978.
exten => *35,n(dictok),Read(DICTFILE,enter-filename-short,,,,)
979.
exten => *35,n,Set(DICTEMAIL=${DB(AMPUSER/${AMPUSER}/dictate/email)})
980.
exten => *35,n,Set(DICTFMT=${DB(AMPUSER/${AMPUSER}/dictate/format)})
981.
exten => *35,n,Set(NAME=${DB(AMPUSER/${AMPUSER}/cidname)})
982.
exten => *35,n,Playback(dictation-being-processed)
983.
exten => *35,n,System(/var/lib/asterisk/bin/audio-email.pl --file /var/lib/asterisk/sounds/dictate/${AMPUSER}/${DICTFILE}.raw --attachment dict-${DICTFILE} --format ${DICTFMT} --to ${DICTEMAIL} --subject "Dictation from ${NAME} Attached")
984.
exten => *35,n,Playback(dictation-sent)
985.
exten => *35,n,Macro(hangupcall,)
986.

987.
;--== end of [app-dictate-send] ==--;
988.

989.

990.
[app-dictate-record]
991.
exten => *34,1,Answer
992.
exten => *34,n,Macro(user-callerid,)
993.
exten => *34,n,Noop(CallerID is ${AMPUSER})
994.
exten => *34,n,Set(DICTENABLED=${DB(AMPUSER/${AMPUSER}/dictate/enabled)})
995.
exten => *34,n,GotoIf($[$["x${DICTENABLED}"="x"]|$["x${DICTENABLED}"="xdisabled"]]?nodict:dictok)
996.
exten => *34,n(nodict),Playback(feature-not-avail-line)
997.
exten => *34,n,Hangup
998.
exten => *34,n(dictok),Dictate(/var/lib/asterisk/sounds/dictate/${AMPUSER})
999.
exten => *34,n,Macro(hangupcall,)
1000.

1001.
;--== end of [app-dictate-record] ==--;
1002.

1003.

1004.
[app-dnd-off]
1005.
exten => *79,1,Answer
1006.
exten => *79,n,Wait(1)
1007.
exten => *79,n,Macro(user-callerid,)
1008.
exten => *79,n,Noop(Deleting: DND/${AMPUSER} ${DB_DELETE(DND/${AMPUSER})})
1009.
exten => *79,n,Set(STATE=NOT_INUSE)
1010.
exten => *79,n,Gosub(app-dnd-off,sstate,1())
1011.
exten => *79,n(hook_1),Playback(do-not-disturb&de-activated)
1012.
exten => *79,n,Macro(hangupcall,)
1013.

1014.
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
1015.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
1016.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
1017.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
1018.
exten => sstate,n,Set(ITER=1)
1019.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
1020.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
1021.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
1022.
exten => sstate,n(return),Return()
1023.

1024.
;--== end of [app-dnd-off] ==--;
1025.

1026.

1027.
[app-dnd-on]
1028.
exten => *78,1,Answer
1029.
exten => *78,n,Wait(1)
1030.
exten => *78,n,Macro(user-callerid,)
1031.
exten => *78,n,Set(DB(DND/${AMPUSER})=YES)
1032.
exten => *78,n,Set(STATE=BUSY)
1033.
exten => *78,n,Gosub(app-dnd-on,sstate,1())
1034.
exten => *78,n(hook_1),Playback(do-not-disturb&activated)
1035.
exten => *78,n,Macro(hangupcall,)
1036.

1037.
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
1038.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
1039.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
1040.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
1041.
exten => sstate,n,Set(ITER=1)
1042.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
1043.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
1044.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
1045.
exten => sstate,n(return),Return()
1046.

1047.
;--== end of [app-dnd-on] ==--;
1048.

1049.

1050.
[app-dnd-toggle]
1051.
exten => *76,1,Answer
1052.
exten => *76,n,Wait(1)
1053.
exten => *76,n,Macro(user-callerid,)
1054.
exten => *76,n,GotoIf($["${DB(DND/${AMPUSER})}" = ""]?activate:deactivate)
1055.
exten => *76,n(activate),Set(DB(DND/${AMPUSER})=YES)
1056.
exten => *76,n,Set(STATE=BUSY)
1057.
exten => *76,n,Gosub(app-dnd-toggle,sstate,1())
1058.
exten => *76,n(hook_on),Playback(do-not-disturb&activated)
1059.
exten => *76,n,Macro(hangupcall,)
1060.
exten => *76,n(deactivate),Noop(Deleting: DND/${AMPUSER} ${DB_DELETE(DND/${AMPUSER})})
1061.
exten => *76,n,Set(STATE=NOT_INUSE)
1062.
exten => *76,n,Gosub(app-dnd-toggle,sstate,1())
1063.
exten => *76,n(hook_off),Playback(do-not-disturb&de-activated)
1064.
exten => *76,n,Macro(hangupcall,)
1065.

1066.
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
1067.
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
1068.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
1069.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
1070.
exten => sstate,n,Set(ITER=1)
1071.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
1072.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
1073.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
1074.
exten => sstate,n(return),Return()
1075.

1076.
;--== end of [app-dnd-toggle] ==--;
1077.

1078.

1079.
[ext-dnd-hints]
1080.
exten => *76300,1,Goto(app-dnd-toggle,*76,1)
1081.
exten => *76300,hint,Custom:DEVDND300
1082.

1083.
;--== end of [ext-dnd-hints] ==--;
1084.

1085.

1086.
[ext-fax]
1087.
exten => s,1,Macro(user-callerid,)
1088.
exten => s,n,Noop(Receiving Fax for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})
1089.
exten => s,n(receivefax),StopPlaytones
1090.
exten => s,n,ReceiveFAX(${ASTSPOOLDIR}/fax/${UNIQUEID}.tif,f)
1091.
exten => s,n,ExecIf($["${FAXSTATUS:0:6}"="FAILED" && "${FAXERROR}"!="INIT_ERROR"]?Set(FAXSTATUS="FAILED: error: ${FAXERROR} statusstr: ${FAXOPT(statusstr)}"))
1092.
exten => s,n,Hangup
1093.

1094.
exten => h,1,GotoIf($[${STAT(e,${ASTSPOOLDIR}/fax/${UNIQUEID}.tif)} = 0]?failed)
1095.
exten => h,n(process),GotoIf($[${LEN(${FAX_RX_EMAIL})} = 0]?noemail)
1096.
exten => h,n(delete_opt),Set(DELETE_AFTER_SEND=true)
1097.
exten => h,n,System(${ASTVARLIBDIR}/bin/fax2mail.php --to "${FAX_RX_EMAIL}" --dest "${FROM_DID}" --callerid '${STRREPLACE(CALLERID(all),',\\')}' --file ${ASTSPOOLDIR}/fax/${UNIQUEID}.tif --exten "${FAX_FOR}" --delete "${DELETE_AFTER_SEND}" --attachformat "${FAX_ATTACH_FORMAT}")
1098.
exten => h,n(end),Macro(hangupcall,)
1099.
exten => h,n(noemail),Noop(ERROR: No Email Address to send FAX: status: [${FAXSTATUS}],  From: [${CALLERID(all)}])
1100.
exten => h,n,Macro(hangupcall,)
1101.
exten => h,process+101(failed),Noop(FAX ${FAXSTATUS} for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})
1102.
exten => h,n,Macro(hangupcall,)
1103.

1104.
;--== end of [ext-fax] ==--;
1105.

1106.

1107.
[app-fax]
1108.
exten => 666,1,Set(FAX_RX_EMAIL=)
1109.
exten => 666,n,Goto(ext-fax,s,1)
1110.

1111.
exten => h,1,Macro(hangupcall,)
1112.

1113.
;--== end of [app-fax] ==--;
1114.

1115.

1116.
[ext-did-0001]
1117.
exten => fax,1,Goto(${CUT(FAX_DEST,^,1)},${CUT(FAX_DEST,^,2)},${CUT(FAX_DEST,^,3)})
1118.

1119.
;--== end of [ext-did-0001] ==--;
1120.

1121.

1122.
[ext-did-0002]
1123.
exten => fax,1,Goto(${CUT(FAX_DEST,^,1)},${CUT(FAX_DEST,^,2)},${CUT(FAX_DEST,^,3)})
1124.

1125.
exten => 04074041501,1,Set(__DIRECTION=INBOUND)
1126.
exten => 04074041501,n,Gosub(sub-record-check,s,1(in,${EXTEN},dontcare))
1127.
exten => 04074041501,n,Gosub(app-blacklist-check,s,1())
1128.
exten => 04074041501,n,Set(__FROM_DID=${EXTEN})
1129.
exten => 04074041501,n,Set(CDR(did)=${FROM_DID})
1130.
exten => 04074041501,n,ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
1131.
exten => 04074041501,n,Set(CHANNEL(musicclass)=default)
1132.
exten => 04074041501,n,Set(__MOHCLASS=default)
1133.
exten => 04074041501,n,GotoIf($["${__REVERSAL_REJECT}"="TRUE" & "${CHANNEL(reversecharge)}"="1" ]?macro-hangupcall)
1134.
exten => 04074041501,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
1135.
exten => 04074041501,n,Set(CALLERPRES()=allowed_not_screened)
1136.
exten => 04074041501,n(dest-ext),Goto(from-did-direct,300,1)
1137.

1138.
;--== end of [ext-did-0002] ==--;
1139.

1140.

1141.
[ext-featurecodes]
1142.
exten => *30,1,Goto(from-internal,*30,1)
1143.

1144.
exten => *31,1,Goto(from-internal,*31,1)
1145.

1146.
exten => 555,1,Goto(from-internal,555,1)
1147.

1148.
exten => 7777,1,Goto(from-internal,7777,1)
1149.

1150.
exten => 888,1,Goto(from-internal,888,1)
1151.

1152.
exten => 666,1,Goto(from-internal,666,1)
1153.

1154.
exten => *43,1,Goto(from-internal,*43,1)
1155.

1156.
exten => *60,1,Goto(from-internal,*60,1)
1157.

1158.
exten => *85,1,Goto(from-internal,*85,1)
1159.

1160.
exten => *86,1,Goto(from-internal,*86,1)
1161.

1162.
exten => 411,1,Goto(from-internal,411,1)
1163.

1164.
exten => *98,1,Goto(from-internal,*98,1)
1165.

1166.
;--== end of [ext-featurecodes] ==--;
1167.

1168.

1169.
[app-fmf-toggle]
1170.
exten => *21,1,Goto(app-fmf-toggle,s,start)
1171.

1172.
exten => s,1(start),Answer
1173.
exten => s,n,Wait(1)
1174.
exten => s,n,Macro(user-callerid,)
1175.
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = "EXTENSION"]?activate)
1176.
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = "DIRECT"]?deactivate:end)
1177.
exten => s,n(deactivate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=EXTENSION)
1178.
exten => s,n,Set(STATE=NOT_INUSE)
1179.
exten => s,n,Gosub(app-fmf-toggle,sstate,1())
1180.
exten => s,n(hook_off),Playback(followme&de-activated)
1181.
exten => s,n(end),Macro(hangupcall,)
1182.
exten => s,n(activate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=DIRECT)
1183.
exten => s,n,Set(STATE=INUSE)
1184.
exten => s,n,Gosub(app-fmf-toggle,sstate,1())
1185.
exten => s,n(hook_on),Playback(followme&activated)
1186.
exten => s,n,Macro(hangupcall,)
1187.

1188.
exten => sstate,1,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
1189.
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
1190.
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
1191.
exten => sstate,n,Set(ITER=1)
1192.
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:FOLLOWME${CUT(DEVICES,&,${ITER})})=${STATE})
1193.
exten => sstate,n,Set(ITER=$[${ITER} + 1])
1194.
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
1195.
exten => sstate,n(return),Return()
1196.

1197.
;--== end of [app-fmf-toggle] ==--;
1198.

1199.

1200.
[ext-findmefollow]
1201.
exten => FM300,1,Goto(300,FM300)
1202.

1203.
exten => 300,1,GotoIf($[ "${DB(AMPUSER/300/followme/ddial)}" = "EXTENSION" ]?ext-local,300,1)
1204.
exten => 300,n(FM300),Macro(user-callerid,)
1205.
exten => 300,n,Set(DIAL_OPTIONS=${DIAL_OPTIONS}I)
1206.
exten => 300,n,Set(CONNECTEDLINE(num,i)=300)
1207.
exten => 300,n,Gosub(sub-presencestate-display,s,1(300))
1208.
exten => 300,n,Set(CONNECTEDLINE(name)=${DB(AMPUSER/300/cidname)}${PRESENCESTATE_DISPLAY})
1209.
exten => 300,n,Set(FM_DIALSTATUS=${EXTENSION_STATE(300@ext-local)})
1210.
exten => 300,n,Set(__EXTTOCALL=${EXTEN})
1211.
exten => 300,n,Set(__PICKUPMARK=${EXTEN})
1212.
exten => 300,n,Macro(blkvm-setifempty,)
1213.
exten => 300,n,GotoIf($["${GOSUB_RETVAL}" = "TRUE"]?skipov)
1214.
exten => 300,n,Macro(blkvm-set,reset)
1215.
exten => 300,n,Set(__NODEST=)
1216.
exten => 300,n(skipov),Set(RRNODEST=${NODEST})
1217.
exten => 300,n(skipvmblk),Set(__NODEST=${EXTEN})
1218.
exten => 300,n,GosubIf($[${DB_EXISTS(AMPUSER/300/followme/changecid)} = 1 & "${DB(AMPUSER/300/followme/changecid)}" != "default" & "${DB(AMPUSER/300/followme/changecid)}" != ""]?sub-fmsetcid,s,1())
1219.
exten => 300,n,Set(RecordMethod=Group)
1220.
exten => 300,n(checkrecord),Gosub(sub-record-check,s,1(exten,300,))
1221.
exten => 300,n(skipsimple),Set(RingGroupMethod=ringallv2-prim)
1222.
exten => 300,n,Set(_FMGRP=300)
1223.
exten => 300,n(DIALGRP),GotoIf($[("${DB(AMPUSER/300/followme/grpconf)}"="ENABLED") | ("${FORCE_CONFIRM}"!="") ]?doconfirm)
1224.
exten => 300,n,Macro(dial,$[ ${DB(AMPUSER/300/followme/grptime)} + ${DB(AMPUSER/300/followme/prering)} ],${DIAL_OPTIONS},${DB(AMPUSER/300/followme/grplist)})
1225.
exten => 300,n,Goto(nextstep)
1226.
exten => 300,n(doconfirm),Macro(dial-confirm,$[ ${DB(AMPUSER/300/followme/grptime)} + ${DB(AMPUSER/300/followme/prering)} ],${DIAL_OPTIONS},${DB(AMPUSER/300/followme/grplist)},300)
1227.
exten => 300,n(nextstep),Set(RingGroupMethod=)
1228.
exten => 300,n,GotoIf($["foo${RRNODEST}" != "foo"]?nodest)
1229.
exten => 300,n,Set(__NODEST=)
1230.
exten => 300,n,Set(__PICKUPMARK=)
1231.
exten => 300,n,Macro(blkvm-clr,)
1232.
exten => 300,n,Set(DIALSTATUS=${IF($["${FM_DIALSTATUS}"="NOT_INUSE"&"${DIALSTATUS}"!="CHANUNAVAIL"]?NOANSWER:${IF($["${DIALSTATUS}"="CHANUNAVAIL"|"${FM_DIALSTATUS}"="UNAVAILABLE"|"${FM_DIALSTATUS}"="UNKNOWN"|"${FM_DIALSTATUS}"="INVALID"]?CHANUNAVAIL:BUSY)})})
1233.
exten => 300,n,Goto(ext-local,300,dest)
1234.
exten => 300,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})
1235.

1236.
;--== end of [ext-findmefollow] ==--;
1237.

1238.

1239.
[fmgrps]
1240.
exten => _RG-300.,1,NoCDR()
1241.
exten => _RG-300.,n,Macro(dial,${DB(AMPUSER/300/followme/grptime)},${DIAL_OPTIONS}M(confirm^^^300),${EXTEN:7})
1242.

1243.
;--== end of [fmgrps] ==--;
1244.

1245.

1246.
[sub-fmsetcid]
1247.
exten => s,1,Goto(s-${DB(AMPUSER/${EXTTOCALL}/followme/changecid)},1)
1248.

1249.
exten => s-fixed,1,ExecIf($["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${EXTTOCALL}/followme/fixedcid)})}" = "1"]?Set(__TRUNKCIDOVERRIDE=${DB(AMPUSER/${EXTTOCALL}/followme/fixedcid)}))
1250.
exten => s-fixed,n,Return()
1251.

1252.
exten => s-extern,1,ExecIf($["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${EXTTOCALL}/followme/fixedcid)})}" == "1" & "${FROM_DID}" != ""]?Set(__TRUNKCIDOVERRIDE=${DB(AMPUSER/${EXTTOCALL}/followme/fixedcid)}))
1253.
exten => s-extern,n,Return()
1254.

1255.
exten => s-did,1,ExecIf($["${REGEX("^[\+]?[0-9]+$" ${FROM_DID})}" = "1"]?Set(__REALCALLERIDNUM=${FROM_DID}))
1256.
exten => s-did,n,Return()
1257.

1258.
exten => s-forcedid,1,ExecIf($["${REGEX("^[\+]?[0-9]+$" ${FROM_DID})}" = "1"]?Set(__TRUNKCIDOVERRIDE=${FROM_DID}))
1259.
exten => s-forcedid,n,Return()
1260.

1261.
exten => _s-.,1,Noop(Unknown value for AMPUSER/${EXTTOCALL}/followme/changecid of ${DB(AMPUSER/${EXTTOCALL}/followme/changecid)} set to "default")
1262.
exten => _s-.,n,Set(DB(AMPUSER/${EXTTOCALL}/followme/changecid)=default)
1263.
exten => _s-.,n,Return()
1264.

1265.
;--== end of [sub-fmsetcid] ==--;
1266.

1267.

1268.
[app-hotelwakeup]
1269.
exten => *68,1,Macro(user-callerid,)
1270.
exten => *68,n,Answer
1271.
exten => *68,n,Wait(1)
1272.
exten => *68,n,AGI(wakeupphp)
1273.
exten => *68,n,Hangup
1274.

1275.
;--== end of [app-hotelwakeup] ==--;
1276.

1277.

1278.
[app-calltrace]
1279.
exten => *69,1,Goto(app-calltrace-perform,s,1)
1280.

1281.
;--== end of [app-calltrace] ==--;
1282.

1283.

1284.
[app-calltrace-perform]
1285.
exten => s,1,Answer
1286.
exten => s,n,Wait(1)
1287.
exten => s,n,Macro(user-callerid,)
1288.
exten => s,n,Playback(info-about-last-call&telephone-number)
1289.
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${AMPUSER})})
1290.
exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo)
1291.
exten => s,n,SayDigits(${lastcaller})
1292.
exten => s,n,Set(TIMEOUT(digit)=3)
1293.
exten => s,n,Set(TIMEOUT(response)=7)
1294.
exten => s,n,Background(to-call-this-number&press-1)
1295.
exten => s,n,Goto(fin)
1296.
exten => s,n(noinfo),Playback(from-unknown-caller)
1297.
exten => s,n,Macro(hangupcall,)
1298.
exten => s,n(fin),Noop(Waiting for input)
1299.
exten => s,n,WaitExten(60,)
1300.
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
1301.

1302.
exten => 1,1,Goto(from-internal,${lastcaller},1)
1303.

1304.
exten => i,1,Playback(vm-goodbye)
1305.
exten => i,n,Macro(hangupcall,)
1306.

1307.
exten => t,1,Playback(vm-goodbye)
1308.
exten => t,n,Macro(hangupcall,)
1309.

1310.
;--== end of [app-calltrace-perform] ==--;
1311.

1312.

1313.
[app-speakextennum]
1314.
exten => *65,1,Answer
1315.
exten => *65,n,Wait(1)
1316.
exten => *65,n,Macro(user-callerid,)
1317.
exten => *65,n,GotoIf($[${DIALPLAN_EXISTS(app-speakextennum,${CHANNEL(language)},1)}]?app-speakextennum,${CHANNEL(language)},1:app-speakextennum,en,1)
1318.

1319.
exten => en,1,Playback(your)
1320.
exten => en,n,Playback(extension)
1321.
exten => en,n,Playback(number)
1322.
exten => en,n,Playback(is)
1323.
exten => en,n,SayDigits(${AMPUSER})
1324.
exten => en,n,Wait(2)
1325.
exten => en,n,Hangup
1326.

1327.
exten => ja,1,Playback(your)
1328.
exten => ja,n,Playback(extension)
1329.
exten => ja,n,Playback(jp-wa)
1330.
exten => ja,n,SayDigits(${AMPUSER})
1331.
exten => ja,n,Wait(2)
1332.
exten => ja,n,Hangup
1333.

1334.
;--== end of [app-speakextennum] ==--;
1335.

1336.

1337.
[sub-hr12format]
1338.
exten => s,1,GotoIf($[${DIALPLAN_EXISTS(sub-hr12format,${CHANNEL(language)},1)}]?sub-hr12format,${CHANNEL(language)},1:sub-hr12format,en,1)
1339.
exten => s,n,GotoIf($[${DIALPLAN_EXISTS(sub-hr12format,${CHANNEL(language)},1)}]?${CHANNEL(language)},1:en,1)
1340.

1341.
exten => en,1,Playback(at-tone-time-exactly)
1342.
exten => en,n,SayUnixTime(${FutureTime},,IM 'and' S 'seconds' p)
1343.
exten => en,n,Return()
1344.
exten => en,n,Playback(at-tone-time-exactly)
1345.
exten => en,n,SayUnixTime(${FutureTime},,IM 'and' S 'seconds' p)
1346.
exten => en,n,Return()
1347.

1348.
exten => de,1,Playback(at-tone-time-exactly)
1349.
exten => de,n,SayUnixTime(${FutureTime},,IMSp)
1350.
exten => de,n,Return()
1351.
exten => de,n,Playback(at-tone-time-exactly)
1352.
exten => de,n,SayUnixTime(${FutureTime},,IMSp)
1353.
exten => de,n,Return()
1354.

1355.
exten => ja,1,Playback(at-tone-time-exactly)
1356.
exten => ja,n,SayUnixTime(${FutureTime},,pIMS)
1357.
exten => ja,n,Return()
1358.
exten => ja,n,Playback(at-tone-time-exactly)
1359.
exten => ja,n,SayUnixTime(${FutureTime},,pIMS)
1360.
exten => ja,n,Return()
1361.

1362.
;--== end of [sub-hr12format] ==--;
1363.

1364.

1365.
[app-speakingclock]
1366.
exten => *60,1,Macro(user-callerid,)
1367.
exten => *60,n,Answer
1368.
exten => *60,n,Wait(1)
1369.
exten => *60,n,Set(NumLoops=0)
1370.
exten => *60,n(start),Set(FutureTime=$[${EPOCH} + 11])
1371.
exten => *60,n,Gosub(sub-hr12format,s,1())
1372.
exten => *60,n(waitloop),Set(TimeLeft=$[${FutureTime} - ${EPOCH}])
1373.
exten => *60,n,GotoIf($[${TimeLeft} < 1]?playbeep)
1374.
exten => *60,n,Wait(1)
1375.
exten => *60,n,Goto(waitloop)
1376.
exten => *60,n(playbeep),Playback(beep)
1377.
exten => *60,n,Wait(5)
1378.
exten => *60,n,Set(NumLoops=$[${NumLoops} + 1])
1379.
exten => *60,n,GotoIf($[${NumLoops} < 5]?start)
1380.
exten => *60,n,Playback(goodbye)
1381.
exten => *60,n,Hangup
1382.

1383.
;--== end of [app-speakingclock] ==--;
1384.

1385.

1386.
[sub-hr24format]
1387.
exten => s,1,GotoIf($[${DIALPLAN_EXISTS(sub-hr24format,${CHANNEL(language)},1)}]?${CHANNEL(language)},1:en,1)
1388.

1389.
exten => en,1,Playback(at-tone-time-exactly)
1390.
exten => en,n,SayUnixTime(${FutureTime},,kM 'and' S 'seconds')
1391.
exten => en,n,Return()
1392.

1393.
exten => de,1,Playback(at-tone-time-exactly)
1394.
exten => de,n,SayUnixTime(${FutureTime},,kMS)
1395.
exten => de,n,Return()
1396.

1397.
exten => ja,1,Playback(at-tone-time-exactly)
1398.
exten => ja,n,SayUnixTime(${FutureTime},,kMS)
1399.
exten => ja,n,Return()
1400.

1401.
;--== end of [sub-hr24format] ==--;
1402.

1403.

1404.
[app-echo-test]
1405.
exten => *43,1,Answer
1406.
exten => *43,n,Macro(user-callerid,)
1407.
exten => *43,n,Wait(1)
1408.
exten => *43,n,Background(demo-echotest,,,app-echo-test-echo)
1409.
exten => *43,n,Goto(app-echo-test-echo,1,1)
1410.

1411.
;--== end of [app-echo-test] ==--;
1412.

1413.

1414.
[app-echo-test-echo]
1415.
exten => _[0-9#*],1,Echo()
1416.
exten => _[0-9#*],n,Playback(demo-echodone)
1417.
exten => _[0-9#*],n,Hangup
1418.

1419.
;--== end of [app-echo-test-echo] ==--;
1420.

1421.

1422.
[macro-outisbusy]
1423.
exten => s,1,Progress
1424.
exten => s,n,GotoIf($["${EMERGENCYROUTE}" = "YES"]?emergency,1)
1425.
exten => s,n,GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?intracompany,1)
1426.
exten => s,n,Playback(all-circuits-busy-now&pls-try-call-later, noanswer)
1427.
exten => s,n,Congestion(20)
1428.
exten => s,n,Hangup
1429.

1430.
exten => intracompany,1,Playback(all-circuits-busy-now&pls-try-call-later, noanswer)
1431.
exten => intracompany,n,Congestion(20)
1432.
exten => intracompany,n,Hangup
1433.

1434.
exten => emergency,1,Playback(all-circuits-busy-now&pls-try-call-later)
1435.
exten => emergency,n,Congestion(20)
1436.
exten => emergency,n,Hangup
1437.

1438.
;--== end of [macro-outisbusy] ==--;
1439.

1440.

1441.
[ext-intercom]
1442.
exten => _*80.,1,Macro(user-callerid,)
1443.
exten => _*80.,n,Set(dialnumber=${EXTEN:3})
1444.
exten => _*80.,n,Set(INTERCOM_CALL=TRUE)
1445.
exten => _*80.,n,Gosub(sub-record-check,s,1(exten,${dialnumber}))
1446.
exten => _*80.,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/intercom/block)}" = "blocked"]?end)
1447.
exten => _*80.,n,GotoIf($["${DB(DND/${dialnumber})}" = "YES"]?end)
1448.
exten => _*80.,n,GotoIf($["${DB(AMPUSER/${dialnumber}/intercom/${AMPUSER})}" = "allow" ]?allow)
1449.
exten => _*80.,n,GotoIf($["${DB(AMPUSER/${dialnumber}/intercom/${AMPUSER})}" = "deny" ]?nointercom)
1450.
exten => _*80.,n,GotoIf($["${DB(AMPUSER/${dialnumber}/intercom)}" = "disabled" ]?nointercom)
1451.
exten => _*80.,n(allow),Set(DEVICES=${DB(AMPUSER/${dialnumber}/device)})
1452.
exten => _*80.,n,GotoIf($["${DEVICES}" = "" ]?end)
1453.
exten => _*80.,n,Set(OVERRIDE=${DB(AMPUSER/${dialnumber}/intercom/override)})
1454.
exten => _*80.,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
1455.
exten => _*80.,n,Set(_SIPURI=)
1456.
exten => _*80.,n,Set(_ALERTINFO=Ring Answer)
1457.
exten => _*80.,n,Set(_CALLINFO=<uri>\;answer-after=0)
1458.
exten => _*80.,n,Set(_SIPURI=intercom=true)
1459.
exten => _*80.,n,Set(_DTIME=5)
1460.
exten => _*80.,n,Set(_ANSWERMACRO=)
1461.
exten => _*80.,n,GotoIf($[${LOOPCNT} > 1 ]?pagemode)
1462.
exten => _*80.,n,Macro(autoanswer,${DEVICES})
1463.
exten => _*80.,n,Set(_DOPTIONS=A(beep)b(autoanswer^s^1(${ALERTINFO},${CALLINFO})))
1464.
exten => _*80.,n(check),ChanIsAvail(${DEVICE},s)
1465.
exten => _*80.,n,ExecIf($["${AVAILSTATUS}" = "6"]?Set(AVAILORIGCHAN=${DEVICE}))
1466.
exten => _*80.,n,GotoIf($["${AVAILORIGCHAN}" != ""]?continue)
1467.
exten => _*80.,n,ExecIf($["${OVERRIDE}" = ""]?Set(OVERRIDE=reject))
1468.
exten => _*80.,n,GotoIf($["${OVERRIDE}" = "reject"]?end)
1469.
exten => _*80.,n,Set(DTIME=30)
1470.
exten => _*80.,n,ExecIf($["${OVERRIDE}" = "ring"]?Set(DOPTIONS=A(beep)))
1471.
exten => _*80.,n(continue),Noop(Continuing with page)
1472.
exten => _*80.,n,GotoIf($["${DB(AMPUSER/${EXTEN:3}/cidname)}" = ""]?godial)
1473.
exten => _*80.,n,Set(CONNECTEDLINE(name,i)=${DB(AMPUSER/${EXTEN:3}/cidname)})
1474.
exten => _*80.,n,Set(CONNECTEDLINE(num)=${EXTEN:3})
1475.
exten => _*80.,n(godial),Dial(${DIAL},${DTIME},I${DOPTIONS}${INTERCOM_EXT_DOPTIONS})
1476.
exten => _*80.,n(end),ExecIf($[${INTERCOM_RETURN}]?Return())
1477.
exten => _*80.,n,Busy(20)
1478.
exten => _*80.,n,Macro(hangupcall,)
1479.
exten => _*80.,n(pagemode),Set(ITER=1)
1480.
exten => _*80.,n,Set(DIALSTR=)
1481.
exten => _*80.,n(begin),ChanIsAvail(${DB(DEVICE/${CUT(DEVICES,&,${ITER})}/dial)},s)
1482.
exten => _*80.,n,GotoIf($["${AVAILORIGCHAN}" = ""]?skip)
1483.
exten => _*80.,n,Set(DIALSTR=${DIALSTR}-${CUT(DEVICES,&,${ITER})})
1484.
exten => _*80.,n(skip),Set(ITER=$[${ITER} + 1])
1485.
exten => _*80.,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
1486.
exten => _*80.,n,Set(DIALSTR=${DIALSTR:1})
1487.
exten => _*80.,n,GotoIf($["${DIALSTR}" = ""]?end2)
1488.
exten => _*80.,n,Set(_AMPUSER=${AMPUSER})
1489.
exten => _*80.,n,Gosub(page,1(${DIALSTR}))
1490.
exten => _*80.,n(end2),ExecIf($[${INTERCOM_RETURN}]?Return())
1491.
exten => _*80.,n,Busy(20)
1492.
exten => _*80.,n,Macro(hangupcall,)
1493.
exten => _*80.,n(nointercom),Noop(Intercom disallowed by ${dialnumber})
1494.
exten => _*80.,n,ExecIf($[${INTERCOM_RETURN}]?Return())
1495.
exten => _*80.,n,Playback(intercom&for&extension)
1496.
exten => _*80.,n,SayDigits(${dialnumber})
1497.
exten => _*80.,n,Playback(is&disabled)
1498.
exten => _*80.,n,Congestion(20)
1499.

1500.
exten => page,1,Set(PAGE_CONF=${EPOCH}${RAND(100,999)})
1501.
exten => page,n,Set(PAGEMODE=PAGE)
1502.
exten => page,n,Set(PAGE_MEMBERS=${ARG1})
1503.
exten => page,n,Set(PAGE_CONF_OPTS=duplex)
1504.
exten => page,n,AGI(page.agi)
1505.
exten => page,n,Set(CONFBRIDGE(user,template)=page_user_duplex)
1506.
exten => page,n,Set(CONFBRIDGE(user,admin)=yes)
1507.
exten => page,n,Set(CONFBRIDGE(user,marked)=yes)
1508.
exten => page,n,ConfBridge(${PAGE_CONF},,,admin_menu)
1509.
exten => page,n,Hangup
1510.

1511.
;--== end of [ext-intercom] ==--;
1512.

1513.

1514.
[ext-intercom-users]
1515.
exten => *80300,1,Goto(ext-intercom,${EXTEN},1)
1516.

1517.
exten => *54,1,Answer
1518.
exten => *54,n,Wait(1)
1519.
exten => *54,n,Macro(user-callerid,)
1520.
exten => *54,n,Set(DB(AMPUSER/${AMPUSER}/intercom)=enabled)
1521.
exten => *54,n,Playback(intercom&enabled)
1522.
exten => *54,n,Macro(hangupcall,)
1523.

1524.
exten => _*54.,1,Answer
1525.
exten => _*54.,n,Wait(1)
1526.
exten => _*54.,n,Macro(user-callerid,)
1527.
exten => _*54.,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})}" = "allow" ]}?unset)
1528.
exten => _*54.,n,GotoIf($[${DB_EXISTS(AMPUSER/${EXTEN:3}/device)} != 1]?invaliduser)
1529.
exten => _*54.,n,Set(DB(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})=allow)
1530.
exten => _*54.,n,Playback(intercom&enabled&for&extension&number)
1531.
exten => _*54.,n,SayDigits(${EXTEN:3})
1532.
exten => _*54.,n,Macro(hangupcall,)
1533.
exten => _*54.,n(unset),dbDeltree(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})
1534.
exten => _*54.,n,Playback(intercom&enabled&cancelled&for&extension&number)
1535.
exten => _*54.,n,SayDigits(${EXTEN:3})
1536.
exten => _*54.,n,Macro(hangupcall,)
1537.
exten => _*54.,n(invaliduser),Playback(extension&number)
1538.
exten => _*54.,n,SayDigits(${EXTEN:3})
1539.
exten => _*54.,n,Playback(is&invalid)
1540.
exten => _*54.,n,Macro(hangupcall,)
1541.

1542.
exten => *55,1,Answer
1543.
exten => *55,n,Wait(1)
1544.
exten => *55,n,Macro(user-callerid,)
1545.
exten => *55,n,Set(DB(AMPUSER/${AMPUSER}/intercom)=disabled)
1546.
exten => *55,n,Playback(intercom&disabled)
1547.
exten => *55,n,Macro(hangupcall,)
1548.

1549.
exten => _*55.,1,Answer
1550.
exten => _*55.,n,Wait(1)
1551.
exten => _*55.,n,Macro(user-callerid,)
1552.
exten => _*55.,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})}" = "deny" ]}?unset2)
1553.
exten => _*55.,n,GotoIf($[${DB_EXISTS(AMPUSER/${EXTEN:3}/device)} != 1]?invaliduser2)
1554.
exten => _*55.,n,Set(DB(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})=deny)
1555.
exten => _*55.,n,Playback(intercom&disabled&for&extension&number)
1556.
exten => _*55.,n,SayDigits(${EXTEN:3})
1557.
exten => _*55.,n,Macro(hangupcall,)
1558.
exten => _*55.,n(unset2),dbDeltree(AMPUSER/${AMPUSER}/intercom/${EXTEN:3})
1559.
exten => _*55.,n,Playback(intercom&disabled&cancelled&for&extension&number)
1560.
exten => _*55.,n,SayDigits(${EXTEN:3})
1561.
exten => _*55.,n,Macro(hangupcall,)
1562.
exten => _*55.,n(invaliduser2),Playback(extension&number)
1563.
exten => _*55.,n,SayDigits(${EXTEN:3})
1564.
exten => _*55.,n,Playback(is&invalid)
1565.
exten => _*55.,n,Macro(hangupcall,)
1566.

1567.
;--== end of [ext-intercom-users] ==--;
1568.

1569.

1570.
[macro-autoanswer]
1571.
exten => s,1,GotoIf($["${KNOWNDIAL}" != ""]?knowndial)
1572.
exten => s,n,Set(DEVICE=${DB(DEVICE/${ARG1}/dial)})
1573.
exten => s,n,GotoIf($["${DEVICE:0:5}" == "PJSIP" ]?dopjsip)
1574.
exten => s,n,Set(KNOWNDIAL=${DEVICE})
1575.
exten => s,n,Goto(knowndial)
1576.
exten => s,n(dopjsip),Set(KNOWNDIAL=${PJSIP_DIAL_CONTACTS(${ARG1})})
1577.
exten => s,n,GotoIf($[${REGEX("&" ${KNOWNDIAL})} == 0]?knowndial)
1578.
exten => s,n,Gosub(app-paging,ssetup,1())
1579.
exten => s,n,Set(PAGEMODE=PAGE)
1580.
exten => s,n,Set(PAGE_CONF_OPTS=duplex)
1581.
exten => s,n,Set(STREAM=NONE)
1582.
exten => s,n,Set(PAGE_MEMBERS=${ARG1})
1583.
exten => s,n,AGI(page.agi)
1584.
exten => s,n,Set(CONFBRIDGE(user,template)=page_user_duplex)
1585.
exten => s,n,Set(CONFBRIDGE(user,admin)=yes)
1586.
exten => s,n,Set(CONFBRIDGE(user,marked)=yes)
1587.
exten => s,n,ConfBridge(${PAGE_CONF},,,admin_menu)
1588.
exten => s,n,Hangup
1589.
exten => s,n(knowndial),Set(DIAL=${KNOWNDIAL})
1590.
exten => s,n,ExecIf($["${DIAL:0:3}" = "ZAP"]?Set(DIAL=DAHDI${DIAL:3}))
1591.
exten => s,n,GotoIf($["${DB(DEVICE/${ARG1}/autoanswer/macro)}" != "" ]?macro)
1592.
exten => s,n,Set(USERAGENT=${SIPPEER(${CUT(DIAL,/,2)},useragent)})
1593.
exten => s,n,ExecIf($["${KNOWNAGENT}" != ""]?Set(USERAGENT=${KNOWNAGENT}))
1594.
exten => s,n,ExecIf($["${USERAGENT:0:5}" = "Mitel"]?Set(CALLINFO=<sip:broadworks.net>\;answer-after=0))
1595.
exten => s,n,ExecIf($["${USERAGENT:0:9}" = "Panasonic"]?Set(ALERTINFO=Intercom))
1596.
exten => s,n,ExecIf($["${USERAGENT:0:7}" = "Polycom"]?Set(ALERTINFO=info=Auto Answer))
1597.
exten => s,n,ExecIf($["${USERAGENT:0:6}" = "Digium"]?Set(ALERTINFO=ring-answer))
1598.
exten => s,n,ExecIf($["${SIPURI}" != ""]?Set(__SIP_URI_OPTIONS=${SIPURI}))
1599.
exten => s,n+2(macro),Macro(${DB(DEVICE/${ARG1}/autoanswer/macro)},${ARG1})
1600.

1601.
;--== end of [macro-autoanswer] ==--;
1602.

1603.

1604.
[autoanswer]
1605.
exten => s,1,GosubIf($["${ARG1}" != ""]?addheader,1(Alert-Info,${ARG1}))
1606.
exten => s,n,GosubIf($["${ARG2}" != ""]?addheader,1(Call-Info,${ARG2}))
1607.
exten => s,n,Return()
1608.

1609.
exten => addheader,1,SIPAddHeader(${ARG1}: ${ARG2})
1610.
exten => addheader,n,Set(PJSIP_HEADER(add,${ARG1})=${ARG2})
1611.
exten => addheader,n,Return()
1612.

1613.
;--== end of [autoanswer] ==--;
1614.

1615.

1616.
[app-paging]
1617.
exten => ssetup,1,Set(_SIPURI=)
1618.
exten => ssetup,n,Set(_ALERTINFO=Ring Answer)
1619.
exten => ssetup,n,Set(_CALLINFO=<uri>\;answer-after=0)
1620.
exten => ssetup,n,Set(_SIPURI=intercom=true)
1621.
exten => ssetup,n,Set(_DTIME=5)
1622.
exten => ssetup,n,Set(_ANSWERMACRO=)
1623.
exten => ssetup,n,Set(PAGE_CONF=${EPOCH}${RAND(100,999)})
1624.
exten => ssetup,n,Return()
1625.

1626.
exten => _PAGE.,1(SKIPCHECK),Macro(autoanswer,${EXTEN:4})
1627.
exten => _PAGE.,n,Set(_DOPTIONS=A(beep)b(autoanswer^s^1(${ALERTINFO},${CALLINFO})))
1628.
exten => _PAGE.,n,Dial(${DIAL},${DTIME},${DOPTIONS})
1629.
exten => _PAGE.,n(skipself),Hangup
1630.

1631.
exten => _SPAGE.,1(chanspy),ChanSpy(${SP_DEVICE}-,qW)
1632.
exten => _SPAGE.,n,Hangup
1633.

1634.
;--== end of [app-paging] ==--;
1635.

1636.

1637.
[app-page-stream]
1638.
exten => s,1,Wait(1)
1639.
exten => s,n,Answer
1640.
exten => s,n,Set(CONFBRIDGE(user,template)=page_user_duplex)
1641.
exten => s,n,Set(CONFBRIDGE(user,marked)=yes)
1642.
exten => s,n,ConfBridge(${PAGE_CONF},,,)
1643.
exten => s,n,Hangup
1644.

1645.
;--== end of [app-page-stream] ==--;
1646.

1647.

1648.
[macro-parked-call]
1649.
exten => s,1,Macro(user-callerid,)
1650.
exten => s,n,Gosub(sub-record-check,s,1(parking,${AMPUSER},${AMPUSER}))
1651.
exten => s,n,Noop(PARKRETURNTO: ${SHARED(PARKRETURNTO,${CHANNEL})})
1652.
exten => s,n,GotoIf($[${LEN(${SHARED(PARKRETURNTO,${CHANNEL})})} > 0]?backtosender)
1653.
exten => s,n,GotoIf($[${LEN(${BLINDTRANSFER})} > 0 | ${LEN(${ATTENDEDTRANSFER})} > 0]?attemptpark)
1654.
exten => s,n,AGI(parkfetch.agi,${ARG1},${ARG2})
1655.
exten => s,n,GotoIf($["${REC_STATUS}" != "RECORDING"]?next)
1656.
exten => s,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
1657.
exten => s,n,Set(CDR(recordingfile)=${CALLFILENAME}.${MON_FMT})
1658.
exten => s,n(next),Set(CCSS_SETUP=TRUE)
1659.
exten => s,n,GotoIf($["${ARG1}" = "" | ${DIALPLAN_EXISTS(${IF($["${ARG2}" = "default"]?parkedcalls:${ARG2})},${ARG1},1)} = 1]?pcall)
1660.
exten => s,n,ResetCDR()
1661.
exten => s,n,NoCDR()
1662.
exten => s,n,Wait(1)
1663.
exten => s,n,Playback(pbx-invalidpark)
1664.
exten => s,n,Wait(1)
1665.
exten => s,n,Hangup
1666.
exten => s,n(pcall),Noop(User: ${CALLERID(all)} attempting to pick up Parked Call Slot ${ARG1})
1667.
exten => s,n,Noop(PARKIE: ${PARKIE})
1668.
exten => s,n,Set(SHARED(PARKRETURNTO,${PARKIE})=)
1669.
exten => s,n,Set(PARKOWNER=1)
1670.
exten => s,n,ParkedCall(${ARG2},${ARG1})
1671.
exten => s,n(attemptpark),Noop(User: ${CALLERID(all)} attempting to Park into slot ${ARG1})
1672.
exten => s,n,Noop(Blind Transfer: ${BLINDTRANSFER}, Attended Transfer: ${ATTENDEDTRANSFER})
1673.
exten => s,n,Noop($[${LEN(${PARKOWNER})} = 0])
1674.
exten => s,n,GotoIf($[${LEN(${PARKOWNER})} = 0]?parkit)
1675.
exten => s,n,Macro(hangupcall,)
1676.
exten => s,n(parkit),Set(PARKINGEXTEN=${ARG1})
1677.
exten => s,n,ExecIf($[${LEN(${BLINDTRANSFER})} > 0]?Set(SHARED(PARKRETURNTO,${CHANNEL})=${CUT(BLINDTRANSFER,-,1)}):Set(SHARED(PARKRETURNTO,${CHANNEL})=${CUT(ATTENDEDTRANSFER,-,1)}))
1678.
exten => s,n,Noop(PARKRETURNTO: ${SHARED(PARKRETURNTO,${CHANNEL})})
1679.
exten => s,n,Park(${ARG2},sc(${CONTEXT},s,200))
1680.
exten => s,1+199(backtosender),Noop(Attempting to go back to sender)
1681.
exten => s,n,Set(PARKCALLBACK=${PARKER})
1682.
exten => s,n,Set(SHARED(PARKRETURNTO,${CHANNEL})=)
1683.
exten => s,n,Goto(park-return-routing,${PARKINGSLOT},1)
1684.

1685.
exten => h,1,Macro(hangupcall,)
1686.

1687.
;--== end of [macro-parked-call] ==--;
1688.

1689.

1690.
[parkedcallstimeout]
1691.
exten => _[0-9a-zA-Z*#].,1,Set(PARKCALLBACK=${REPLACE(EXTEN,_,/)})
1692.
exten => _[0-9a-zA-Z*#].,n,GotoIf($["${REC_STATUS}" != "RECORDING"]?next)
1693.
exten => _[0-9a-zA-Z*#].,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
1694.
exten => _[0-9a-zA-Z*#].,n,MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MIXMON_FORMAT},a,${MIXMON_POST})
1695.
exten => _[0-9a-zA-Z*#].,n(next),Goto(park-return-routing,${PARKINGSLOT},1)
1696.

1697.
;--== end of [parkedcallstimeout] ==--;
1698.

1699.

1700.
[park-dial]
1701.
exten => t,1,Noop(WARNING: PARKRETURN to: [${EXTEN}] failed with: [${DIALSTATUS}]. Trying Alternate Dest On Parking Lot ${PARKINGSLOT})
1702.
exten => t,n,Goto(park-orphan-routing,70,1)
1703.

1704.
exten => _[0-9a-zA-Z*#].,1,Noop(WARNING: PARKRETURN to: [${EXTEN}] failed with: [${DIALSTATUS}]. Trying Alternate Dest On Parking Lot ${PARKINGSLOT})
1705.
exten => _[0-9a-zA-Z*#].,n,Goto(park-orphan-routing,70,1)
1706.

1707.
;--== end of [park-dial] ==--;
1708.

1709.

1710.
[park-orphan-routing]
1711.
exten => 70,1,Goto(app-blackhole,hangup,1)
1712.

1713.
;--== end of [park-orphan-routing] ==--;
1714.

1715.

1716.
[park-return-routing]
1717.
exten => 70,1,Set(PLOT=70)
1718.
exten => 70,n,Dial(${PARKCALLBACK},15,tr)
1719.
exten => 70,n,Set(PARKCALLBACK=)
1720.
exten => 70,n,Goto(app-blackhole,hangup,1)
1721.

1722.
exten => 71,1,Goto(70,1)
1723.

1724.
exten => 72,1,Goto(70,1)
1725.

1726.
exten => 73,1,Goto(70,1)
1727.

1728.
exten => 74,1,Goto(70,1)
1729.

1730.
exten => 75,1,Goto(70,1)
1731.

1732.
exten => 76,1,Goto(70,1)
1733.

1734.
exten => 77,1,Goto(70,1)
1735.

1736.
exten => 78,1,Goto(70,1)
1737.

1738.
;--== end of [park-return-routing] ==--;
1739.

1740.

1741.
[park-hints]
1742.
include => parkedcalls ; Default Lot
1743.
exten => 71,1,Macro(parked-call,71,default)
1744.
exten => 71,hint,park:71@parkedcalls
1745.

1746.
exten => 72,1,Macro(parked-call,72,default)
1747.
exten => 72,hint,park:72@parkedcalls
1748.

1749.
exten => 73,1,Macro(parked-call,73,default)
1750.
exten => 73,hint,park:73@parkedcalls
1751.

1752.
exten => 74,1,Macro(parked-call,74,default)
1753.
exten => 74,hint,park:74@parkedcalls
1754.

1755.
exten => 75,1,Macro(parked-call,75,default)
1756.
exten => 75,hint,park:75@parkedcalls
1757.

1758.
exten => 76,1,Macro(parked-call,76,default)
1759.
exten => 76,hint,park:76@parkedcalls
1760.

1761.
exten => 77,1,Macro(parked-call,77,default)
1762.
exten => 77,hint,park:77@parkedcalls
1763.

1764.
exten => 78,1,Macro(parked-call,78,default)
1765.
exten => 78,hint,park:78@parkedcalls
1766.

1767.
exten => *85,1,Macro(parked-call,,default)
1768.
exten => *85,hint,park:71@parkedcalls&park:72@parkedcalls&park:73@parkedcalls&park:74@parkedcalls&park:75@parkedcalls&park:76@parkedcalls&park:77@parkedcalls&park:78@parkedcalls
1769.

1770.
exten => *8570,1,Macro(parked-call,,default)
1771.
exten => *8570,hint,park:71@parkedcalls&park:72@parkedcalls&park:73@parkedcalls&park:74@parkedcalls&park:75@parkedcalls&park:76@parkedcalls&park:77@parkedcalls&park:78@parkedcalls
1772.

1773.
;--== end of [park-hints] ==--;
1774.

1775.

1776.
[app-pbdirectory]
1777.
exten => 411,1,Goto(pbdirectory,1)
1778.

1779.
exten => pbdirectory,1,Answer
1780.
exten => pbdirectory,n,Wait(1)
1781.
exten => pbdirectory,n,Macro(user-callerid,)
1782.
exten => pbdirectory,n,AGI(pbdirectory)
1783.
exten => pbdirectory,n,GotoIf($["${dialnumber}"=""]?hangup,1)
1784.
exten => pbdirectory,n,Noop(Got number to dial: ${dialnumber})
1785.
exten => pbdirectory,n,Dial(Local/${dialnumber}@from-internal/n,)
1786.

1787.
exten => hangup,1,Hangup
1788.

1789.
;--== end of [app-pbdirectory] ==--;
1790.

1791.

1792.
[app-recordings]
1793.
exten => *77,1,Macro(user-callerid,)
1794.
exten => *77,n,Wait(2)
1795.
exten => *77,n,Macro(systemrecording,dorecord)
1796.

1797.
exten => *99,1,Macro(user-callerid,)
1798.
exten => *99,n,Wait(2)
1799.
exten => *99,n,Macro(systemrecording,docheck)
1800.

1801.
;--== end of [app-recordings] ==--;
1802.

1803.

1804.
[macro-systemrecording]
1805.
exten => s,1,Set(RECFILE=${IF($["${ARG2}" = ""]?/var/spool/asterisk/tmp/${AMPUSER}-ivrrecording:${ARG2})})
1806.
exten => s,n,ExecIf($["${ARG3}" != ""]?Authenticate(${ARG3}))
1807.
exten => s,n,Goto(${ARG1},1)
1808.

1809.
exten => dorecord,1,GotoIf($["${ARG2}" = ""]?skipremove)
1810.
exten => dorecord,n,System(rm ${ASTVARLIBDIR}/sounds/${RECFILE}.*)
1811.
exten => dorecord,n(skipremove),Record(${RECFILE}.wav,,,k)
1812.
exten => dorecord,n,Wait(1)
1813.
exten => dorecord,n,Goto(confmenu,1)
1814.

1815.
exten => docheck,1,Playback(beep)
1816.
exten => docheck,n(dc_start),Background(${RECFILE},m,${CHANNEL(language)},macro-systemrecording)
1817.
exten => docheck,n,Wait(1)
1818.
exten => docheck,n,Goto(confmenu,1)
1819.

1820.
exten => confmenu,1,Background(to-listen-to-it&press-1&to-rerecord-it&press-star&astcc-followed-by-pound,m,${CHANNEL(language)},macro-systemrecording)
1821.
exten => confmenu,n,Read(RECRESULT,,1,,,4)
1822.
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x*"]?dorecord,1)
1823.
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x1"]?docheck,2)
1824.
exten => confmenu,n,Goto(1)
1825.

1826.
exten => 1,1,Goto(docheck,dc_start)
1827.

1828.
exten => *,1,Goto(dorecord,1)
1829.

1830.
exten => t,1,Playback(goodbye)
1831.
exten => t,n,Hangup
1832.

1833.
exten => i,1,Playback(pm-invalid-option)
1834.
exten => i,n,Goto(confmenu,1)
1835.

1836.
exten => h,1,Hangup
1837.

1838.
;--== end of [macro-systemrecording] ==--;
1839.

1840.

1841.
[ext-group]
1842.
exten => h,1,Macro(hangupcall,)
1843.

1844.
;--== end of [ext-group] ==--;
1845.

1846.

1847.
[macro-speeddial-lookup]
1848.
exten => s,1,GotoIf($["${ARG2}"=""]]?lookupsys)
1849.
exten => s,n,Set(SPEEDDIALNUMBER=)
1850.
exten => s,n(lookupuser),Set(SPEEDDIALNUMBER=${DB(AMPUSER/${ARG2}/speeddials/${ARG1})})
1851.
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?lookupsys)
1852.
exten => s,n,Noop(Found speeddial ${ARG1} for user ${ARG2}: ${SPEEDDIALNUMBER})
1853.
exten => s,n,Goto(end)
1854.
exten => s,lookupuser+101(lookupsys),Set(SPEEDDIALNUMBER=${DB(sysspeeddials/${ARG1})})
1855.
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
1856.
exten => s,n,Noop(Found system speeddial ${ARG1}: ${SPEEDDIALNUMBER})
1857.
exten => s,n,Goto(end)
1858.
exten => s,lookupsys+101(failed),Noop(No system or user speeddial found)
1859.
exten => s,n(end),Noop(End of Speeddial-lookup)
1860.

1861.
;--== end of [macro-speeddial-lookup] ==--;
1862.

1863.

1864.
[app-speeddial]
1865.
exten => _*0.,1,Macro(user-callerid,)
1866.
exten => _*0.,n,Set(SPEEDDIALLOCATION=${EXTEN:2})
1867.
exten => _*0.,n(lookup),Macro(speeddial-lookup,${SPEEDDIALLOCATION},${AMPUSER})
1868.
exten => _*0.,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
1869.
exten => _*0.,n,Goto(from-internal,${SPEEDDIALNUMBER},1)
1870.
exten => _*0.,lookup+101(failed),Playback(speed-dial-empty)
1871.
exten => _*0.,n,Congestion()
1872.

1873.
exten => *75,1,Goto(app-speeddial-set,s,1)
1874.

1875.
;--== end of [app-speeddial] ==--;
1876.

1877.

1878.
[app-speeddial-set]
1879.
exten => lang-playback,1,GosubIf($[${DIALPLAN_EXISTS(app-speeddial-set,${CHANNEL(language)})}]?app-speeddial-set,${CHANNEL(language)},${ARG1}():app-speeddial-set,en,${ARG1}())
1880.
exten => lang-playback,n,Return()
1881.

1882.
exten => s,1,Macro(user-callerid,)
1883.
exten => s,n(setloc),Read(newlocation,speed-enterlocation,,,,)
1884.
exten => s,n(lookup),Macro(speeddial-lookup,${newlocation},${AMPUSER})
1885.
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"!=""]?conflicts)
1886.
exten => s,n(setnum),Read(newnum,speed-enternumber,,,,)
1887.
exten => s,n(success),Set(DB(AMPUSER/${AMPUSER}/speeddials/${newlocation})=${newnum})
1888.
exten => s,n,Gosub(app-speeddial-set,lang-playback,1(hook_0))
1889.
exten => s,n,Hangup
1890.
exten => s,n(conflicts),Gosub(app-speeddial-set,lang-playback,1(hook_1))
1891.
exten => s,n,WaitExten(60,)
1892.

1893.
exten => 1,1,Gosub(app-speeddial-set,lang-playback,1(hook_2))
1894.
exten => 1,n,Goto(s,conflicts)
1895.

1896.
exten => 2,1,Goto(s,setloc)
1897.

1898.
exten => 3,1,Goto(s,setnum)
1899.

1900.
exten => t,1,Congestion()
1901.

1902.
exten => en,1(hook_0),Playback(speed-dial)
1903.
exten => en,n,SayDigits(${newlocation})
1904.
exten => en,n,Playback(is-set-to)
1905.
exten => en,n,SayDigits(${newnum})
1906.
exten => en,n,Return()
1907.
exten => en,n(hook_1),Playback(speed-dial)
1908.
exten => en,n,SayDigits(${newlocation})
1909.
exten => en,n,Playback(is-in-use)
1910.
exten => en,n,Background(press-1&to-listen-to-it&press-2&to-enter-a-diff&location&press-3&to-change&telephone-number)
1911.
exten => en,n,Return()
1912.
exten => en,n(hook_2),Playback(speed-dial)
1913.
exten => en,n,SayDigits(${newlocation})
1914.
exten => en,n,Playback(is-set-to)
1915.
exten => en,n,SayDigits(${SPEEDDIALNUMBER})
1916.
exten => en,n,Return()
1917.

1918.
exten => ja,1(hook_0),Playback(speed-dial)
1919.
exten => ja,n,SayDigits(${newlocation})
1920.
exten => ja,n,Playback(jp-wo)
1921.
exten => ja,n,SayDigits(${newnum})
1922.
exten => ja,n,Playback(is-set-to)
1923.
exten => ja,n,Return()
1924.
exten => ja,n(hook_1),Playback(speed-dial)
1925.
exten => ja,n,SayDigits(${newlocation})
1926.
exten => ja,n,Playback(jp-wa&is-in-use)
1927.
exten => ja,n,Background(list&press-1&to-enter-a-diff&location&jp-wo&to-enter&press-2&telephone-number&jp-wo&to-change&press-3)
1928.
exten => ja,n,Return()
1929.
exten => ja,n(hook_2),Playback(speed-dial)
1930.
exten => ja,n,SayDigits(${newlocation})
1931.
exten => ja,n,Playback(jp-wa)
1932.
exten => ja,n,SayDigits(${SPEEDDIALNUMBER})
1933.
exten => ja,n,Playback(is-set-to-2)
1934.
exten => ja,n,Return()
1935.

1936.
;--== end of [app-speeddial-set] ==--;
1937.

1938.

1939.
[vm-callme]
1940.
exten => s,1,Answer
1941.
exten => s,n,Wait(1)
1942.
exten => s,n(repeat),Background(${MSG}&silence/2&vm-repeat&vm-starmain)
1943.
exten => s,n,WaitExten(15,)
1944.

1945.
exten => 5,1,Goto(s,repeat)
1946.

1947.
exten => #,1,Playback(vm-goodbye)
1948.
exten => #,n,Hangup
1949.

1950.
exten => *,1,Macro(get-vmcontext,${MBOX})
1951.
exten => *,n,VoiceMailMain(${MBOX}@${VMCONTEXT},s)
1952.

1953.
exten => i,1,Playback(pm-invalid-option)
1954.
exten => i,n,Goto(s,repeat)
1955.

1956.
exten => t,1,Playback(vm-goodbye)
1957.
exten => t,n,Hangup
1958.

1959.
exten => h,1,Hangup
1960.

1961.
;--== end of [vm-callme] ==--;
1962.

1963.

1964.
[app-dialvm]
1965.
exten => *98,1,Macro(user-callerid,)
1966.
exten => *98,n,Answer
1967.
exten => *98,n(start),Wait(1)
1968.
exten => *98,n,Noop(app-dialvm: Asking for mailbox)
1969.
exten => *98,n,Read(MAILBOX,vm-login,,,3,2)
1970.
exten => *98,n(check),Noop(app-dialvm: Got Mailbox ${MAILBOX})
1971.
exten => *98,n,Macro(get-vmcontext,${MAILBOX})
1972.
exten => *98,n,Set(VMBOXEXISTSSTATUS=${IF(${VM_INFO(${MAILBOX}@${VMCONTEXT},exists)}?SUCCESS:FAILED)})
1973.
exten => *98,n,GotoIf($["${VMBOXEXISTSSTATUS}" = "SUCCESS"]?good:bad)
1974.
exten => *98,n,Macro(hangupcall,)
1975.
exten => *98,n(good),Noop(app-dialvm: Good mailbox ${MAILBOX}@${VMCONTEXT})
1976.
exten => *98,n,VoiceMailMain(${MAILBOX}@${VMCONTEXT})
1977.
exten => *98,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
1978.
exten => *98,n,Macro(hangupcall,)
1979.
exten => *98,n(bad),Noop(app-dialvm: BAD mailbox ${MAILBOX}@${VMCONTEXT})
1980.
exten => *98,n,Wait(1)
1981.
exten => *98,n,Noop(app-dialvm: Asking for password so people can't probe for existence of a mailbox)
1982.
exten => *98,n,Read(FAKEPW,vm-password,,,3,2)
1983.
exten => *98,n,Noop(app-dialvm: Asking for mailbox again)
1984.
exten => *98,n,Read(MAILBOX,vm-incorrect-mailbox,,,3,2)
1985.
exten => *98,n,Goto(check)
1986.
exten => *98,n,Macro(hangupcall,)
1987.
exten => *98,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
1988.
exten => *98,n,Goto(${IVR_CONTEXT},return,1)
1989.

1990.
exten => _*98.,1,Answer
1991.
exten => _*98.,n,Wait(1)
1992.
exten => _*98.,n,Macro(get-vmcontext,${EXTEN:3})
1993.
exten => _*98.,n,VoiceMailMain(${EXTEN:3}@${VMCONTEXT})
1994.
exten => _*98.,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?${IVR_CONTEXT},return,1)
1995.
exten => _*98.,n,Macro(hangupcall,)
1996.

1997.
;--== end of [app-dialvm] ==--;
1998.

1999.

2000.
[app-vmmain]
2001.
exten => *97,1,Answer
2002.
exten => *97,n,Wait(1)
2003.
exten => *97,n,Macro(user-callerid,)
2004.
exten => *97,n,Macro(get-vmcontext,${AMPUSER})
2005.
exten => *97,n(check),Set(VMBOXEXISTSSTATUS=${IF(${VM_INFO(${AMPUSER}@${VMCONTEXT},exists)}?SUCCESS:FAILED)})
2006.
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = "SUCCESS"]?mbexist)
2007.
exten => *97,n,VoiceMailMain()
2008.
exten => *97,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
2009.
exten => *97,n,Macro(hangupcall,)
2010.
exten => *97,check+101(mbexist),GotoIf($["${DB(AMPUSER/${AMPUSER}/novmpw)}"!=""]?novmpw:vmpw)
2011.
exten => *97,n(novmpw),Noop(Verifying channel ${CHANNEL} is actually ${AMPUSER})
2012.
exten => *97,n,GotoIf($["${REGEX("^${DB(DEVICE/${AMPUSER}/dial)}-[0-9a-fx]+$" ${CHANNEL})}"!="1"]?vmpws)
2013.
exten => *97,n,VoiceMailMain(${AMPUSER}@${VMCONTEXT},s)
2014.
exten => *97,n,Goto(vmend)
2015.
exten => *97,n(vmpws),Noop(Channel ${CHANNEL} is NOT ${AMPUSER} forcing VM Password)
2016.
exten => *97,n(vmpw),VoiceMailMain(${AMPUSER}@${VMCONTEXT})
2017.
exten => *97,n,Goto(vmend)
2018.
exten => *97,n(vmend),GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
2019.
exten => *97,n,Macro(hangupcall,)
2020.
exten => *97,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
2021.
exten => *97,n,Goto(${IVR_CONTEXT},return,1)
2022.

2023.
;--== end of [app-vmmain] ==--;
2024.

2025.

2026.
[from-did-direct-ivr]
2027.
exten => *300,1,Macro(blkvm-clr,)
2028.
exten => *300,n,Set(__NODEST=)
2029.
exten => *300,n,Macro(vm,300,DIRECTDIAL,${IVR_RETVM})
2030.
exten => *300,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?ext-local,vmret,playret)
2031.

2032.
exten => 300,1,Macro(blkvm-clr,)
2033.
exten => 300,n,Set(__NODEST=)
2034.
exten => 300,n,Goto(from-did-direct,300,1)
2035.

2036.
;--== end of [from-did-direct-ivr] ==--;
2037.

2038.

2039.
[app-userlogonoff]
2040.
exten => *12,1,Macro(user-logoff,)
2041.
exten => *12,n(hook_off),Hangup
2042.

2043.
exten => *11,1,Macro(user-logon,)
2044.
exten => *11,n(hook_on_1),Hangup
2045.

2046.
exten => _*11.,1,Macro(user-logon,${EXTEN:3},)
2047.
exten => _*11.,n(hook_on_2),Hangup
2048.

2049.
;--== end of [app-userlogonoff] ==--;
2050.

2051.

2052.
[ext-local-confirm]
2053.
exten => _LC-.,1,ExecIf($["${DIRECTION}" = "INBOUND"]?Set(DIAL_OPTIONS=${REPLACE(DIAL_OPTIONS,T)}I))
2054.
exten => _LC-.,n,ExecIf($["${ALERT_INFO}"!=""]?SIPAddHeader(Alert-Info: ${ALERT_INFO}))
2055.
exten => _LC-.,n,Dial(${DB(DEVICE/${EXTEN:3}/dial)},${RT},${DIAL_OPTIONS}M(auto-confirm^${RG_IDX}))
2056.

2057.
;--== end of [ext-local-confirm] ==--;
2058.

2059.

2060.
[findmefollow-ringallv2]
2061.
exten => _FMPR-.,1,NoCDR()
2062.
exten => _FMPR-.,n,Set(RingGroupMethod=)
2063.
exten => _FMPR-.,n,Set(USE_CONFIRMATION=)
2064.
exten => _FMPR-.,n,Set(RINGGROUP_INDEX=)
2065.
exten => _FMPR-.,n,Macro(simple-dial,${EXTEN:5},${FMREALPRERING})
2066.
exten => _FMPR-.,n,ExecIf($["${DIALSTATUS}" = "BUSY"]?Set(SHARED(FM_DND,${FMUNIQUE})=DND))
2067.
exten => _FMPR-.,n,Hangup
2068.

2069.
exten => _FMGL-.,1,NoCDR()
2070.
exten => _FMGL-.,n,Set(ENDLOOP=$[${EPOCH} + ${FMPRERING} + 2])
2071.
exten => _FMGL-.,n(start),GotoIf($["${SHARED(FM_DND,${FMUNIQUE})}" = "DND"]?dodnd)
2072.
exten => _FMGL-.,n,Wait(1)
2073.
exten => _FMGL-.,n,GotoIf($[${EPOCH} < ${ENDLOOP}]?start)
2074.
exten => _FMGL-.,n,Set(SHARED(FM_DND,${FMUNIQUE})=)
2075.
exten => _FMGL-.,n(dodial),Macro(dial,${FMGRPTIME},${DIAL_OPTIONS},${EXTEN:5})
2076.
exten => _FMGL-.,n,Hangup
2077.
exten => _FMGL-.,n+10(dodnd),Set(SHARED(FM_DND,${FMUNIQUE})=)
2078.
exten => _FMGL-.,n,GotoIf($["${FMPRIME}" = "FALSE"]?dodial)
2079.
exten => _FMGL-.,n,Hangup
2080.

2081.
;--== end of [findmefollow-ringallv2] ==--;
2082.

2083.

2084.
[app-pickup]
2085.
exten => _**.,1,Macro(user-callerid,)
2086.
exten => _**.,n,Set(PICKUP_EXTEN=${AMPUSER})
2087.
exten => _**.,n,Pickup(${EXTEN:2}&${EXTEN:2}@PICKUPMARK)
2088.
exten => _**.,n,Hangup
2089.

2090.
exten => _***80.,1,Macro(user-callerid,)
2091.
exten => _***80.,n,Set(PICKUP_EXTEN=${AMPUSER})
2092.
exten => _***80.,n,Pickup(${EXTEN:5}&${EXTEN:5}@PICKUPMARK)
2093.
exten => _***80.,n,Hangup
2094.

2095.
;--== end of [app-pickup] ==--;
2096.

2097.

2098.
[app-chanspy]
2099.
exten => 555,1,Macro(user-callerid,)
2100.
exten => 555,n,Answer
2101.
exten => 555,n,Wait(1)
2102.
exten => 555,n,ChanSpy()
2103.
exten => 555,n,Hangup
2104.

2105.
;--== end of [app-chanspy] ==--;
2106.

2107.

2108.
[ext-test]
2109.
exten => 7777,1,Macro(user-callerid,)
2110.
exten => 7777,n,Goto(from-pstn,${EXTEN},1)
2111.

2112.
exten => h,1,Macro(hangupcall,)
2113.

2114.
;--== end of [ext-test] ==--;
2115.

2116.

2117.
[ext-did]
2118.
include => ext-did-0001
2119.
include => ext-did-0002
2120.
exten => foo,1,Noop(bar)
2121.

2122.
;--== end of [ext-did] ==--;
2123.

2124.

2125.
[ext-did-catchall]
2126.
exten => s,1,Noop(No DID or CID Match)
2127.
exten => s,n(a2),Answer
2128.
exten => s,n,Log(WARNING,Friendly Scanner from ${CUT(CUT(SIP_HEADER(Via), ,2),:,1)})
2129.
exten => s,n,Wait(2)
2130.
exten => s,n,Playback(ss-noservice)
2131.
exten => s,n,SayAlpha(${FROM_DID})
2132.
exten => s,n,Hangup
2133.

2134.
exten => _.,1,Set(__FROM_DID=${EXTEN})
2135.
exten => _.,n,Noop(Received an unknown call with DID set to ${EXTEN})
2136.
exten => _.,n,Goto(s,a2)
2137.

2138.
exten => h,1,Hangup
2139.

2140.
;--== end of [ext-did-catchall] ==--;
2141.

2142.

2143.
[from-trunk-pjsip-Telekom]
2144.
exten => _.,1,Set(GROUP()=OUT_2)
2145.
exten => _.,n,Goto(from-trunk,${EXTEN},1)
2146.

2147.
;--== end of [from-trunk-pjsip-Telekom] ==--;
2148.

2149.

2150.
[ext-trunk]
2151.
exten => 2,1,Set(TDIAL_SUFFIX=@Telekom)
2152.
exten => 2,n,Set(TDIAL_STRING=PJSIP)
2153.
exten => 2,n,Set(DIAL_TRUNK=2)
2154.
exten => 2,n,Goto(ext-trunk,tdial,1)
2155.

2156.
exten => tdial,1,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
2157.
exten => tdial,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}" = ""]?nomax)
2158.
exten => tdial,n,GotoIf($[${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}}]?hangit)
2159.
exten => tdial,n(nomax),ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
2160.
exten => tdial,n,Set(DIAL_NUMBER=${FROM_DID})
2161.
exten => tdial,n,GosubIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?sub-flp-${DIAL_TRUNK},s,1())
2162.
exten => tdial,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
2163.
exten => tdial,n,Set(DIAL_TRUNK_OPTIONS=${IF($["${DB_EXISTS(TRUNK/${DIAL_TRUNK}/dialopts)}" = "1"]?${DB_RESULT}:${TRUNK_OPTIONS})})
2164.
exten => tdial,n,Dial(${TDIAL_STRING}/${OUTNUM}${TDIAL_SUFFIX},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS})
2165.
exten => tdial,n,Set(CALLERID(number)=${CALLERID(number):0:40})
2166.
exten => tdial,n,Set(CALLERID(name)=${CALLERID(name):0:40})
2167.
exten => tdial,n(hangit),Hangup
2168.

2169.
;--== end of [ext-trunk] ==--;
2170.

2171.

2172.
[macro-prepend-cid]
2173.
exten => s,1,GotoIf($["${RGPREFIX}" = ""]?REPCID)
2174.
exten => s,n,GotoIf($["${RGPREFIX}" != "${CALLERID(name):0:${LEN(${RGPREFIX})}}"]?REPCID)
2175.
exten => s,n,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}})
2176.
exten => s,n,Set(_RGPREFIX=)
2177.
exten => s,n(REPCID),Set(_RGPREFIX=${ARG1})
2178.
exten => s,n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})
2179.

2180.
;--== end of [macro-prepend-cid] ==--;
2181.

2182.

2183.
[outbound-allroutes]
2184.
include => outrt-1 ; Normal
2185.
exten => foo,1,Noop(bar)
2186.

2187.
;--== end of [outbound-allroutes] ==--;
2188.

2189.

2190.
[outrt-1] ; Normal
2191.
exten => _+49X.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
2192.
exten => _+49X.,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
2193.
exten => _+49X.,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
2194.
exten => _+49X.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
2195.
exten => _+49X.,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="Kay" <04074041501>))
2196.
exten => _+49X.,n,Set(_NODEST=)
2197.
exten => _+49X.,n,Macro(dialout-trunk,2,${EXTEN},,off)
2198.
exten => _+49X.,n,Macro(outisbusy,)
2199.

2200.
exten => _0Z.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
2201.
exten => _0Z.,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
2202.
exten => _0Z.,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
2203.
exten => _0Z.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
2204.
exten => _0Z.,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="Kay" <04074041501>))
2205.
exten => _0Z.,n,Set(_NODEST=)
2206.
exten => _0Z.,n,Macro(dialout-trunk,2,${EXTEN},,off)
2207.
exten => _0Z.,n,Macro(outisbusy,)
2208.

2209.
exten => _Z.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
2210.
exten => _Z.,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
2211.
exten => _Z.,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
2212.
exten => _Z.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
2213.
exten => _Z.,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="Kay" <04074041501>))
2214.
exten => _Z.,n,Set(_NODEST=)
2215.
exten => _Z.,n,Macro(dialout-trunk,2,${EXTEN},,off)
2216.
exten => _Z.,n,Macro(outisbusy,)
2217.

2218.
;--== end of [outrt-1] ==--;
2219.

2220.

2221.
[app-blackhole]
2222.
exten => hangup,1,Noop(Blackhole Dest: Hangup)
2223.
exten => hangup,n,Hangup
2224.

2225.
exten => zapateller,1,Noop(Blackhole Dest: Play SIT Tone)
2226.
exten => zapateller,n,Answer
2227.
exten => zapateller,n,Zapateller()
2228.

2229.
exten => musiconhold,1,Noop(Blackhole Dest: Put caller on hold forever)
2230.
exten => musiconhold,n,Answer
2231.
exten => musiconhold,n,MusicOnHold()
2232.

2233.
exten => congestion,1,Noop(Blackhole Dest: Congestion)
2234.
exten => congestion,n,Playtones(congestion)
2235.
exten => congestion,n,Congestion(20)
2236.
exten => congestion,n,Hangup
2237.

2238.
exten => busy,1,Noop(Blackhole Dest: Busy)
2239.
exten => busy,n,Busy(20)
2240.
exten => busy,n,Hangup
2241.

2242.
exten => ring,1,Noop(Blackhole Dest: Ring)
2243.
exten => ring,n,Answer
2244.
exten => ring,n,Playtones(ring)
2245.
exten => ring,n,Wait(300)
2246.
exten => ring,n,Hangup
2247.

2248.
;--== end of [app-blackhole] ==--;
2249.

2250.

2251.
[bad-number]
2252.
exten => _X.,1,ResetCDR()
2253.
exten => _X.,n,NoCDR()
2254.
exten => _X.,n,Progress
2255.
exten => _X.,n,Wait(1)
2256.
exten => _X.,n,Progress
2257.
exten => _X.,n,Playback(silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer)
2258.
exten => _X.,n,Wait(1)
2259.
exten => _X.,n,Congestion(20)
2260.
exten => _X.,n,Hangup
2261.

2262.
;--== end of [bad-number] ==--;
2263.

2264.

2265.
[sub-presencestate-display]
2266.
exten => s,1,Goto(state-${TOLOWER(${PRESENCE_STATE(CustomPresence:${ARG1},value)})},1)
2267.

2268.
exten => state-available,1,Set(PRESENCESTATE_DISPLAY=(Available))
2269.
exten => state-available,n,Return()
2270.

2271.
exten => state-chat,1,Set(PRESENCESTATE_DISPLAY=(Chatty))
2272.
exten => state-chat,n,Return()
2273.

2274.
exten => state-away,1,Set(PRESENCESTATE_DISPLAY=(Away))
2275.
exten => state-away,n,Return()
2276.

2277.
exten => state-dnd,1,Set(PRESENCESTATE_DISPLAY=(DND))
2278.
exten => state-dnd,n,Return()
2279.

2280.
exten => state-xa,1,Set(PRESENCESTATE_DISPLAY=(Extended Away))
2281.
exten => state-xa,n,Return()
2282.

2283.
exten => state-unavailable,1,Set(PRESENCESTATE_DISPLAY=(Unavailable))
2284.
exten => state-unavailable,n,Return()
2285.

2286.
exten => _state-.,1,Set(PRESENCESTATE_DISPLAY=)
2287.
exten => _state-.,n,Return()
2288.

2289.
exten => state-,1,Set(PRESENCESTATE_DISPLAY=)
2290.
exten => state-,n,Return()
2291.

2292.
;--== end of [sub-presencestate-display] ==--;
2293.

2294.

2295.
[macro-confirm]
2296.
exten => s,1,Set(LOOPCOUNT=0)
2297.
exten => s,n,Set(__MACRO_RESULT=ABORT)
2298.
exten => s,n,Set(MSG1=${IF($["${ARG1}${ALT_CONFIRM_MSG}"=""]?incoming-call-1-accept-2-decline:${IF($[${LEN(${ALT_CONFIRM_MSG})}>0]?${ALT_CONFIRM_MSG}:${ARG1})})})
2299.
exten => s,n(start),Background(${MSG1},m,${CHANNEL(language)},macro-confirm)
2300.
exten => s,n,Read(INPUT,,1,,,4)
2301.
exten => s,n,GotoIf($[${LEN(${INPUT})} > 0]?${INPUT},1:t,1)
2302.

2303.
exten => 1,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}"="0" & "${SHARED(ANSWER_STATUS,${FORCE_CONFIRM})}"=""]?toolate,1)
2304.
exten => 1,n,Noop(Deleting: RG/${ARG3}/${UNIQCHAN} ${DB_DELETE(RG/${ARG3}/${UNIQCHAN})})
2305.
exten => 1,n,Macro(blkvm-clr,)
2306.
exten => 1,n,Set(SHARED(ANSWER_STATUS,${FORCE_CONFIRM})=)
2307.
exten => 1,n(skip),Set(__MACRO_RESULT=)
2308.
exten => 1,n,ExecIf($[("${MOHCLASS}"!="default") & ("${MOHCLASS}"!="")]?Set(CHANNEL(musicclass)=${MOHCLASS}))
2309.
exten => 1,n(exitopt1),MacroExit()
2310.

2311.
exten => 2,1,Goto(noanswer,1)
2312.

2313.
exten => 3,1,SayDigits(${CALLCONFIRMCID})
2314.
exten => 3,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}"="0" & "${SHARED(ANSWER_STATUS,${FORCE_CONFIRM})}"=""]?toolate,1:s,start)
2315.

2316.
exten => t,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}"="0" & "${SHARED(ANSWER_STATUS,${FORCE_CONFIRM})}"=""]?toolate,1)
2317.
exten => t,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
2318.
exten => t,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
2319.

2320.
exten => _X,1,Background(invalid,m,${CHANNEL(language)},macro-confirm)
2321.
exten => _X,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}"="0" | "${SHARED(ANSWER_STATUS,${FORCE_CONFIRM})}"=""]?toolate,1)
2322.
exten => _X,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
2323.
exten => _X,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
2324.

2325.
exten => noanswer,1,Set(__MACRO_RESULT=ABORT)
2326.
exten => noanswer,n(exitnoanswer),MacroExit()
2327.

2328.
exten => toolate,1,Set(MSG2=${IF($["foo${ARG2}" != "foo"]?${ARG2}:"incoming-call-no-longer-avail")})
2329.
exten => toolate,n,Playback(${MSG2})
2330.
exten => toolate,n,Set(__MACRO_RESULT=ABORT)
2331.
exten => toolate,n(exittoolate),MacroExit()
2332.

2333.
exten => h,1,Macro(hangupcall,)
2334.

2335.
;--== end of [macro-confirm] ==--;
2336.

2337.

2338.
[macro-auto-confirm]
2339.
exten => s,1,Set(__MACRO_RESULT=)
2340.
exten => s,n,Set(CFIGNORE=)
2341.
exten => s,n,Set(MASTER_CHANNEL(CFIGNORE)=)
2342.
exten => s,n,Set(FORWARD_CONTEXT=from-internal)
2343.
exten => s,n,Set(MASTER_CHANNEL(FORWARD_CONTEXT)=from-internal)
2344.
exten => s,n,Macro(blkvm-clr,)
2345.
exten => s,n,Noop(Deleting: RG/${ARG1}/${UNIQCHAN} ${DB_DELETE(RG/${ARG1}/${UNIQCHAN})})
2346.
exten => s,n,ExecIf($[!${REGEX("[^0-9]" ${DIALEDPEERNUMBER})} && "${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(MASTER_CHANNEL(CONNECTEDLINE(num))=${DIALEDPEERNUMBER}))
2347.
exten => s,n,ExecIf($[!${REGEX("[^0-9]" ${DIALEDPEERNUMBER})} && "${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(MASTER_CHANNEL(CONNECTEDLINE(name))=${DB(AMPUSER/${DIALEDPEERNUMBER}/cidname)}))
2348.

2349.
;--== end of [macro-auto-confirm] ==--;
2350.

2351.

2352.
[macro-auto-blkvm]
2353.
exten => s,1,Set(__MACRO_RESULT=)
2354.
exten => s,n,Set(CFIGNORE=)
2355.
exten => s,n,Set(MASTER_CHANNEL(CFIGNORE)=)
2356.
exten => s,n,Set(FORWARD_CONTEXT=from-internal)
2357.
exten => s,n,Set(MASTER_CHANNEL(FORWARD_CONTEXT)=from-internal)
2358.
exten => s,n,Macro(blkvm-clr,)
2359.
exten => s,n,ExecIf($[!${REGEX("[^0-9]" ${DIALEDPEERNUMBER})} && "${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(MASTER_CHANNEL(CONNECTEDLINE(num))=${DIALEDPEERNUMBER}))
2360.
exten => s,n,ExecIf($[!${REGEX("[^0-9]" ${DIALEDPEERNUMBER})} && "${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(MASTER_CHANNEL(CONNECTEDLINE(name))=${DB(AMPUSER/${DIALEDPEERNUMBER}/cidname)}))
2361.

2362.
;--== end of [macro-auto-blkvm] ==--;
2363.

2364.

2365.
[sub-pincheck]
2366.
exten => s,1,Authenticate(${ARG3},)
2367.
exten => s,n,ResetCDR()
2368.
exten => s,n,Return()
2369.

2370.
;--== end of [sub-pincheck] ==--;
2371.

2372.

2373.
[macro-dialout-trunk]
2374.
exten => s,1,Set(DIAL_TRUNK=${ARG1})
2375.
exten => s,n,GosubIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]?sub-pincheck,s,1())
2376.
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
2377.
exten => s,n,Set(DIAL_NUMBER=${ARG2})
2378.
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
2379.
exten => s,n,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
2380.
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
2381.
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
2382.
exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid)
2383.
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${IF($["${DB_EXISTS(TRUNK/${DIAL_TRUNK}/dialopts)}" = "1"]?${DB_RESULT}:${TRUNK_OPTIONS})})
2384.
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
2385.
exten => s,n(skipoutcid),GosubIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?sub-flp-${DIAL_TRUNK},s,1())
2386.
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
2387.
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)})
2388.
exten => s,n,ExecIf($["${MOHCLASS}"!="default" & "${MOHCLASS}"!="" & "${FORCE_CONFIRM}"="" ]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
2389.
exten => s,n,ExecIf($["${FORCE_CONFIRM}"!="" ]?Set(DIAL_TRUNK_OPTIONS=${DIAL_TRUNK_OPTIONS}M(confirm)))
2390.
exten => s,n(gocall),Macro(dialout-trunk-predial-hook,)
2391.
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = "BYPASS"]?bypass,1)
2392.
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER}))
2393.
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(CONNECTEDLINE(name,i)=CID:${CALLERID(number)}))
2394.
exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
2395.
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS})
2396.
exten => s,n,Noop(Dial failed for some reason with DIALSTATUS = ${DIALSTATUS} and HANGUPCAUSE = ${HANGUPCAUSE})
2397.
exten => s,n,GotoIf($["${ARG4}" = "on"]?continue,1:s-${DIALSTATUS},1)
2398.
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
2399.
exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)})
2400.
exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)})
2401.
exten => s,n,GotoIf($["${the_num}" = "OUTNUM"]?outnum:skipoutnum)
2402.
exten => s,n(outnum),Set(the_num=${OUTNUM})
2403.
exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS})
2404.
exten => s,n,Noop(Dial failed for some reason with DIALSTATUS = ${DIALSTATUS} and HANGUPCAUSE = ${HANGUPCAUSE})
2405.
exten => s,n,GotoIf($["${ARG4}" = "on"]?continue,1:s-${DIALSTATUS},1)
2406.
exten => s,n(chanfull),Noop(max channels used up)
2407.

2408.
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
2409.
exten => s-BUSY,n,Playtones(busy)
2410.
exten => s-BUSY,n,Busy(20)
2411.

2412.
exten => s-ANSWER,1,Noop(Call successfully answered - Hanging up now)
2413.
exten => s-ANSWER,n,Macro(hangupcall,)
2414.

2415.
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
2416.
exten => s-NOANSWER,n,Progress
2417.
exten => s-NOANSWER,n,Playback(number-not-answering,noanswer)
2418.
exten => s-NOANSWER,n,Congestion(20)
2419.

2420.
exten => s-INVALIDNMBR,1,Noop(Dial failed due to trunk reporting Address Incomplete - giving up)
2421.
exten => s-INVALIDNMBR,n,Progress
2422.
exten => s-INVALIDNMBR,n,Playback(ss-noservice,noanswer)
2423.
exten => s-INVALIDNMBR,n,Busy(20)
2424.

2425.
exten => s-CHANGED,1,Noop(Dial failed due to trunk reporting Number Changed - giving up)
2426.
exten => s-CHANGED,n,Playtones(busy)
2427.
exten => s-CHANGED,n,Busy(20)
2428.

2429.
exten => _s-.,1,Set(RC=${IF($[${ISNULL(${HANGUPCAUSE})}]?0:${HANGUPCAUSE})})
2430.
exten => _s-.,n,Goto(${RC},1)
2431.

2432.
exten => 17,1,Goto(s-BUSY,1)
2433.

2434.
exten => 18,1,Goto(s-NOANSWER,1)
2435.

2436.
exten => 22,1,Goto(s-CHANGED,1)
2437.

2438.
exten => 23,1,Goto(s-CHANGED,1)
2439.

2440.
exten => 1,1,Goto(s-INVALIDNMBR,1)
2441.

2442.
exten => 28,1,Goto(s-INVALIDNMBR,1)
2443.

2444.
exten => _X,1,Goto(continue,1)
2445.

2446.
exten => _X.,1,Goto(continue,1)
2447.

2448.
exten => continue,1(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} HANGUPCAUSE: ${HANGUPCAUSE} - failing through to other trunks)
2449.
exten => continue,n,Set(CALLERID(number)=${AMPUSER})
2450.

2451.
exten => disabletrunk,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk)
2452.

2453.
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook)
2454.

2455.
exten => h,1,Macro(hangupcall,)
2456.

2457.
;--== end of [macro-dialout-trunk] ==--;
2458.

2459.

2460.
[macro-privacy-mgr]
2461.
exten => s,1,Set(KEEPCID=${CALLERID(num)})
2462.
exten => s,n,Set(TESTCID=${IF($["${CALLERID(num):0:1}"="+"]?${MATH(1+${CALLERID(num):1})}:${MATH(1+${CALLERID(num)})})})
2463.
exten => s,n,ExecIf($[${LEN(${TESTCID})}=0]?Set(CALLERID(num)=))
2464.
exten => s,n,PrivacyManager(${ARG1},${ARG2})
2465.
exten => s,n,GotoIf($["${PRIVACYMGRSTATUS}"="FAILED"]?fail)
2466.
exten => s,n,GosubIf($["${CALLED_BLACKLIST}"="1"]?app-blacklist-check,s,1())
2467.
exten => s,n,Set(CALLERID(num-pres)=allowed_passed_screen)
2468.
exten => s,n,MacroExit()
2469.
exten => s,n(fail),Noop(STATUS: ${PRIVACYMGRSTATUS} CID: ${CALLERID(num)} ${CALLERID(name)} CALLPRES: ${CALLLINGPRES})
2470.
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
2471.
exten => s,n,Playtones(congestion)
2472.
exten => s,n,Congestion(20)
2473.

2474.
exten => h,1,Hangup
2475.

2476.
;--== end of [macro-privacy-mgr] ==--;
2477.

2478.

2479.
[macro-user-callerid]
2480.
exten => s,1,Set(TOUCH_MONITOR=${UNIQUEID})
2481.
exten => s,n,Set(AMPUSER=${IF($["${AMPUSER}" = ""]?${CALLERID(number)}:${AMPUSER})})
2482.
exten => s,n,GotoIf($["${CUT(CHANNEL,@,2):5:5}"="queue" | ${LEN(${AMPUSERCIDNAME})}]?report)
2483.
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
2484.
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
2485.
exten => s,n,GotoIf($["${AMPUSER}" = "none"]?limit)
2486.
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
2487.
exten => s,n,GotoIf($["${AMPUSERCIDNAME:1:2}" = ""]?report)
2488.
exten => s,n,Set(AMPUSERCID=${IF($["${ARG2}" != "EXTERNAL" & "${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})})
2489.
exten => s,n,Set(__DIAL_OPTIONS=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/dialopts)}" = "1"]?${DB_RESULT}:${DIAL_OPTIONS})})
2490.
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
2491.
exten => s,n,GotoIf($["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})} & ${DB_EXISTS(AMPUSER/${AMPUSER}/concurrency_limit)} & ${DB(AMPUSER/${AMPUSER}/concurrency_limit)}>0 & ${GROUP_COUNT(${AMPUSER}@concurrency_limit)}>=${DB(AMPUSER/${AMPUSER}/concurrency_limit)}]?limit)
2492.
exten => s,n,ExecIf($["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})}]?Set(GROUP(concurrency_limit)=${AMPUSER}))
2493.
exten => s,n,GosubIf($[${LEN(${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)})} & "${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)}" != "never"]?sub-ccss,s,1(${MACRO_CONTEXT},${CALLERID(dnid)}))
2494.
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != ""]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
2495.
exten => s,n(report),GotoIf($[ "${ARG1}" = "SKIPTTL" | "${ARG1}" = "LIMIT" ]?continue)
2496.
exten => s,n,ExecIf($["${CALLEE_ACCOUNCODE}" = ""]?Set(__CALLEE_ACCOUNCODE=${DB(AMPUSER/${IF($["${MACRO_CONTEXT}"="macro-exten-vm"]?${ARG2}:${MACRO_EXTEN})}/accountcode)}))
2497.
exten => s,n(report2),Set(__TTL=${IF($["foo${TTL}" = "foo"]?64:$[ ${TTL} - 1 ])})
2498.
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
2499.
exten => s,n,Wait(${RINGTIMER})
2500.
exten => s,n,Answer
2501.
exten => s,n,Wait(1)
2502.
exten => s,n,Playback(im-sorry&an-error-has-occurred&with&call-forwarding)
2503.
exten => s,n,Macro(hangupcall,)
2504.
exten => s,n(limit),Answer
2505.
exten => s,n,Wait(1)
2506.
exten => s,n,Playback(beep&im-sorry&your&simul-call-limit-reached&goodbye)
2507.
exten => s,n,Macro(hangupcall,)
2508.
exten => s,n,Congestion(20)
2509.
exten => s,n(continue),Set(CALLERID(number)=${CALLERID(number):0:40})
2510.
exten => s,n,Set(CALLERID(name)=${CALLERID(name):0:40})
2511.
exten => s,n,Set(CDR(cnum)=${CALLERID(num)})
2512.
exten => s,n,Set(CDR(cnam)=${CALLERID(name)})
2513.
exten => s,n,Set(CHANNEL(language)=${MASTER_CHANNEL(CHANNEL(language))})
2514.

2515.
exten => h,1,Macro(hangupcall,)
2516.

2517.
;--== end of [macro-user-callerid] ==--;
2518.

2519.

2520.
[macro-outbound-callerid]
2521.
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
2522.
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
2523.
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = ""] | $["${KEEPCID}" != "TRUE"] | $["${OUTKEEPCID_${ARG1}}" = "on"] ]?normcid)
2524.
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
2525.
exten => s,n,GotoIf($["foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = "foo"]?bypass)
2526.
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
2527.
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
2528.
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
2529.
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = "" | "${EMERGENCYCID:1:2}" = ""]?trunkcid)
2530.
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
2531.
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
2532.
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
2533.
exten => s,n(exit),MacroExit()
2534.
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(all)=${TRUNKOUTCID}))
2535.
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(all)=${USEROUTCID}))
2536.
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}))
2537.
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))
2538.
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
2539.
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
2540.

2541.
;--== end of [macro-outbound-callerid] ==--;
2542.

2543.

2544.
[from-zaptel]
2545.
include => from-dahdi
2546.
exten => foo,1,Noop(bar)
2547.

2548.
;--== end of [from-zaptel] ==--;
2549.

2550.

2551.
[from-dahdi]
2552.
exten => _X.,1,Set(DID=${EXTEN})
2553.
exten => _X.,n,Goto(s,1)
2554.

2555.
exten => s,1,Noop(Entering from-dahdi with DID == ${DID})
2556.
exten => s,n,Ringing()
2557.
exten => s,n,Set(DID=${IF($["${DID}"= ""]?s:${DID})})
2558.
exten => s,n,Noop(DID is now ${DID})
2559.
exten => s,n,GotoIf($["${CHANNEL:0:5}"="DAHDI"]?dahdiok:checkzap)
2560.
exten => s,n(checkzap),GotoIf($["${CHANNEL:0:3}"="Zap"]?zapok:neither)
2561.
exten => s,n(neither),Goto(from-pstn,${DID},1)
2562.
exten => s,n,Macro(Hangupcall,dummy)
2563.
exten => s,n(dahdiok),Noop(Is a DAHDi Channel)
2564.
exten => s,n,Set(CHAN=${CHANNEL:6})
2565.
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
2566.
exten => s,n,Macro(from-dahdi-${CHAN},${DID},1)
2567.
exten => s,n,Noop(Returned from Macro from-dahdi-${CHAN})
2568.
exten => s,n,Goto(from-pstn,${DID},1)
2569.
exten => s,n(zapok),Noop(Is a Zaptel Channel)
2570.
exten => s,n,Set(CHAN=${CHANNEL:4})
2571.
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
2572.
exten => s,n,Macro(from-dahdi-${CHAN},${DID},1)
2573.
exten => s,n,Noop(Returned from Macro from-dahdi-${CHAN})
2574.
exten => s,n,Goto(from-pstn,${DID},1)
2575.

2576.
;--== end of [from-dahdi] ==--;
2577.

2578.

2579.
[macro-dial-confirm]
2580.
exten => s,1,Set(DB(RG/${ARG4}/${CHANNEL})=RINGING)
2581.
exten => s,n,Set(__UNIQCHAN=${CHANNEL})
2582.
exten => s,n,Set(USE_CONFIRMATION=TRUE)
2583.
exten => s,n,Set(RINGGROUP_INDEX=${ARG4})
2584.
exten => s,n,Set(FORCE_CONFIRM=)
2585.
exten => s,n,Set(ARG4=)
2586.
exten => s,n,Macro(dial,${ARG1},${ARG2},${ARG3})
2587.
exten => s,n,Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})})
2588.
exten => s,n,Set(USE_CONFIRMATION=)
2589.
exten => s,n,Set(RINGGROUP_INDEX=)
2590.

2591.
;--== end of [macro-dial-confirm] ==--;
2592.

2593.

2594.
[macro-setmusic]
2595.
exten => s,1,Set(CHANNEL(musicclass)=${ARG1})
2596.

2597.
;--== end of [macro-setmusic] ==--;
2598.

2599.

2600.
[macro-block-cf]
2601.
exten => _X.,1,Hangup
2602.

2603.
exten => s-ANSWER,1,Noop(Call successfully answered - Hanging up now)
2604.
exten => s-ANSWER,n,Macro(hangupcall,)
2605.

2606.
;--== end of [macro-block-cf] ==--;
2607.

2608.

2609.
[macro-vm]
2610.
exten => s,1,Macro(user-callerid,SKIPTTL)
2611.
exten => s,n,Set(VMGAIN=${IF($["foo${VM_GAIN}"!="foo"]?"g(${VM_GAIN})": )})
2612.
exten => s,n,Macro(blkvm-check,)
2613.
exten => s,n,GotoIf($["${GOSUB_RETVAL}" != "TRUE"]?vmx,1)
2614.
exten => s,n,Hangup
2615.

2616.
exten => vmx,1,Set(MEXTEN=${ARG1})
2617.
exten => vmx,n,Set(MMODE=${ARG2})
2618.
exten => vmx,n,Set(RETVM=${ARG3})
2619.
exten => vmx,n,Set(MODE=${IF($["${MMODE}"="BUSY"]?busy:unavail)})
2620.
exten => vmx,n,Macro(get-vmcontext,${MEXTEN})
2621.
exten => vmx,n,Set(MODE=${IF($[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${MEXTEN}/temp.wav)} = 1) || (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${MEXTEN}/temp.WAV)} = 1)]?temp:${MODE})})
2622.
exten => vmx,n,Noop(MODE IS: ${MODE})
2623.
exten => vmx,n,GotoIf($["${DB(AMPUSER/${MEXTEN}/vmx/${MODE}/state)}" != "enabled"]?chknomsg)
2624.
exten => vmx,n,Set(VM_OPTS=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/vmxopts/timeout)}" = "1"]?${DB_RESULT}:${VM_OPTS})})
2625.
exten => vmx,n(chknomsg),GotoIf($["${MMODE}"="NOMESSAGE"]?s-${MMODE},1)
2626.
exten => vmx,n,GotoIf($["${MMODE}" != "DIRECTDIAL"]?notdirect)
2627.
exten => vmx,n,Set(MODE=${IF($["${REGEX("[b]" ${VM_DDTYPE})}" = "1"]?busy:${MODE})})
2628.
exten => vmx,n(notdirect),Noop(Checking if ext ${MEXTEN} is enabled: ${DB(AMPUSER/${MEXTEN}/vmx/${MODE}/state)})
2629.
exten => vmx,n,GotoIf($["${DB(AMPUSER/${MEXTEN}/vmx/${MODE}/state)}" != "enabled"]?s-${MMODE},1)
2630.
exten => vmx,n,GotoIf($[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${MEXTEN}/${MODE}.wav)} = 0) && (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${MEXTEN}/${MODE}.WAV)} = 0)]?nofile)
2631.
exten => vmx,n,Set(VMX_TIMEOUT=2)
2632.
exten => vmx,n,Set(VMX_REPEAT=1)
2633.
exten => vmx,n,Set(VMX_LOOPS=1)
2634.
exten => vmx,n,Set(LOOPCOUNT=0)
2635.
exten => vmx,n,Set(VMX_REPEAT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/repeat)}" = "1"]?${DB_RESULT}:${VMX_REPEAT})})
2636.
exten => vmx,n(vmxtime),Set(VMX_TIMEOUT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/timeout)}" = "1"]?${DB_RESULT}:${VMX_TIMEOUT})})
2637.
exten => vmx,n(vmxloops),Set(VMX_LOOPS=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/loops)}" = "1"]?${DB_RESULT}:${VMX_LOOPS})})
2638.
exten => vmx,n(vmxanswer),Answer
2639.
exten => vmx,n(loopstart),Read(ACTION,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${MEXTEN}/${MODE},1,skip,${VMX_REPEAT},${VMX_TIMEOUT})
2640.
exten => vmx,n,GotoIf($["${EXISTS(${ACTION})}" = "1"]?checkopt)
2641.
exten => vmx,n(noopt),Noop(Timeout: going to timeout dest)
2642.
exten => vmx,n,Set(VMX_OPTS=${DB(AMPUSER/${MEXTEN}/vmx/${MODE}/vmxopts/timeout)})
2643.
exten => vmx,n(chktime),GotoIf($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/timedest/ext)}" = "0"]?dotime)
2644.
exten => vmx,n,Set(VMX_TIMEDEST_EXT=${DB_RESULT})
2645.
exten => vmx,n,Set(VMX_TIMEDEST_CONTEXT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/timedest/context)}" = "1"]?${DB_RESULT}:${VMX_TIMEDEST_CONTEXT})})
2646.
exten => vmx,n(timepri),Set(VMX_TIMEDEST_PRI=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/timedest/pri)}" = "1"]?${DB_RESULT}:${VMX_TIMEDEST_PRI})})
2647.
exten => vmx,n(dotime),Goto(${VMX_TIMEDEST_CONTEXT},${VMX_TIMEDEST_EXT},${VMX_TIMEDEST_PRI})
2648.
exten => vmx,n(checkopt),GotoIf($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/${ACTION}/ext)}" = "1"]?doopt)
2649.
exten => vmx,n,GotoIf($["${ACTION}" = "0"]?o,1)
2650.
exten => vmx,n,GotoIf($["${ACTION}" = "*"]?adef,1)
2651.
exten => vmx,n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
2652.
exten => vmx,n,GotoIf($["${LOOPCOUNT}" > "${VMX_LOOPS}"]?toomany)
2653.
exten => vmx,n,Playback(pm-invalid-option&please-try-again)
2654.
exten => vmx,n,Goto(loopstart)
2655.
exten => vmx,n(toomany),Noop(Too Many invalid entries, got to invalid dest)
2656.
exten => vmx,n,Set(VMX_OPTS=${VMX_OPTS_LOOP})
2657.
exten => vmx,n,Set(VMX_OPTS=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/vmxopts/loops)}" = "1"]?${DB_RESULT}:${VMX_OPTS})})
2658.
exten => vmx,n(chkloop),GotoIf($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/loopdest/ext)}" = "0"]?doloop)
2659.
exten => vmx,n,Set(VMX_LOOPDEST_EXT=${DB_RESULT})
2660.
exten => vmx,n,Set(VMX_LOOPDEST_CONTEXT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/loopdest/context)}" = "1"]?${DB_RESULT}:${VMX_LOOPDEST_CONTEXT})})
2661.
exten => vmx,n(looppri),Set(VMX_LOOPDEST_PRI=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/loopdest/pri)}" = "1"]?${DB_RESULT}:${VMX_LOOPDEST_PRI})})
2662.
exten => vmx,n(doloop),Goto(${VMX_LOOPDEST_CONTEXT},${VMX_LOOPDEST_EXT},${VMX_LOOPDEST_PRI})
2663.
exten => vmx,n(doopt),Noop(Got a valid option: ${DB_RESULT})
2664.
exten => vmx,n,Set(VMX_EXT=${DB_RESULT})
2665.
exten => vmx,n,GotoIf($["${VMX_EXT}" != "dovm"]?getdest)
2666.
exten => vmx,n(vmxopts),Set(VMX_OPTS=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/vmxopts/dovm)}" = "1"]?${DB_RESULT}:${VMX_OPTS_DOVM})})
2667.
exten => vmx,n(vmxdovm),Goto(dovm,1)
2668.
exten => vmx,n(getdest),Set(VMX_CONTEXT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/${ACTION}/context)}" = "1"]?${DB_RESULT}:${VMX_CONTEXT})})
2669.
exten => vmx,n(vmxpri),Set(VMX_PRI=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/${ACTION}/pri)}" = "1"]?${DB_RESULT}:${VMX_PRI})})
2670.
exten => vmx,n(vmxgoto),Goto(${VMX_CONTEXT},${VMX_EXT},${VMX_PRI})
2671.
exten => vmx,n(nofile),Noop(File for mode: ${MODE} does not exist, SYSTEMSTATUS: ${SYSTEMSTATUS}, going to normal voicemail)
2672.
exten => vmx,n,Goto(s-${MMODE},1)
2673.
exten => vmx,n(tmpgreet),Noop(Temporary Greeting Detected, going to normal voicemail)
2674.
exten => vmx,n,Goto(s-${MMODE},1)
2675.

2676.
exten => dovm,1,Noop(VMX Timeout - go to voicemail)
2677.
exten => dovm,n,VoiceMail(${MEXTEN}@${VMCONTEXT},${VMX_OPTS}${VMGAIN})
2678.
exten => dovm,n,Goto(exit-${VMSTATUS},1)
2679.

2680.
exten => s-BUSY,1,Noop(BUSY voicemail)
2681.
exten => s-BUSY,n,Macro(get-vmcontext,${MEXTEN})
2682.
exten => s-BUSY,n,VoiceMail(${MEXTEN}@${VMCONTEXT},${VM_OPTS}b${VMGAIN})
2683.
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)
2684.

2685.
exten => s-NOMESSAGE,1,Noop(NOMESSAGE (beep only) voicemail)
2686.
exten => s-NOMESSAGE,n,Macro(get-vmcontext,${MEXTEN})
2687.
exten => s-NOMESSAGE,n,VoiceMail(${MEXTEN}@${VMCONTEXT},s${VM_OPTS}${VMGAIN})
2688.
exten => s-NOMESSAGE,n,Goto(exit-${VMSTATUS},1)
2689.

2690.
exten => s-INSTRUCT,1,Noop(NOMESSAGE (beeb only) voicemail)
2691.
exten => s-INSTRUCT,n,Macro(get-vmcontext,${MEXTEN})
2692.
exten => s-INSTRUCT,n,VoiceMail(${MEXTEN}@${VMCONTEXT},${VM_OPTS}${VMGAIN})
2693.
exten => s-INSTRUCT,n,Goto(exit-${VMSTATUS},1)
2694.

2695.
exten => s-DIRECTDIAL,1,Noop(DIRECTDIAL voicemail)
2696.
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${MEXTEN})
2697.
exten => s-DIRECTDIAL,n,VoiceMail(${MEXTEN}@${VMCONTEXT},${VM_OPTS}${VM_DDTYPE}${VMGAIN})
2698.
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)
2699.

2700.
exten => _s-.,1,Macro(get-vmcontext,${MEXTEN})
2701.
exten => _s-.,n,VoiceMail(${MEXTEN}@${VMCONTEXT},${VM_OPTS}u${VMGAIN})
2702.
exten => _s-.,n,Goto(exit-${VMSTATUS},1)
2703.

2704.
exten => o,1,Playback(one-moment-please)
2705.
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/0/ext)}" = "0"]?doopdef)
2706.
exten => o,n,Set(VMX_OPDEST_EXT=${DB_RESULT})
2707.
exten => o,n(opcontext),Set(VMX_OPDEST_CONTEXT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/0/context)}" = "1"]?${DB_RESULT}:${VMX_CONTEXT})})
2708.
exten => o,n(oppri),Set(VMX_OPDEST_PRI=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/0/pri)}" = "1"]?${DB_RESULT}:${VMX_PRI})})
2709.
exten => o,n,Goto(${VMX_OPDEST_CONTEXT},${VMX_OPDEST_EXT},${VMX_OPDEST_PRI})
2710.
exten => o,n(doopdef),GotoIf($["x${OPERATOR_XTN}"="x"]?nooper:from-internal,${OPERATOR_XTN},1)
2711.
exten => o,n(nooper),GotoIf($["x${FROM_DID}"="x"]?nodid)
2712.
exten => o,n,Dial(Local/${FROM_DID}@from-pstn,)
2713.
exten => o,n,Macro(hangup,)
2714.
exten => o,n(nodid),Dial(Local/s@from-pstn,)
2715.
exten => o,n,Macro(hangup,)
2716.

2717.
exten => a,1,Macro(get-vmcontext,${MEXTEN})
2718.
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/*/ext)}" = "0"]?adef,1)
2719.
exten => a,n,Set(VMX_ADEST_EXT=${DB_RESULT})
2720.
exten => a,n(acontext),Set(VMX_ADEST_CONTEXT=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/*/context)}" = "1"]?${DB_RESULT}:${VMX_CONTEXT})})
2721.
exten => a,n(apri),Set(VMX_ADEST_PRI=${IF($["${DB_EXISTS(AMPUSER/${MEXTEN}/vmx/${MODE}/*/pri)}" = "1"]?${DB_RESULT}:${VMX_PRI})})
2722.
exten => a,n,Goto(${VMX_ADEST_CONTEXT},${VMX_ADEST_EXT},${VMX_ADEST_PRI})
2723.

2724.
exten => adef,1,VoiceMailMain(${MEXTEN}@${VMCONTEXT})
2725.
exten => adef,n,GotoIf($["${RETVM}" = "RETURN"]?exit-RETURN,1)
2726.
exten => adef,n,Hangup
2727.

2728.
exten => exit-FAILED,1,Playback(im-sorry&an-error-has-occurred)
2729.
exten => exit-FAILED,n,GotoIf($["${RETVM}" = "RETURN"]?exit-RETURN,1)
2730.
exten => exit-FAILED,n,Hangup
2731.

2732.
exten => exit-SUCCESS,1,GotoIf($["${RETVM}" = "RETURN"]?exit-RETURN,1)
2733.
exten => exit-SUCCESS,n,Playback(goodbye)
2734.
exten => exit-SUCCESS,n,Hangup
2735.

2736.
exten => exit-USEREXIT,1,GotoIf($["${RETVM}" = "RETURN"]?exit-RETURN,1)
2737.
exten => exit-USEREXIT,n,Playback(goodbye)
2738.
exten => exit-USEREXIT,n,Hangup
2739.

2740.
exten => exit-RETURN,1,Noop(Returning From Voicemail because macro)
2741.

2742.
exten => t,1,Hangup
2743.

2744.
;--== end of [macro-vm] ==--;
2745.

2746.

2747.
[macro-exten-vm]
2748.
exten => s,1,Macro(user-callerid,)
2749.
exten => s,n,Set(RingGroupMethod=none)
2750.
exten => s,n,Set(__EXTTOCALL=${ARG2})
2751.
exten => s,n,Set(__PICKUPMARK=${ARG2})
2752.
exten => s,n,Set(RT=${IF($["${ARG1}"!="novm" | "${DB(CFU/${EXTTOCALL})}"!="" | "${DB(CFB/${EXTTOCALL})}"!="" | "${ARG3}"="1" | "${ARG4}"="1" | "${ARG5}"="1"]?${RINGTIMER}:)})
2753.
exten => s,n,ExecIf($[$["${REDIRECTING(reason)}" = "send_to_vm" | "${SIP_HEADER(X-Digium-Call-Feature)}" = "feature_send_to_vm"] & "${ARG1}" != "novm"]?Macro(vm,${ARG1},DIRECTDIAL,${IVR_RETVM}))
2754.
exten => s,n,ExecIf($[$["${REDIRECTING(reason)}" = "send_to_vm" | "${SIP_HEADER(X-Digium-Call-Feature)}" = "feature_send_to_vm"] & "${ARG1}" != "novm"]?MacroExit())
2755.
exten => s,n(checkrecord),Gosub(sub-record-check,s,1(exten,${EXTTOCALL},dontcare))
2756.
exten => s,n,GotoIf($["${AMPUSER}"=""|${LEN(${FROM_DID})}|"${DB(AMPUSER/${EXTTOCALL}/answermode)}"!="intercom"|${LEN(${BLINDTRANSFER})}|"${EXTENSION_STATE(${EXTTOCALL})}"!="NOT_INUSE"|"${CC_RECALL}"!=""]?macrodial)
2757.
exten => s,n,Set(INTERCOM_EXT_DOPTIONS=${DIAL_OPTIONS})
2758.
exten => s,n,Set(INTERCOM_RETURN=TRUE)
2759.
exten => s,n,Gosub(ext-intercom,*80${EXTTOCALL},1())
2760.
exten => s,n,Set(INTERCOM_RETURN=)
2761.
exten => s,n,Set(INTERCOM_EXT_DOPTIONS=)
2762.
exten => s,n(macrodial),GosubIf($["${INTERCOM_CALL}"="TRUE" & ${LEN(${BLINDTRANSFER})}]?clrheader,1())
2763.
exten => s,n,Macro(dial-one,${RT},${DIAL_OPTIONS},${EXTTOCALL})
2764.
exten => s,n,Set(SV_DIALSTATUS=${DIALSTATUS})
2765.
exten => s,n(calldocfu),GosubIf($[("${SV_DIALSTATUS}"="NOANSWER"|"${SV_DIALSTATUS}"="CHANUNAVAIL") & "${DB(CFU/${EXTTOCALL})}"!="" & "${SCREEN}"=""]?docfu,1())
2766.
exten => s,n(calldocfb),GosubIf($["${SV_DIALSTATUS}"="BUSY" & "${DB(CFB/${EXTTOCALL})}"!="" & "${SCREEN}"=""]?docfb,1())
2767.
exten => s,n,Set(DIALSTATUS=${SV_DIALSTATUS})
2768.
exten => s,n,ExecIf($[("${DIALSTATUS}"="NOANSWER"&"${ARG3}"="1")|("${DIALSTATUS}"="BUSY"&"${ARG4}"="1")|("${DIALSTATUS}"="CHANUNAVAIL"&"${ARG5}"="1")]?MacroExit())
2769.
exten => s,n,GotoIf($["${ARG1}"="novm"]?s-${DIALSTATUS},1)
2770.
exten => s,n,Macro(vm,${ARG1},${DIALSTATUS},${IVR_RETVM})
2771.

2772.
exten => docfu,1(docfu),ExecIf($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="-1"|("${ARG1}"="novm"&"${ARG3}"="1")]?StackPop())
2773.
exten => docfu,n,GotoIf($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="-1"|("${ARG1}"="novm"&"${ARG3}"="1")]?from-internal,${DB(CFU/${EXTTOCALL})},1)
2774.
exten => docfu,n,Set(RTCF=${IF($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="0"]?${RT}:${DB(AMPUSER/${EXTTOCALL}/cfringtimer)})})
2775.
exten => docfu,n,ExecIf($["${DIRECTION}" = "INBOUND"]?Set(DIAL_OPTIONS=${REPLACE(DIAL_OPTIONS,T)}I))
2776.
exten => docfu,n,Dial(Local/${DB(CFU/${EXTTOCALL})}@from-internal/n,${RTCF},${DIAL_OPTIONS})
2777.
exten => docfu,n,Return()
2778.

2779.
exten => docfb,1(docfu),ExecIf($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="-1"|("${ARG1}"="novm"&"${ARG4}"="1")]?StackPop())
2780.
exten => docfb,n,GotoIf($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="-1"|("${ARG1}"="novm"&"${ARG4}"="1")]?from-internal,${DB(CFB/${EXTTOCALL})},1)
2781.
exten => docfb,n,Set(RTCF=${IF($["${DB(AMPUSER/${EXTTOCALL}/cfringtimer)}"="0"]?${RT}:${DB(AMPUSER/${EXTTOCALL}/cfringtimer)})})
2782.
exten => docfb,n,ExecIf($["${DIRECTION}" = "INBOUND"]?Set(DIAL_OPTIONS=${REPLACE(DIAL_OPTIONS,T)}I))
2783.
exten => docfb,n,Dial(Local/${DB(CFB/${EXTTOCALL})}@from-internal/n,${RTCF},${DIAL_OPTIONS})
2784.
exten => docfb,n,Return()
2785.

2786.
exten => clrheader,1,ExecIf($[${LEN(${SIPURI})}&"${SIPURI}"="${SIP_URI_OPTIONS}"]?Set(SIP_URI_OPTIONS=))
2787.
exten => clrheader,n,ExecIf($[${LEN(${ALERTINFO})}]?SIPRemoveHeader(${ALERTINFO}))
2788.
exten => clrheader,n,ExecIf($[${LEN(${CALLINFO})}]?SIPRemoveHeader(${CALLINFO}))
2789.
exten => clrheader,n,Return()
2790.

2791.
exten => s-BUSY,1,GotoIf($["${IVR_RETVM}"="RETURN" & "${IVR_CONTEXT}"!=""]?exit,1)
2792.
exten => s-BUSY,n,Playtones(busy)
2793.
exten => s-BUSY,n,Busy(20)
2794.

2795.
exten => _s-!,1,GotoIf($["${IVR_RETVM}"="RETURN" & "${IVR_CONTEXT}"!=""]?exit,1)
2796.
exten => _s-!,n,Playtones(congestion)
2797.
exten => _s-!,n,Congestion(10)
2798.

2799.
exten => exit,1,Playback(beep&line-busy-transfer-menu&silence/1)
2800.
exten => exit,n,MacroExit()
2801.

2802.
;--== end of [macro-exten-vm] ==--;
2803.

2804.

2805.
[macro-simple-dial]
2806.
exten => s,1,Set(__EXTTOCALL=${ARG1})
2807.
exten => s,n,Set(RT=${ARG2})
2808.
exten => s,n,Set(CFUEXT=${DB(CFU/${EXTTOCALL})})
2809.
exten => s,n,Set(CFBEXT=${DB(CFB/${EXTTOCALL})})
2810.
exten => s,n,Set(CWI_TMP=${CWIGNORE})
2811.
exten => s,n(macrodial),Macro(dial-one,${RT},${DIAL_OPTIONS},${EXTTOCALL})
2812.
exten => s,n,Set(__CWIGNORE=${CWI_TMP})
2813.
exten => s,n,Set(PR_DIALSTATUS=${DIALSTATUS})
2814.
exten => s,n(calldocfu),GosubIf($["${PR_DIALSTATUS}"="NOANSWER" & "${CFUEXT}"!=""]?docfu,1())
2815.
exten => s,n(calldocfb),GosubIf($["${PR_DIALSTATUS}"="BUSY" & "${CFBEXT}"!=""]?docfb,1())
2816.
exten => s,n,Set(DIALSTATUS=${PR_DIALSTATUS})
2817.
exten => s,n,Goto(s-${DIALSTATUS},1)
2818.

2819.
exten => docfu,1,GotoIf($["${DB(AMPUSER/${CFUEXT}/device)}" = "" ]?chlocal)
2820.
exten => docfu,n,Dial(Local/${CFUEXT}@ext-local,${RT},${DIAL_OPTIONS})
2821.
exten => docfu,n,Return()
2822.
exten => docfu,n(chlocal),ExecIf($["${DIRECTION}" = "INBOUND"]?Set(DIAL_OPTIONS=${REPLACE(DIAL_OPTIONS,T)}I))
2823.
exten => docfu,n,Dial(Local/${CFUEXT}@from-internal/n,${RT},${DIAL_OPTIONS})
2824.
exten => docfu,n,Return()
2825.

2826.
exten => docfb,1,GotoIf($["${DB(AMPUSER/${CFBEXT}/device)}" = "" ]?chlocal)
2827.
exten => docfb,n,Dial(Local/${CFBEXT}@ext-local,${RT},${DIAL_OPTIONS})
2828.
exten => docfb,n,Return()
2829.
exten => docfb,n(chlocal),ExecIf($["${DIRECTION}" = "INBOUND"]?Set(DIAL_OPTIONS=${REPLACE(DIAL_OPTIONS,T)}I))
2830.
exten => docfb,n,Dial(Local/${CFBEXT}@from-internal/n,${RT},${DIAL_OPTIONS})
2831.
exten => docfb,n,Return()
2832.

2833.
exten => _s-.,1,Noop(Extension is reporting ${EXTEN})
2834.

2835.
;--== end of [macro-simple-dial] ==--;
2836.

2837.

2838.
[macro-blkvm-setifempty]
2839.
exten => s,1,GotoIf($[!${EXISTS(${BLKVM_CHANNEL})}]?init)
2840.
exten => s,n,Set(GOSUB_RETVAL=${SHARED(BLKVM,${BLKVM_CHANNEL})})
2841.
exten => s,n,MacroExit()
2842.
exten => s,n(init),Set(__BLKVM_CHANNEL=${CHANNEL})
2843.
exten => s,n,Set(SHARED(BLKVM,${BLKVM_CHANNEL})=TRUE)
2844.
exten => s,n,Set(GOSUB_RETVAL=TRUE)
2845.
exten => s,n,MacroExit()
2846.

2847.
;--== end of [macro-blkvm-setifempty] ==--;
2848.

2849.

2850.
[macro-blkvm-set]
2851.
exten => s,1,ExecIf($[!${EXISTS(${BLKVM_CHANNEL})} | "{ARG1}" = "reset"]?Set(__BLKVM_CHANNEL=${CHANNEL}))
2852.
exten => s,n,Set(SHARED(BLKVM,${BLKVM_CHANNEL})=TRUE)
2853.
exten => s,n,Set(GOSUB_RETVAL=TRUE)
2854.
exten => s,n,MacroExit()
2855.

2856.
;--== end of [macro-blkvm-set] ==--;
2857.

2858.

2859.
[macro-blkvm-clr]
2860.
exten => s,1,Set(SHARED(BLKVM,${BLKVM_CHANNEL})=)
2861.
exten => s,n,Set(GOSUB_RETVAL=)
2862.
exten => s,n,MacroExit()
2863.

2864.
;--== end of [macro-blkvm-clr] ==--;
2865.

2866.

2867.
[macro-blkvm-check]
2868.
exten => s,1,Set(GOSUB_RETVAL=${SHARED(BLKVM,${BLKVM_CHANNEL})})
2869.
exten => s,n,ExecIf($["${GOSUB_RETVAL}"="" & "${CC_RECALL}"="1"]?Set(GOSUB_RETVAL=TRUE))
2870.
exten => s,n,MacroExit()
2871.

2872.
;--== end of [macro-blkvm-check] ==--;
2873.

2874.

2875.
[macro-hangupcall]
2876.
exten => s,1(start),GotoIf($["${USE_CONFIRMATION}"="" | "${RINGGROUP_INDEX}"="" | "${CHANNEL}"!="${UNIQCHAN}"]?theend)
2877.
exten => s,n(delrgi),Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})})
2878.
exten => s,n(theend),Hangup
2879.
exten => s,n,MacroExit()
2880.

2881.
;--== end of [macro-hangupcall] ==--;
2882.

2883.

2884.
[macro-dial-one]
2885.
exten => s,1,Set(DEXTEN=${ARG3})
2886.
exten => s,n,Set(DIALSTATUS_CW=)
2887.
exten => s,n,GosubIf($["${FROM_DID}"!="" & "${SCREEN}"="" & "${DB(AMPUSER/${DEXTEN}/screen)}"!=""]?screen,1())
2888.
exten => s,n,GosubIf($["${DB(CF/${DEXTEN})}"!=""]?cf,1())
2889.
exten => s,n,GotoIf($["${DEXTEN:-1}"="#" | "${DB(DND/${DEXTEN})}"=""]?skip1)
2890.
exten => s,n,Set(DEXTEN=)
2891.
exten => s,n,Set(DIALSTATUS=BUSY)
2892.
exten => s,n(skip1),GotoIf($["${DEXTEN}"=""]?nodial)
2893.
exten => s,n,GotoIf($["${DEXTEN:-1}"="#"]?continue)
2894.
exten => s,n,Set(EXTHASCW=${IF($["${CWIGNORE}"!=""]? :${DB(CW/${DEXTEN})})})
2895.
exten => s,n,GotoIf($["${EXTHASCW}"="" | "${DB(CFB/${DEXTEN})}"!="" | "${DB(CFU/${DEXTEN})}"!=""]?next1:cwinusebusy)
2896.
exten => s,n(next1),GotoIf($["${DB(CFU/${DEXTEN})}"!="" & ("${EXTENSION_STATE(${DEXTEN})}"="UNAVAILABLE" | "${EXTENSION_STATE(${DEXTEN})}"="UNKNOWN")]?docfu:skip3)
2897.
exten => s,n(docfu),Set(DEXTEN=)
2898.
exten => s,n,Set(DIALSTATUS=NOANSWER)
2899.
exten => s,n,Goto(nodial)
2900.
exten => s,n(skip3),GotoIf($["${EXTHASCW}"="" | "${DB(CFB/${DEXTEN})}"!=""]?next2:continue)
2901.
exten => s,n(next2),GotoIf($["${EXTENSION_STATE(${DEXTEN})}"="NOT_INUSE" | "${EXTENSION_STATE(${DEXTEN})}"="UNAVAILABLE" | "${EXTENSION_STATE(${DEXTEN})}"="UNKNOWN"]?continue)
2902.
exten => s,n,ExecIf($["${DB(CFB/${DEXTEN})}"!="" & "${CFIGNORE}"=""]?Set(DIALSTATUS=BUSY))
2903.
exten => s,n,GotoIf($["${EXTHASCW}"!="" | "${DEXTEN:-1}"="#"]?cwinusebusy)
2904.
exten => s,n,Set(DEXTEN=)
2905.
exten => s,n,Set(DIALSTATUS=BUSY)
2906.
exten => s,n,Goto(nodial)
2907.
exten => s,n(cwinusebusy),GotoIf($["${EXTHASCW}"!="" & "${CWINUSEBUSY}"="true"]?next3:continue)
2908.
exten => s,n(next3),ExecIf($["${EXTENSION_STATE(${DEXTEN})}"!="UNAVAILABLE" & "${EXTENSION_STATE(${DEXTEN})}"!="NOT_INUSE" & "${EXTENSION_STATE(${DEXTEN})}"!="UNKNOWN"]?Set(DIALSTATUS_CW=BUSY))
2909.
exten => s,n(continue),GotoIf($["${DEXTEN}"=""]?nodial)
2910.
exten => s,n,GosubIf($["${DEXTEN:-1}"!="#"]?dstring,1():dlocal,1())
2911.
exten => s,n,GotoIf($[${LEN(${DSTRING})}=0]?nodial)
2912.
exten => s,n,GotoIf($["${DEXTEN:-1}"="#"]?skiptrace)
2913.
exten => s,n,GosubIf($[${REGEX("^[\+]?[0-9]+$" ${CALLERID(number)})} = 1]?ctset,1():ctclear,1())
2914.
exten => s,n(skiptrace),Set(D_OPTIONS=${IF($["${NODEST}"!="" & ${REGEX("(M[(]auto-blkvm[)])" ${ARG2})} != 1]?${ARG2}M(auto-blkvm):${ARG2})})
2915.
exten => s,n,ExecIf($["${ALERT_INFO}"!=""]?SIPAddHeader(Alert-Info: ${ALERT_INFO}))
2916.
exten => s,n,ExecIf($["${SIPADDHEADER}"!=""]?SIPAddHeader(${SIPADDHEADER}))
2917.
exten => s,n,ExecIf($["${MOHCLASS}"!=""]?Set(CHANNEL(musicclass)=${MOHCLASS}))
2918.
exten => s,n,GosubIf($["${QUEUEWAIT}"!=""]?qwait,1())
2919.
exten => s,n,Set(__CWIGNORE=${CWIGNORE})
2920.
exten => s,n,Set(__KEEPCID=TRUE)
2921.
exten => s,n,GotoIf($["${USEGOTO}"="1"]?usegoto,1)
2922.
exten => s,n,GotoIf($["${DB(AMPUSER/${EXTTOCALL}/cidname)}" = "" || "${DB(AMPUSER/${AMPUSER}/cidname)}" = ""]?godial)
2923.
exten => s,n,Gosub(sub-presencestate-display,s,1(${EXTTOCALL}))
2924.
exten => s,n,Set(CONNECTEDLINE(name,i)=${DB(AMPUSER/${EXTTOCALL}/cidname)}${PRESENCESTATE_DISPLAY})
2925.
exten => s,n,Set(CONNECTEDLINE(num)=${EXTTOCALL})
2926.
exten => s,n,Set(D_OPTIONS=${D_OPTIONS}I)
2927.
exten => s,n(godial),Macro(dialout-one-predial-hook,)
2928.
exten => s,n,ExecIf($["${DIRECTION}" = "INBOUND"]?Set(D_OPTIONS=${REPLACE(D_OPTIONS,T)}I))
2929.
exten => s,n,Dial(${DSTRING},${ARG1},${D_OPTIONS})
2930.
exten => s,n,ExecIf($["${DIALSTATUS}"="ANSWER" & "${CALLER_DEST}"!=""]?MacroExit())
2931.
exten => s,n,ExecIf($["${DIALSTATUS_CW}"!=""]?Set(DIALSTATUS=${DIALSTATUS_CW}))
2932.
exten => s,n,GosubIf($[("${SCREEN}"!=""&("${DIALSTATUS}"="TORTURE"|"${DIALSTATUS}"="DONTCALL"))|"${DIALSTATUS}"="ANSWER"]?s-${DIALSTATUS},1())
2933.
exten => s,n,MacroExit()
2934.
exten => s,n(nodial),ExecIf($["${DIALSTATUS}" = ""]?Set(DIALSTATUS=NOANSWER))
2935.
exten => s,n,Noop(Returned from dial-one with nothing to call and DIALSTATUS: ${DIALSTATUS})
2936.
exten => s,n,MacroExit()
2937.

2938.
exten => h,1,Macro(hangupcall,)
2939.

2940.
exten => usegoto,1,Set(USEGOTO=)
2941.
exten => usegoto,n,Goto(from-internal,${DSTRING},1)
2942.

2943.
exten => screen,1,GotoIf($["${DB(AMPUSER/${DEXTEN}/screen)}"!="nomemory" | "${CALLERID(number)}"=""]?memory)
2944.
exten => screen,n,ExecIf($[${REGEX("^[0-9a-zA-Z ]+$" ${CALLERID(number)})} = 1]?System(rm -f ${ASTVARLIBDIR}/sounds/priv-callerintros/${CALLERID(number)}.*))
2945.
exten => screen,n(memory),Set(__SCREEN=${DB(AMPUSER/${DEXTEN}/screen)})
2946.
exten => screen,n,Set(__SCREEN_EXTEN=${DEXTEN})
2947.
exten => screen,n,Set(ARG2=${ARG2}p)
2948.
exten => screen,n,Return()
2949.

2950.
exten => cf,1,Set(CFAMPUSER=${IF($["${AMPUSER}"=""]?${CALLERID(number)}:${AMPUSER})})
2951.
exten => cf,n,ExecIf($["${DB(CF/${DEXTEN})}"="${CFAMPUSER}" | "${DB(CF/${DEXTEN})}"="${REALCALLERIDNUM}" | "${CUT(CUT(BLINDTRANSFER,-,1),/,1)}" = "${DB(CF/${DEXTEN})}" | "${DEXTEN}"="${DB(CF/${DEXTEN})}"]?Return())
2952.
exten => cf,n,ExecIf($["${DB(AMPUSER/${DEXTEN}/cfringtimer)}" != "0" & "${DB(AMPUSER/${DEXTEN}/cfringtimer)}" != ""]?Set(ARG1=${IF($["${DB(AMPUSER/${DEXTEN}/cfringtimer)}"="-1"]? : ${DB(AMPUSER/${DEXTEN}/cfringtimer)})}))
2953.
exten => cf,n,Set(DEXTEN=${IF($["${CFIGNORE}"=""]?"${DB(CF/${DEXTEN})}#": )})
2954.
exten => cf,n,ExecIf($["${DEXTEN}"!=""]?Return())
2955.
exten => cf,n,Set(DIALSTATUS=NOANSWER)
2956.
exten => cf,n,Return()
2957.

2958.
exten => qwait,1,ExecIf($["${SAVEDCIDNAME}" = ""]?Set(__SAVEDCIDNAME=${CALLERID(name)}))
2959.
exten => qwait,n,Set(ELAPSED=${MATH($[${EPOCH}+30-${QUEUEWAIT}]/60,int)})
2960.
exten => qwait,n,Set(CALLERID(name)=M${ELAPSED}:${SAVEDCIDNAME})
2961.
exten => qwait,n,Return()
2962.

2963.
exten => ctset,1,Set(DB(CALLTRACE/${DEXTEN})=${CALLERID(number)})
2964.
exten => ctset,n,Return()
2965.

2966.
exten => ctclear,1,Noop(Deleting: CALLTRACE/${DEXTEN} ${DB_DELETE(CALLTRACE/${DEXTEN})})
2967.
exten => ctclear,n,Return()
2968.

2969.
exten => dstring,1,Set(DSTRING=)
2970.
exten => dstring,n,Set(DEVICES=${DB(AMPUSER/${DEXTEN}/device)})
2971.
exten => dstring,n,ExecIf($["${DEVICES}"=""]?Return())
2972.
exten => dstring,n,ExecIf($["${DEVICES:0:1}"="&"]?Set(DEVICES=${DEVICES:1}))
2973.
exten => dstring,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
2974.
exten => dstring,n,Set(ITER=1)
2975.
exten => dstring,n(begin),Set(THISDIAL=${DB(DEVICE/${CUT(DEVICES,&,${ITER})}/dial)})
2976.
exten => dstring,n,GosubIf($["${ASTCHANDAHDI}" = "1"]?zap2dahdi,1())
2977.
exten => dstring,n,GotoIf($["${THISDIAL:0:5}"!="PJSIP"]?doset)
2978.
exten => dstring,n,Noop(Debug: Found PJSIP Destination ${THISDIAL}, updating with PJSIP_DIAL_CONTACTS)
2979.
exten => dstring,n,Set(THISDIAL=${PJSIP_DIAL_CONTACTS(${THISDIAL:6})})
2980.
exten => dstring,n,GotoIf($["${THISDIAL}"=""]?skipset)
2981.
exten => dstring,n(doset),Set(DSTRING=${DSTRING}${THISDIAL}&)
2982.
exten => dstring,n(skipset),Set(ITER=$[${ITER}+1])
2983.
exten => dstring,n,GotoIf($[${ITER}<=${LOOPCNT}]?begin)
2984.
exten => dstring,n,ExecIf($["${DSTRING:-1}"!="&"]?Return())
2985.
exten => dstring,n,Set(DSTRING=${DSTRING:0:$[${LEN(${DSTRING})}-1]})
2986.
exten => dstring,n,Return()
2987.

2988.
exten => dlocal,1,Set(DSTRING=${IF($["${ARG1}"=""]?${DEXTEN:0:${MATH(${LEN(${DEXTEN})}-1,int)}}:Local/${DEXTEN:0:${MATH(${LEN(${DEXTEN})}-1,int)}}@from-internal/n)})
2989.
exten => dlocal,n,Set(USEGOTO=${IF($["${ARG1}"=""]?1:0)})
2990.
exten => dlocal,n,Return()
2991.

2992.
exten => zap2dahdi,1,ExecIf($["${THISDIAL}" = ""]?Return())
2993.
exten => zap2dahdi,n,Set(NEWDIAL=)
2994.
exten => zap2dahdi,n,Set(LOOPCNT2=${FIELDQTY(THISDIAL,&)})
2995.
exten => zap2dahdi,n,Set(ITER2=1)
2996.
exten => zap2dahdi,n(begin2),Set(THISPART2=${CUT(THISDIAL,&,${ITER2})})
2997.
exten => zap2dahdi,n,ExecIf($["${THISPART2:0:3}" = "ZAP"]?Set(THISPART2=DAHDI${THISPART2:3}))
2998.
exten => zap2dahdi,n,Set(NEWDIAL=${NEWDIAL}${THISPART2}&)
2999.
exten => zap2dahdi,n,Set(ITER2=$[${ITER2} + 1])
3000.
exten => zap2dahdi,n,GotoIf($[${ITER2} <= ${LOOPCNT2}]?begin2)
3001.
exten => zap2dahdi,n,Set(THISDIAL=${NEWDIAL:0:$[${LEN(${NEWDIAL})}-1]})
3002.
exten => zap2dahdi,n,Return()
3003.

3004.
exten => s-TORTURE,1,Goto(app-blackhole,musiconhold,1)
3005.
exten => s-TORTURE,n,Macro(hangupcall,)
3006.

3007.
exten => s-DONTCALL,1,Answer
3008.
exten => s-DONTCALL,n,Wait(1)
3009.
exten => s-DONTCALL,n,Zapateller()
3010.
exten => s-DONTCALL,n,Playback(ss-noservice)
3011.
exten => s-DONTCALL,n,Macro(hangupcall,)
3012.

3013.
exten => s-CHANUNAVAIL,1,Macro(vm,${SCREEN_EXTEN},BUSY,${IVR_RETVM})
3014.
exten => s-CHANUNAVAIL,n,ExecIf($["${IVR_RETVM}"!="RETURN" | "${IVR_CONTEXT}"=""]?Hangup())
3015.
exten => s-CHANUNAVAIL,n,Return()
3016.

3017.
exten => s-NOANSWER,1,Macro(vm,${SCREEN_EXTEN},BUSY,${IVR_RETVM})
3018.
exten => s-NOANSWER,n,ExecIf($["${IVR_RETVM}"!="RETURN" | "${IVR_CONTEXT}"=""]?Hangup())
3019.
exten => s-NOANSWER,n,Return()
3020.

3021.
exten => s-BUSY,1,Macro(vm,${SCREEN_EXTEN},BUSY,${IVR_RETVM})
3022.
exten => s-BUSY,n,ExecIf($["${IVR_RETVM}"!="RETURN" | "${IVR_CONTEXT}"=""]?Hangup())
3023.
exten => s-BUSY,n,Return()
3024.

3025.
;--== end of [macro-dial-one] ==--;
3026.

3027.

3028.
[sipstation-welcome]
3029.
exten => _X.,1,Set(ISNUM=${REGEX("[0-9]" ${CALLERID(number)})})
3030.
exten => _X.,n,Set(DB(sipstation/${EXTEN}/lastcall/cnum)=${CALLERID(number)})
3031.
exten => _X.,n,Set(DB(sipstation/${EXTEN}/lastcall/cnam)=${CALLERID(name)})
3032.
exten => _X.,n,Set(DB(sipstation/${EXTEN}/lastcall/time)=${EPOCH})
3033.
exten => _X.,n,Answer
3034.
exten => _X.,n,Wait(1)
3035.
exten => _X.,n,Playback(you-have-reached-a-test-number&silence/1)
3036.
exten => _X.,n,SayDigits(${EXTEN})
3037.
exten => _X.,n,Playback(your&calling&from&silence/1)
3038.
exten => _X.,n,GotoIf($["${ISNUM}" = "1"]?valid:notvalid)
3039.
exten => _X.,n(valid),SayDigits(${CALLERID(number)})
3040.
exten => _X.,n,Hangup
3041.
exten => _X.,n(notvalid),Playback(unavailable&number)
3042.
exten => _X.,n,Hangup
3043.

3044.
;--== end of [sipstation-welcome] ==--;
3045.

3046.

3047.
[from-internal-additional]
3048.
include => app-blacklist
3049.
include => app-cf-toggle
3050.
include => app-cf-unavailable-prompt-on
3051.
include => app-cf-busy-prompting-on
3052.
include => app-cf-prompting-on
3053.
include => app-cf-busy-off-any
3054.
include => app-cf-busy-off
3055.
include => app-cf-busy-on
3056.
include => app-cf-off-any
3057.
include => app-cf-off
3058.
include => app-cf-on
3059.
include => app-cf-unavailable-off
3060.
include => app-cf-unavailable-on
3061.
include => ext-cf-hints
3062.
include => app-callwaiting-cwoff
3063.
include => app-callwaiting-cwon
3064.
include => app-campon-toggle
3065.
include => app-campon-cancel
3066.
include => app-campon-request
3067.
include => ext-meetme
3068.
include => app-dictate-send
3069.
include => app-dictate-record
3070.
include => app-dnd-off
3071.
include => app-dnd-on
3072.
include => app-dnd-toggle
3073.
include => ext-dnd-hints
3074.
include => app-fax
3075.
include => app-fmf-toggle
3076.
include => ext-findmefollow
3077.
include => fmgrps
3078.
include => app-hotelwakeup
3079.
include => app-calltrace
3080.
include => app-speakextennum
3081.
include => app-speakingclock
3082.
include => app-echo-test
3083.
include => ext-intercom-users
3084.
include => park-hints
3085.
include => app-pbdirectory
3086.
include => ext-queues
3087.
include => app-recordings
3088.
include => ext-group
3089.
include => grps
3090.
include => app-speeddial
3091.
include => vmblast-grp
3092.
include => app-dialvm
3093.
include => app-vmmain
3094.
include => app-userlogonoff
3095.
include => ext-local-confirm
3096.
include => findmefollow-ringallv2
3097.
include => app-pickup
3098.
include => app-chanspy
3099.
include => ext-test
3100.
include => ext-local
3101.
include => outbound-allroutes
3102.
exten => h,1,Hangup
3103.

3104.
;--== end of [from-internal-additional] ==--;
3105.

3106.

3107.
[from-internal-noxfer-additional]
3108.
exten => h,1,Hangup
3109.

3110.
;--== end of [from-internal-noxfer-additional] ==--;
3111.

3112.

3113.
pjsip.aor.conf:
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.aor_custom.conf
10.

11.
[300]
12.
type=aor
13.
mailboxes=300@device
14.
max_contacts=1
15.
remove_existing=yes
16.
qualify_frequency=60
17.

18.
[Telekom]
19.
type=aor
20.
qualify_frequency=60
21.
contact=sip:+49{Telefonnummer Intern}@tel.t-online.de:5060
pjsip.auth.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.auth_custom.conf
10.

11.
[300-auth]
12.
type=auth
13.
auth_type=userpass
14.
password={password}
15.
username=300
16.

17.
[Telekom]
18.
type=auth
19.
auth_type=userpass
20.
password={password}
21.
username=0{Telefonnummer Intern}
pjsip.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip_custom.conf
10.
#include pjsip.transports.conf
11.
#include pjsip.transports_custom_post.conf
12.
#include pjsip.endpoint.conf
13.
#include pjsip.endpoint_custom_post.conf
14.
#include pjsip.aor.conf
15.
#include pjsip.aor_custom_post.conf
16.
#include pjsip.auth.conf
17.
#include pjsip.auth_custom_post.conf
18.
#include pjsip.registration.conf
19.
#include pjsip.registration_custom_post.conf
20.
#include pjsip.identify.conf
21.
#include pjsip.identify_custom_post.conf
22.

23.

24.
[global]
25.
type=global
26.
user_agent=FPBX-AsteriskNOW-12.0.76.4(13.9.1)
pjsip.endpoint.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.endpoint_custom.conf
10.

11.
[300]
12.
type=endpoint
13.
aors=300
14.
auth=300-auth
15.
allow=ulaw,alaw,gsm
16.
context=from-internal
17.
callerid=device <300>
18.
dtmf_mode=rfc4733
19.
use_avpf=no
20.
ice_support=no
21.
media_use_received_transport=no
22.
trust_id_inbound=yes
23.
media_encryption=no
24.
send_pai=yes
25.
rtp_symmetric=yes
26.
rewrite_contact=yes
27.

28.
[Telekom]
29.
type=endpoint
30.
transport=0.0.0.0-udp
31.
context=from-pstn
32.
disallow=all
33.
allow=ulaw,alaw,gsm
34.
outbound_auth=Telekom
35.
aors=Telekom
pjsip.identify.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.identify_custom.conf
10.

11.
[Telekom]
12.
type=identify
13.
endpoint=Telekom
14.
match=tel.t-online.de
pjsip.registration.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.registration_custom.conf
10.

11.
[Telekom]
12.
type=registration
13.
transport=0.0.0.0-udp
14.
outbound_auth=Telekom
15.
retry_interval=60
16.
max_retries=10
17.
expiration=3600
18.
auth_rejection_permanent=yes
19.
contact_user=0{Telefonnummer Intern}
20.
server_uri=sip:tel.t-online.de
21.
client_uri=sip:+49{Telefonnummer Intern}@tel.t-online.de:5060
pjsip.transports.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.
#include pjsip.transports_custom.conf
10.

11.
[0.0.0.0-udp]
12.
type=transport
13.
protocol=udp
14.
bind=0.0.0.0:5060
15.
external_media_address={Extern Netz}
16.
external_signaling_address={Extern Netz}
17.
local_net={Localnetz}/24
pjsip_notify.conf
01.
;--------------------------------------------------------------------------------;
02.
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
03.
;--------------------------------------------------------------------------------;
04.
; For information on adding additional paramaters to this file, please visit the ;
05.
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
06.
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
07.
; is totally deliberate.                                                         ;
08.
;--------------------------------------------------------------------------------;
09.

10.
#include sip_notify_custom.conf
11.
#include sip_notify_additional.conf

Vor diesem Versuch hatte ich Asterisk über Debian 8 installiert und konnte da nur max 1min telefonieren, rein und raus!!!
Es muss irgendetwas an der Config sein, ich habe auch keine Ahnung was.
Mitglied: LordGurke
26.10.2016 um 23:32 Uhr
Die Telekom lehnt den Anruf mit Q.850-Cause 21 ab - das heißt, der Anruf wird abgewiesen.
Weshalb, geht da leider nicht draus hervor (evtl. mal SIP-Debugging für den Telekom-Peer aktivieren?).
Für mich scheint der Fehler aber in der SIP-Konfiguration zu liegen, unter der Prämisse dass du überall wirklich deine korrekte Rufnummer übermittelst. Der Benutzername (aus "pjsip.auth.conf") ist nicht deine Telefonnummer sondern dein T-Online-Zugangsname inkl. "@t-online.de"-Suffix.
Und normalerweise will die Telekom die Rufnummer bei den SIP-Registrierungen im nationalen Format, nicht in E.164 haben, wie es manchmal als "client_uri=sip:+49{Telefonnummer Intern}@tel.t-online.de:5060" auftaucht. Hier solltest du mal probieren ob die Telekom hier evtl. das nationale Rufnummernformat (so funktioniert es bei mir) haben will, also nicht mit +49 sondern 0.

Am Rande:
Deaktiviere bitte möglichst flächendeckend bei dir alle Codecs außer alaw (G.711a) und G.722.
Andere Codecs unterstützt die Telekom offiziell nicht und außerdem wäre es schwachsinnig, wenn bei dir extra eine Codec-Konvertierung stattfinden müsste.

Dein Problem mit der Asterisk unter Debian 8 könnte eventuell auch gelöst werden:
Du musst zwingend unter SIP die Session-Timers aktivieren, sonst trennt die Telekom die Verbindung.
Zudem muss der SIP-Port den du verwendest zwingend auch Verbindungen von anderen als den gerade verbundenen IP-Adressen zulassen, falls du da eine Firewall vor stehen hast. Wichtig ist dabei, dass du einen anderen Port als 5060 verwendest, wenn du durch einen Router hindurch musst, der selber VoIP beherrschen könnte - FritzBoxen oder Speedports zum Beispiel knuppern dir sonst Pakete weg, die sie nicht zuordnen können.
Bitte warten ..
Mitglied: jeschero
27.10.2016, aktualisiert um 09:08 Uhr
Danke #LordGurke für deine schnelle Reaktion,

Die Ameldedaten habe ich wie in deinem Post geändert, er konnte keine Verbinung aufbauen.

Mit meiner vorherigen Config stellt er eine Verbindung her:
01.
[2016-10-27 08:43:32] VERBOSE[1788] res_pjsip/pjsip_configuration.c: Contact Telekom/sip:0{Telefonnumer intern}@tel.t-online.de:5060 is now Reachable. RTT: 30.964 msec
Bei den Telefonnumer habe ich alle +49 durch 0 ersetz, hat leider nicht geholfen.

PJSIP Debug beim raustelefonieren
01.
<--- Received SIP request (910 bytes) from UDP:{IP-Adresse CLient}:43453 --->
02.
INVITE sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP SIP/2.0
03.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---ffc91084846d57b2
04.
Max-Forwards: 70
05.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
06.
To: <sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP>
07.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=6d056449
08.
Call-ID: LEce9-SQBqE06SAWJ__9RQ..
09.
CSeq: 1 INVITE
10.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
11.
Content-Type: application/sdp
12.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
13.
User-Agent: Z 3.9.32144 r32121
14.
Allow-Events: presence, kpml
15.
Content-Length: 241
16.

17.
v=0
18.
o=Z 0 0 IN IP4 {IP-Adresse CLient}
19.
s=Z
20.
c=IN IP4 {IP-Adresse CLient}
21.
t=0 0
22.
m=audio 8000 RTP/AVP 3 110 8 0 97 101
23.
a=rtpmap:110 speex/8000
24.
a=rtpmap:97 iLBC/8000
25.
a=fmtp:97 mode=30
26.
a=rtpmap:101 telephone-event/8000
27.
a=fmtp:101 0-16
28.
a=sendrecv
29.

30.
<--- Transmitting SIP response (530 bytes) to UDP:{IP-Adresse CLient}:43453 --->
31.
SIP/2.0 401 Unauthorized
32.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---ffc91084846d57b2
33.
Call-ID: LEce9-SQBqE06SAWJ__9RQ..
34.
From: <sip:300@{IP-Adresse Server}>;tag=6d056449
35.
To: <sip:0{Telefonnummer Extern}@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---ffc91084846d57b2
36.
CSeq: 1 INVITE
37.
WWW-Authenticate: Digest  realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",opaque="45b9065f6d7ecf7b",algorithm=md5,qop="auth"
38.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
39.
Content-Length:  0
40.

41.

42.
<--- Received SIP request (955 bytes) from UDP:{IP-Adresse CLient}:43453 --->
43.
PUBLISH sip:300@{IP-Adresse Server};transport=UDP SIP/2.0
44.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---110b919aed99f915
45.
Max-Forwards: 70
46.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
47.
To: <sip:300@{IP-Adresse Server};transport=UDP>
48.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=d47c2465
49.
Call-ID: 9iPD73PIjQ0w0RJAG4gs1g..
50.
CSeq: 1 PUBLISH
51.
Expires: 600
52.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
53.
Content-Type: application/pidf+xml
54.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
55.
User-Agent: Z 3.9.32144 r32121
56.
Event: presence
57.
Allow-Events: presence, kpml
58.
Content-Length: 266
59.

60.
<?xml version="1.0" encoding="UTF-8"?>
61.
<presence xmlns="urn:ietf:params:xml:ns:pidf"
62.
          entity="sip:300@{IP-Adresse Server};transport=UDP">
63.
  <tuple id="300" >
64.
     <status><basic>open</basic></status>
65.
     <note>On the phone</note>
66.
  </tuple>
67.
</presence>
68.

69.
<--- Transmitting SIP response (522 bytes) to UDP:{IP-Adresse CLient}:43453 --->
70.
SIP/2.0 401 Unauthorized
71.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---110b919aed99f915
72.
Call-ID: 9iPD73PIjQ0w0RJAG4gs1g..
73.
From: <sip:300@{IP-Adresse Server}>;tag=d47c2465
74.
To: <sip:300@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---110b919aed99f915
75.
CSeq: 1 PUBLISH
76.
WWW-Authenticate: Digest  realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",opaque="12c5e51060b90e67",algorithm=md5,qop="auth"
77.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
78.
Content-Length:  0
79.

80.

81.
<--- Received SIP request (698 bytes) from UDP:{IP-Adresse CLient}:43453 --->
82.
SUBSCRIBE sip:300@{IP-Adresse Server};transport=UDP SIP/2.0
83.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---71374eebacae7916
84.
Max-Forwards: 70
85.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
86.
To: <sip:300@{IP-Adresse Server};transport=UDP>
87.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=c4775709
88.
Call-ID: BgHqHHbtC-tlJBIv2FAwaA..
89.
CSeq: 1 SUBSCRIBE
90.
Expires: 600
91.
Accept: application/watcherinfo+xml
92.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
93.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
94.
User-Agent: Z 3.9.32144 r32121
95.
Event: presence.winfo
96.
Allow-Events: presence, kpml
97.
Content-Length: 0
98.

99.

100.
<--- Transmitting SIP response (524 bytes) to UDP:{IP-Adresse CLient}:43453 --->
101.
SIP/2.0 401 Unauthorized
102.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---71374eebacae7916
103.
Call-ID: BgHqHHbtC-tlJBIv2FAwaA..
104.
From: <sip:300@{IP-Adresse Server}>;tag=c4775709
105.
To: <sip:300@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---71374eebacae7916
106.
CSeq: 1 SUBSCRIBE
107.
WWW-Authenticate: Digest  realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",opaque="369f9c4854418452",algorithm=md5,qop="auth"
108.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
109.
Content-Length:  0
110.

111.

112.
<--- Received SIP request (365 bytes) from UDP:{IP-Adresse CLient}:43453 --->
113.
ACK sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP SIP/2.0
114.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---ffc91084846d57b2
115.
Max-Forwards: 70
116.
To: <sip:0{Telefonnummer Extern}@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---ffc91084846d57b2
117.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=6d056449
118.
Call-ID: LEce9-SQBqE06SAWJ__9RQ..
119.
CSeq: 1 ACK
120.
Content-Length: 0
121.

122.

123.
<--- Received SIP request (1216 bytes) from UDP:{IP-Adresse CLient}:43453 --->
124.
INVITE sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP SIP/2.0
125.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---6fad305988c513f8
126.
Max-Forwards: 70
127.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
128.
To: <sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP>
129.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=6d056449
130.
Call-ID: LEce9-SQBqE06SAWJ__9RQ..
131.
CSeq: 2 INVITE
132.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
133.
Content-Type: application/sdp
134.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
135.
User-Agent: Z 3.9.32144 r32121
136.
Authorization: Digest username="300",realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",uri="sip:0{Telefonnummer Extern}@{IP-Adresse Server};transport=UDP",response="559663947244ca78856161dec94bdef8",cnonce="47248996ea124ff49af12d96ebb0e5f4",nc=00000001,qop=auth,algorithm=md5,opaque="45b9065f6d7ecf7b"
137.
Allow-Events: presence, kpml
138.
Content-Length: 241
139.

140.
v=0
141.
o=Z 0 0 IN IP4 {IP-Adresse CLient}
142.
s=Z
143.
c=IN IP4 {IP-Adresse CLient}
144.
t=0 0
145.
m=audio 8000 RTP/AVP 3 110 8 0 97 101
146.
a=rtpmap:110 speex/8000
147.
a=rtpmap:97 iLBC/8000
148.
a=fmtp:97 mode=30
149.
a=rtpmap:101 telephone-event/8000
150.
a=fmtp:101 0-16
151.
a=sendrecv
152.

153.
<--- Received SIP request (1252 bytes) from UDP:{IP-Adresse CLient}:43453 --->
154.
PUBLISH sip:300@{IP-Adresse Server};transport=UDP SIP/2.0
155.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---75822dd44c9c684f
156.
Max-Forwards: 70
157.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
158.
To: <sip:300@{IP-Adresse Server};transport=UDP>
159.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=d47c2465
160.
Call-ID: 9iPD73PIjQ0w0RJAG4gs1g..
161.
CSeq: 2 PUBLISH
162.
Expires: 600
163.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
164.
Content-Type: application/pidf+xml
165.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
166.
User-Agent: Z 3.9.32144 r32121
167.
Authorization: Digest username="300",realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",uri="sip:300@{IP-Adresse Server};transport=UDP",response="b80045db4ddb4ffe9ea7bac9ad2aac63",cnonce="640027d0f9647acfd3c05eb1386ef27a",nc=00000001,qop=auth,algorithm=md5,opaque="12c5e51060b90e67"
168.
Event: presence
169.
Allow-Events: presence, kpml
170.
Content-Length: 266
171.

172.
<?xml version="1.0" encoding="UTF-8"?>
173.
<presence xmlns="urn:ietf:params:xml:ns:pidf"
174.
          entity="sip:300@{IP-Adresse Server};transport=UDP">
175.
  <tuple id="300" >
176.
     <status><basic>open</basic></status>
177.
     <note>On the phone</note>
178.
  </tuple>
179.
</presence>
180.

181.
[2016-10-27 08:57:11] WARNING[2575]: res_pjsip_pubsub.c:3008 pubsub_on_rx_publish_request: No registered publish handler for event presence
182.
<--- Transmitting SIP response (372 bytes) to UDP:{IP-Adresse CLient}:43453 --->
183.
SIP/2.0 489 Bad Event
184.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---75822dd44c9c684f
185.
Call-ID: 9iPD73PIjQ0w0RJAG4gs1g..
186.
From: <sip:300@{IP-Adresse Server}>;tag=d47c2465
187.
To: <sip:300@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---75822dd44c9c684f
188.
CSeq: 2 PUBLISH
189.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
190.
Content-Length:  0
191.

192.

193.
<--- Received SIP request (995 bytes) from UDP:{IP-Adresse CLient}:43453 --->
194.
SUBSCRIBE sip:300@{IP-Adresse Server};transport=UDP SIP/2.0
195.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;branch=z9hG4bK-524287-1---82ffc4d2815b49d2
196.
Max-Forwards: 70
197.
Contact: <sip:300@{IP-Adresse CLient}:43453;transport=UDP>
198.
To: <sip:300@{IP-Adresse Server};transport=UDP>
199.
From: <sip:300@{IP-Adresse Server};transport=UDP>;tag=c4775709
200.
Call-ID: BgHqHHbtC-tlJBIv2FAwaA..
201.
CSeq: 2 SUBSCRIBE
202.
Expires: 600
203.
Accept: application/watcherinfo+xml
204.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
205.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
206.
User-Agent: Z 3.9.32144 r32121
207.
Authorization: Digest username="300",realm="asterisk",nonce="1477551431/a9c34fe1db7e0e02c2c66c5ecd566380",uri="sip:300@{IP-Adresse Server};transport=UDP",response="834de50892693b52bc26adad7b319d42",cnonce="a0f9efbb5e55c38150279b22e7e434d6",nc=00000001,qop=auth,algorithm=md5,opaque="369f9c4854418452"
208.
Event: presence.winfo
209.
Allow-Events: presence, kpml
210.
Content-Length: 0
211.

212.

213.
[2016-10-27 08:57:11] WARNING[2575]: res_pjsip_pubsub.c:625 subscription_get_handler_from_rdata: No registered subscribe handler for event presence.winfo
214.
<--- Transmitting SIP response (374 bytes) to UDP:{IP-Adresse CLient}:43453 --->
215.
SIP/2.0 489 Bad Event
216.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---82ffc4d2815b49d2
217.
Call-ID: BgHqHHbtC-tlJBIv2FAwaA..
218.
From: <sip:300@{IP-Adresse Server}>;tag=c4775709
219.
To: <sip:300@{IP-Adresse Server}>;tag=z9hG4bK-524287-1---82ffc4d2815b49d2
220.
CSeq: 2 SUBSCRIBE
221.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
222.
Content-Length:  0
223.

224.

225.
<--- Transmitting SIP response (337 bytes) to UDP:{IP-Adresse CLient}:43453 --->
226.
SIP/2.0 100 Trying
227.
Via: SIP/2.0/UDP {IP-Adresse CLient}:43453;rport=43453;received={IP-Adresse CLient};branch=z9hG4bK-524287-1---6fad305988c513f8
228.
Call-ID: LEce9-SQBqE06SAWJ__9RQ..
229.
From: <sip:300@{IP-Adresse Server}>;tag=6d056449
230.
To: <sip:0{Telefonnummer Extern}@{IP-Adresse Server}>
231.
CSeq: 2 INVITE
232.
Server: FPBX-AsteriskNOW-12.0.76.4(13.9.1)
233.
Content-Length:  0
234.

235.

236.
    -- Executing [0{Telefonnummer Extern}@from-internal:1] Macro("PJSIP/300-00000006", "user-callerid,LIMIT,EXTERNAL,") in new stack
237.
    -- Executing [s@macro-user-callerid:1] Set("PJSIP/300-00000006", "TOUCH_MONITOR=1477551431.30") in new stack
238.
    -- Executing [s@macro-user-callerid:2] Set("PJSIP/300-00000006", "AMPUSER=300") in new stack
239.
    -- Executing [s@macro-user-callerid:3] GotoIf("PJSIP/300-00000006", "0?report") in new stack
240.
    -- Executing [s@macro-user-callerid:4] ExecIf("PJSIP/300-00000006", "1?Set(REALCALLERIDNUM=300)") in new stack
241.
    -- Executing [s@macro-user-callerid:5] Set("PJSIP/300-00000006", "AMPUSER=300") in new stack
242.
    -- Executing [s@macro-user-callerid:6] GotoIf("PJSIP/300-00000006", "0?limit") in new stack
243.
    -- Executing [s@macro-user-callerid:7] Set("PJSIP/300-00000006", "AMPUSERCIDNAME={IP-Adresse CLient}") in new stack
244.
    -- Executing [s@macro-user-callerid:8] GotoIf("PJSIP/300-00000006", "0?report") in new stack
245.
    -- Executing [s@macro-user-callerid:9] Set("PJSIP/300-00000006", "AMPUSERCID=300") in new stack
246.
    -- Executing [s@macro-user-callerid:10] Set("PJSIP/300-00000006", "__DIAL_OPTIONS=Ttr") in new stack
247.
    -- Executing [s@macro-user-callerid:11] Set("PJSIP/300-00000006", "CALLERID(all)="{IP-Adresse CLient}" <300>") in new stack
248.
    -- Executing [s@macro-user-callerid:12] GotoIf("PJSIP/300-00000006", "0?limit") in new stack
249.
    -- Executing [s@macro-user-callerid:13] ExecIf("PJSIP/300-00000006", "1?Set(GROUP(concurrency_limit)=300)") in new stack
250.
    -- Executing [s@macro-user-callerid:14] GosubIf("PJSIP/300-00000006", "7?sub-ccss,s,1(from-internal,)") in new stack
251.
    -- Executing [s@sub-ccss:1] ExecIf("PJSIP/300-00000006", "0?Return()") in new stack
252.
    -- Executing [s@sub-ccss:2] Set("PJSIP/300-00000006", "CCSS_SETUP=TRUE") in new stack
253.
    -- Executing [s@sub-ccss:3] GosubIf("PJSIP/300-00000006", "0?monitor_config,1(from-internal,):monitor_default,1(from-internal,)") in new stack
254.
    -- Executing [monitor_default@sub-ccss:1] GotoIf("PJSIP/300-00000006", "0?is_exten") in new stack
255.
    -- Executing [monitor_default@sub-ccss:2] StackPop("PJSIP/300-00000006", "") in new stack
256.
    -- Execu