[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static=yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command "dialplan save" too
;
writeprotect=no
;
; If autofallthrough is set, then if an extension runs out of
; things to do, it will terminate the call with BUSY, CONGESTION
; or HANGUP depending on Asterisk's best guess. This is the default.
;
;
clearglobalvars=no
[globals]
[email protected]
[default]
;calls which are here, are not supposed to be here
exten => _X.,1,Answer ()
exten => _X.,n,Verbose(5,D E F A U L T ==> ${CALLERID(num)} came ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)} to Default als he tried to reach ${EXTEN}.)
exten => _X.,n,Playback(tt-weasels)
exten => _X.,4,Hangup
[voiceunavail]
exten => 10,1,Answer
exten => 10,n,Wait(1)
exten => 10,n,VoiceMail(10,u)
exten => 10,n,Hangup
[voicebusy]
exten => 10,1,Answer
exten => 10,n,Wait(1)
exten => 10,n,VoiceMail(10,b)
exten => 10,n,Hangup
[test]
;exten => 20,1,Answer
;exten => 20,n,Ringing
;exten => 20,1,Wait(1)
exten => 20,1,System(/usr/local/bin/rtthrottle.sh 1 1)
;exten => 20,n,Wait(1)
;exten => 20,n,MusicOnHold()
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/spam)
exten => 20,n,Dial(SIP/10,60,tT)
exten => 20,n,Hangup
exten => h,1,System(/usr/local/bin/rtthrottle.sh 150 10)
;exten => 20,1,Answer
;exten => 20,n,Ringing
;exten => 20,n,Wait(10)
;exten => 20,n,Monitor(wav,/usr/share/asterisk/sounds/recordings/honeypotfrom${CALLERID(num)}on${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot1hallomitwem)
;exten => 20,n,WaitForSilence(2000)
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot2hallo)
;exten => 20,n,WaitForSilence(2000)
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot3firmanichtverstanden)
;exten => 20,n,WaitForSilence(2000)
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot4achsowaskann)
;exten => 20,n,WaitForSilence(2000)
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot5okumwasgeht)
;exten => 20,n,WaitForSilence(2000)
;exten => 20,n,Playback(/usr/share/asterisk/sounds/custom/honeypot6nurcomputer)
;exten => 20,n,Hangup
[echotest]
exten => 22,1,Answer
exten => 22,n,Wait(1)
exten => 22,n,Playback(demo-echotest)
exten => 22,n,Echo
exten => 22,n,Playback(demo-echodone)
exten => 22,n,Hangup
[forbidden]
exten => s,1,Verbose(5,F O R B I D D E N ==> Call from "${CALLERID(num)}" to "${INVALID_EXTEN}" on "${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})"
exten => s,n,Wait(1)
exten => s,n,Playback(invalid)
exten => s,n,Hangup
[weasels]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
exten => s,n,Hangup
[speakingclock]
exten => 33,1,Answer
exten => 33,n,wait(1)
exten => 33,n,SayUnixTime(,Europe/Berlin,AdBYR)
exten => 33,n,Hangup
[record]
;record to a custom file
exten => 90,1,Answer
exten => 90,2,Wait(1)
exten => 90,3,Playback(vm-onefor)
exten => 90,4,Playback(vm-rec-temp)
exten => 90,5,Read(varrec,,1)
exten => 90,6,Gotoif($[${varrec}=1]?record,90,8)
exten => 90,7,Goto(record,90,3)
exten => 90,8,Playback(/usr/share/asterisk/sounds/en/beep)
exten => 90,9,Record(/usr/share/asterisk/sounds/recordings/recordtemp:gsm)
exten => 90,10,Playback(vm-review) ;;press 1 to save, 2 to repeat, 3 again record
exten => 90,n,Read(varrec,,1)
exten => 90,n,SayDigits(${varrec})
exten => 90,n,Gotoif($[${varrec}=1]?record,91,1)
exten => 90,n,Gotoif($[${varrec}=2]?record,92,1)
exten => 90,n,Gotoif($[${varrec}=3]?record,93,1)
exten => 90,n,Hangup
exten => 91,1,SayDigits({varrec})
exten => 91,n,System(/bin/mv /usr/share/asterisk/sounds/recordings/recordtemp.gsm /usr/share/asterisk/sounds/recordings/record${CALLERID(num)}${TIMESTAMP}.gsm)
exten => 91,n,Playback(vm-msgsaved)
exten => 91,n,Playback(vm-goodbye)
exten => 91,n,Hangup
exten => 92,1,SayDigits({varrec})
exten => 92,n,Playback(/usr/share/asterisk/sounds/recordings/recordtemp)
exten => 92,n,Goto(record,90,10)
exten => 92,n,Hangup
exten => 93,1,SayDigits({varrec})
exten => 93,n,Goto(record,90,8)
exten => 93,n,Hangup
[extDND]
exten => 98,1,Answer
exten => 98,n,Wait(1)
exten => 98,n,Macro(DND)
exten => 98,n,Hangup
[voicemail]
;listen voicemail and record voicemail text on ext 99
exten => 99,1,Answer
exten => 99,n,Wait(1)
exten => 99,n,Playback(vm-ansage1)
exten => 99,n,VoiceMailMain(${CALLERID(num)})
exten => 99,n,Hangup
[intern]
;intern phoning on extensions 10-19, ring 20seconds max
;exten => 10,1,GotoIf(${DB_EXISTS(DND/10)}?voiceunavail,10,1)
exten => _1X,1,Dial(SIP/${EXTEN},20,tT)
exten => _1X,n,VoiceMail(${EXTEN},u)
exten => _1X,n,Hangup
[blockpremium]
exten => _0900.,1,GoTo(forbidden,${EXTEN},1)
exten => _090[1-5].,1,GoTo(forbidden,${EXTEN},1)
exten => _013[78].,1,GoTo(forbidden,${EXTEN},1) ;Televoting
exten => _018Z.,1,GoTo(forbidden,${EXTEN},1) ;018[1-9] Geschlossene Benutzergruppen, Hotline
exten => _019.,1,GoTo(forbidden,${EXTEN},1)
exten => _118.,1,GoTo(forbidden,${EXTEN},1) ;Auskunft
[blockoversea]
exten => _00[12356789].,1,GoTo(forbidden,${EXTEN},1) ;block all but not 004
exten => _004[1245678].,1,GoTo(forbidden,${EXTEN},1) ;block all 004 but not 0043 and 0049
[blockmobile]
;exten => _01[5-7].,1,Congestion() ;signal the other end of congestion
exten => _01[5-7].,1,GoTo(forbidden,${EXTEN},1)
[spamtrap]
exten => s,1,Set(CALLERPRES()=prohib) ;hide own caller id
exten => s,n,Answer
exten => s,n,Ringing
exten => s,n,Wait(3)
exten => s,n,Monitor(wav,/usr/share/asterisk/sounds/recordings/honeypotfrom${CALLERID(num)}on${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot1hallomitwem)
exten => s,n,WaitForSilence(2000)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot2hallo)
exten => s,n,WaitForSilence(2000)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot3firmanichtverstanden)
exten => s,n,WaitForSilence(2000)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot4achsowaskann)
exten => s,n,WaitForSilence(2000)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot5okumwasgeht)
exten => s,n,WaitForSilence(2000)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/honeypot6nurcomputer)
exten => s,n,System(echo "Anruf von ${CALLERID(num)} mit Spamscore ${SPAMSCORE} wurde geblockt weil in Blacklist oder Score 7-9. Anruf gespeichert unter /usr/share/asterisk/sounds/recordings." | mutt -s "[PBX]: Geblockter Anruf von ${CALLERID(num)}" -a /usr/share/asterisk/sounds/recordings/honeypotfrom${CALLERID(num)}on${STRFTIME(${EPOCH})}-in.wav -- [email protected])
exten => s,n,Hangup
[macro-DND]
; do not disturb mode, set it also in case of vacation etc
exten => s,1,GotoIf(${DB_EXISTS(DND/${CALLERID(num)})}?disable-dnd,1) ;if db entry exists goto disable-dnd
exten => s,n,Set(DB(DND/${CALLERID(num)})=1) ;There was no entry on AstDB, so We active your DND
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/do-not-disturb)
exten => s,n,Playback(/usr/share/asterisk/sounds/custom/activated)
exten => s,n,Hangup
exten => disable-dnd,1,Set(oldval=${DB_DELETE(DND/${CALLERID(num)})}) ; You are disabling your DND
exten => disable-dnd,n,Wait(2)
exten => disable-dnd,n,Playback(/usr/share/asterisk/sounds/custom/do-not-disturb)
exten => disable-dnd,n,Playback(/usr/share/asterisk/sounds/custom/de-activated)
exten => disable-dnd,n,Hangup
exten => h,1,Hangup
[outxx1]
;need own context for out dial because otherwise blocking rules will not work, everything would match _XXX.
exten => _XXX.,1,System(/usr/local/bin/rtthrottle.sh 1 1)
exten => _XXX.,n,Wait(1)
exten => _XXX.,n,Dial(SIP/${EXTEN}@arcor_outxx1)
exten => _XXX.,n,Hangup
;if 0049 is dialed, remove first 4 digits and add 0 in order to avoid somebody dials 0049900 etc
exten => _0049.,1,Goto(0${EXTEN:4},1)
exten => h,1,System(/usr/local/bin/rtthrottle.sh 1 1)
[outxx2]
;all numbers start with 0 will dial out with 0 removed (EXTEN:1)
;exten => _0X.,1,Dial(SIP/${EXTEN:1}@arcor_out)
;all numbers with at least 3 digits will be dialed outbound
exten => _XXX.,1,System(/usr/local/bin/rtthrottle.sh 1 1)
exten => _XXX.,n,Wait(1)
exten => _XXX.,n,Dial(SIP/${EXTEN}@arcor_outxx2)
exten => _XXX.,n,Hangup
;if 0049 is dialed, remove first 4 digits and add 0 in order to avoid somebody dials 0049900 etc
exten => _0049.,1,Goto(0${EXTEN:4},1)
exten => h,1,System(/usr/local/bin/rtthrottle.sh 1 1)
[incoming-arcor]
;in this context calls from provider are going in and the extension will be ringed
;place this after outgoing context
exten => _X,1,AGI(spamscore.agi,${CALLERID(num)}) ;/usr/share/asterisk/agi-bin folder
exten => _X,n,GotoIf($[${REGEX("[7-9]" ${SPAMSCORE})}]?spamtrap)
;phone xx2
;exten => 08192xx2,1,GotoIf($["${CALLERIDNUM}" = "Anonymous"]?spamtrap)
exten => 08192xx2,1,GotoIf(${BLACKLIST()}?spamtrap)
exten => 08192xx2,n,GoToIfTime(20:00-05:59,mon-sun,*,*,*?voiceunavail,10,1) ;;at nighttime go without ringing to context voiceunavail with ext10 and prio 1
exten => 08192xx2,n,GotoIf(${DB_EXISTS(DND/10)}?voiceunavail,10,1) ;;goto voicemail if do no disturb mode is active
exten => 08192xx2,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?voicebusy,10,1) ;; goto voicemail busy if busy
exten => 08192xx2,n,System(/usr/local/bin/rtthrottle.sh 1 1)
exten => 08192xx2,n,SET(GROUP()=trunkgroup1)
;exten => 08192xx2,n,Dial(SIP/10,20,tT) ;; ring 20sec max and allow transfer of calls
exten => 08192xx2,n,Dial(SIP/10&SIP/12,20,tT) ; ring on 2 extensions
exten => 08192xx2,n,Goto(voiceunavail,10,1)
exten => 08192xx2,n,Hangup
;phone xx1
exten => 08192xx1,1,GotoIf(${BLACKLIST()}?spamtrap)
exten => 08192xx1,n,GoToIfTime(20:00-05:59,mon-sun,*,*,*?weasels,s,1)
exten => 08192xx1,n,System(/usr/local/bin/rtthrottle.sh 1 1)
;exten => 08192xx1,n,SET(GROUP()=trunkgroup1)
exten => 08192xx1,n,Dial(SIP/11,60,tT)
exten => 08192xx1,n,Hangup
;change back speed after hangup, if more than 1 are using phone, it will do it after first hangup
;exten => h,1,System(/usr/local/bin/rtthrottle.sh 1 1)
;change back speed after hangup, only if no channel is used
exten => h,1,ExecIf($[${GROUP_COUNT(trunkgroup1)}=0]?System(usr/local/bin/rtthrottle.sh 1 1))
;send mail for missed calls
;exten => h,n,System(echo "'Verpasster Anruf von ${CALLERID(num)} an ${EXTEN}'" | mail -s "'PBX: Verpasster Anruf von ${CALLERID(num)} an ${EXTEN}'" [email protected])
;exten => h,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?10:20)
;exten => h,10,Hangup
;send mail to ${EXTEN}mail variable which is defined in globals
;exten => h,20,System(echo "'Verpasster Anruf von ${CALLERID(num)} an ${EXTEN}'" | mail -s "'PBX: Verpasster Anruf von ${CALLERID(num)} an ${EXTEN}'" ${EXTEN}mail)
;exten => h,21,Hangup
[phonesxx1]
include => intern
include => blockpremium
include => blockoversea
include => outxx1 ;; last entry because is most global pattern
[phonesxx2]
;in this context all outbound calls are to be made and extensions are defined
include => echotest
include => voicemail
include => record
include => intern
include => blockpremium
include => blockoversea
include => test
include => speakingclock
include => extDND
include => macro-DND
include => spamtrap
include => outxx2 ;; last entry because is most global pattern