Copyright (C) 2008-2021 Oliver Bohlen.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU Free Documentation License".
This documentation comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--
Click here for a download of the complete file: /etc/asterisk/extensions.conf
Changed on 07.09.17Call routing / Action plans
; General settings [general] static=yes writeprotect=no [local] ; Internal calls ^3[0-9]$ exten => _3X,1,NoOp(${CALLERID}) exten => _3X,n,Dial(PJSIP/${EXTEN},120) exten => _3X,n,Hangup ; Internal calls ^4[0-9]$ exten => _4X,1,NoOp(${CALLERID}) exten => _4X,n,Dial(PJSIP/${EXTEN},120) exten => _4X,n,Hangup [1und1_out] ; local area code calls exten => _ZX.,1,NoOp(${CALLERID}) ; Optional: look up in the Horde addressbook for the caller name ;exten => _ZX.,n,Set(CALLNAME=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(dnid)})}) ; Optional: Notify outgoing call per eMail exten => _ZX.,n,System(echo "`date`: ${CALLERID(all)} ruft ${CALLNAME} <${CALLERID(dnid)}> an!" | mail -s "Telefonat nach draußen ${CALLERID(all)} -> ${CALLERID(dnid)}" mail@example.com ) ; Optional: Record call exten => _ZX.,n,System(mkdir -p "/home/asterisk/calls") exten => _ZX.,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => _ZX.,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => _ZX.,n,Monitor(wav,${FILENAME},mb) ; Remove Name exten => _ZX.,n,Set(CALLERID(all)="PHONENUMBER" <PHONENUMBER>) ; Route to PJSIP-Provider exten => _ZX.,n,Set(VOLUME(RX,p)=4) exten => _ZX.,n,Dial(PJSIP/PHONENUMBER/0DIALPREFIX${EXTEN},120) exten => _ZX,n,Hangup ; Other Outgoing calls exten => _[+0]XX.,1,NoOp(${CALLERID}) ; Optional: Look up in the Horde addressbook for the caller name ;exten => _[+0]XX.,n,Set(CALLNAME=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(dnid)})}) ; Optional: Notify outgoing call per eMail exten => _[+0]XX.,n,System(echo "`date`: ${CALLERID(all)} ruft ${CALLNAME} <${CALLERID(dnid)}> an!" | mail -s "Telefonat nach draußen ${CALLERID(all)} -> ${CALLERID(dnid)}" mail@example.com ) ; Optional: Record call exten => _[+0]XX.,n,System(mkdir -p "/home/asterisk/calls") exten => _[+0]XX.,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => _[+0]XX.,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => _[+0]XX.,n,Monitor(wav,${FILENAME},mb) ; Remove Name exten => _[+0]XX.,n,Set(CALLERID(all)="PHONENUMBER" <PHONENUMBER>) ; Route to PJSIP-Provider exten => _[+0]XX.,n,Set(VOLUME(RX,p)=4) exten => _[+0]XX.,n,Dial(PJSIP/PHONENUMBER/${EXTEN},120) exten => _[+0]XX.,n,Hangup [1und1_olb_out] ; local area code calls exten => _ZX.,1,NoOp(${CALLERID}) ; Optional: look up in the Horde addressbook for the caller name ;exten => _ZX.,n,Set(CALLNAME=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(dnid)})}) ; Optional: Notify outgoing call per eMail exten => _ZX.,n,System(echo "`date`: ${CALLERID(all)} ruft ${CALLNAME} <${CALLERID(dnid)}> an!" | mail -s "OLB Telefonat nach draußen ${CALLERID(all)} -> ${CALLERID(dnid)}" mail@example.com ) ; Optional: Record call exten => _ZX.,n,System(mkdir -p "/home/asterisk/calls") exten => _ZX.,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => _ZX.,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => _ZX.,n,Monitor(wav,${FILENAME},mb) ; Remove Name exten => _ZX.,n,Set(CALLERID(all)="PHONENUMBER2" <PHONENUMBER2>) ; Route to PJSIP-Provider exten => _ZX.,n,Set(VOLUME(RX,p)=4) exten => _ZX.,n,Dial(PJSIP/PHONENUMBER2/0DIALPREFIX${EXTEN},120) exten => _ZX,n,Hangup ; Other Outgoing calls exten => _[+0]XX.,1,NoOp(${CALLERID}) ; Optional: Look up in the Horde addressbook for the caller name ;exten => _[+0]XX.,n,Set(CALLNAME=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(dnid)})}) ; Optional: Notify outgoing call per eMail exten => _[+0]XX.,n,System(echo "`date`: ${CALLERID(all)} ruft ${CALLNAME} <${CALLERID(dnid)}> an!" | mail -s "OLB Telefonat nach draußen ${CALLERID(all)} -> ${CALLERID(dnid)}" mail@example.com ) ; Optional: Record call exten => _[+0]XX.,n,System(mkdir -p "/home/asterisk/calls") exten => _[+0]XX.,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => _[+0]XX.,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => _[+0]XX.,n,Monitor(wav,${FILENAME},mb) ; Remove Name exten => _[+0]XX.,n,Set(CALLERID(all)="PHONENUMBER2" <PHONENUMBER2>) ; Route to PJSIP-Provider exten => _[+0]XX.,n,Set(VOLUME(RX,p)=4) exten => _[+0]XX.,n,Dial(PJSIP/PHONENUMBER2/${EXTEN},120) exten => _[+0]XX.,n,Hangup [incoming] ; Incoming calls to PHONENUMBER exten => PHONENUMBER,1,NoOp(${CALLERID}) ; Optional: Look up in the Horde addressbook for the caller name ;exten => PHONENUMBER,n,Set(CALLERID(name)=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(num)})}) ; Optional: Notify incoming call per eMail exten => PHONENUMBER,n,System(echo "`date`: ${CALLERID(all)} ruft an." | mail -s 'Anrufbenachrichtigung ${CALLERID(all)}' mail@example.com) ; Optional: Block blackisted ; blacklist administrated ober CLI ("asterisk -r") ; Adding a number to be blocked ; *CLI> database put blacklist 1234 "TEST" ; Removing a number from being blocked ; *CLI> database del blacklist 1234 ; Listing current blocks ; pbx*CLI> databse show blacklist exten => PHONENUMBER,n,GotoIf(${BLACKLIST()}?blacklisted) ; Optional: Don't ring in night time excluding numbers in phonebook exten => PHONENUMBER,n,GotoIf($["${CALLERID(name)}" != ""]?ring) exten => PHONENUMBER,n,GotoIfTime(23:00-23:59,sun-sat,*,*?noring) exten => PHONENUMBER,n,GotoIfTime(00:00-05:00,sun-sat,*,*?noring) ; Optional: Record call exten => PHONENUMBER,n(ring),System(mkdir -p "/home/asterisk/calls") exten => PHONENUMBER,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => PHONENUMBER,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => PHONENUMBER,n,Monitor(wav,${FILENAME},mb) ; Route the call to local PJSIP-Phones - ringing (try for 60 seconds) exten => PHONENUMBER,n,Set(VOLUME(TX,p)=4) exten => PHONENUMBER,n,Dial(PJSIP/30&PJSIP/31&PJSIP/32&PJSIP/33&PJSIP/34&PJSIP/40,60) ; Set Language for Voicemail-Answer exten => PHONENUMBER,n(noring),Set(CHANNEL(language)=de) ; Start Voicemail exten => PHONENUMBER,n,Voicemail(30&31) exten => PHONENUMBER,n,Playback(vm-goodbye) exten => PHONENUMBER,n(blacklisted),Hangup() ; hangup exten => PHONENUMBER,n,Hangup ; Incoming calls to PHONENUMBER2 exten => PHONENUMBER2,1,NoOp(${CALLERID}) ; Optional: Look up in the Horde addressbook for the caller name ;exten => PHONENUMBER2,n,Set(CALLERID(name)=${SHELL(/etc/asterisk/hordelookup.sh ${CALLERID(num)})}) ; Optional: Notify incoming call per eMail exten => PHONENUMBER2,n,System(echo "`date`: ${CALLERID(all)} ruft an." | mail -s 'Anrufbenachrichtigung ${CALLERID(all)}' mail@example.com) ; Optional: Block blackisted ; blacklist administrated ober CLI ("asterisk -r") ; Adding a number to be blocked ; *CLI> database put blacklist 1234 "TEST" ; Removing a number from being blocked ; *CLI> database del blacklist 1234 ; Listing current blocks ; pbx*CLI> databse show blacklist exten => PHONENUMBER2,n,GotoIf(${BLACKLIST()}?blacklisted) ; Optional: Don't ring in night time excluding numbers in phonebook exten => PHONENUMBER2,n,GotoIf($["${CALLERID(name)}" != ""]?ring) exten => PHONENUMBER2,n,GotoIfTime(23:00-23:59,sun-sat,*,*?noring) exten => PHONENUMBER2,n,GotoIfTime(00:00-05:00,sun-sat,*,*?noring) ; Optional: Record call exten => PHONENUMBER2,n(ring),System(mkdir -p "/home/asterisk/calls") exten => PHONENUMBER2,n,Set(FILENAME=${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M_%S)}-${EXTEN}) exten => PHONENUMBER2,n,Set(MONITOR_EXEC_ARGS=&& mv "/var/spool/asterisk/monitor/${FILENAME}.wav" "/home/asterisk/calls/") exten => PHONENUMBER2,n,Monitor(wav,${FILENAME},mb) ; Route the call to local PJSIP-Phones - ringing (try for 60 seconds) exten => PHONENUMBER2,n,Set(VOLUME(TX,p)=4) exten => PHONENUMBER2,n,Dial(PJSIP/40,60) ; hangup exten => PHONENUMBER2,n,Hangup ; Default rules Be careful: You have to block all IPs expect these of your PJSIP-Provider to use this option in a most secure way [default] include => incoming ; Only for internal phones [phones] include => local include => 1und1_out [olbworkphones] include => local include => 1und1_olb_out
Please send a feedback to: doc<at>gabosh.net
Howto listingHere you can find the official Gentoo Linux Forums where you can find a lot of answers.
Here a link to the official Gentoo Linux Homepage.