[globals]
; gehende Nummer in [festnetz_out]
CAPI_CALLERID=1234567
[general]
static=yes
writeprotect=no
; Macros
[macro-entfernegitter]
; wenn Nummer mit # endet, das # Zeichen abschneiden, als EXTEN2 zurückgeben
; - um am internen isdn S0 der fritzbox asterisk zu erreichen, muss 912...# gewählt werden
exten => s,1,Set(EXTEN2=${IF( $[ ${MACRO_EXTEN:-1} = # ] ? ${MACRO_EXTEN:0:$[${LEN(${MACRO_EXTEN})}-1]} : ${MACRO_EXTEN} )})
;exten => s,n,NoOp(${EVAL(${EXTEN2})} -- ${MACRO_CONTEXT})
; --------------------------------------------------------------------
; f.r interne Funktionen: Echo, Anrufbeantworter ...
[headsettest]
exten => _95!,1,Dial(Mobile/headset)
;Callback testen
[callbacktest]
exten => _94!,1,noop(callerid=${CALLERID(all)}, channel=${CHANNEL:0:10}, callback_in_channel=${CB_IN_CHANNEL})
exten => _94!,n,gotoif($["${CHANNEL:0:$[${LEN(${CB_IN_CHANNEL})}-1-${LEN(${CALLERID(num)})}]}" != "${CB_IN_CHANNEL:0:$[${LEN(${CB_IN_CHANNEL})}-1-${LEN(${CALLERID(num)})}]}"]?80)
exten => _94!,n,gotoif($["${CALLERID(num)}" != "${CB_IN_CHANNEL:-${LEN(${CALLERID(num)})}}"]?80)
exten => _94!,n,wait(1)
exten => _94!,n,goto(callback-wait,s,1)
exten => _94!,80,hangup
; nicht per include in lokal aufzunehmen; wird ueber callbacktest aufgerufen.
[callback-wait]
exten => s,1,Set(CB_TRIGGERED=1,g)
exten => s,n,ringing
exten => s,n,wait(5)
exten => t,1,Set(CB_TRIGGERED=0,g)
exten => t,n,hangup
exten => h,1,gotoif($[${CB_TRIGGERED}]?callback-callfile,s,1)
; nicht per include in lokal aufzunehmen; wird ueber callbacktest aufgerufen.
[callback-callfile]
exten => s,1,system(echo "Channel: ${CB_OUT_CHANNEL}" >/var/spool/asterisk/call0)
exten => s,n,system(echo "CallerID: ${CB_CALLERID}" >>/var/spool/asterisk/call0)
exten => s,n,system(echo "WaitTime: ${CB_WAITTIME}" >>/var/spool/asterisk/call0)
exten => s,n,system(echo "MaxRetries: 0" >>/var/spool/asterisk/call0)
exten => s,n,system(echo "Context: ${CB_CONTEXT}" >>/var/spool/asterisk/call0)
exten => s,n,system(echo "Extension: ${CB_EXTENSION}" >>/var/spool/asterisk/call0)
exten => s,n,system(mv /var/spool/asterisk/call0 /var/spool/asterisk/outgoing)
exten => s,n,system(touch /var/spool/asterisk/outgoing)
exten => s,n,goto(100)
exten => s,80,wait(5)
exten => s,100,hangup
;Callthrough testen
[callthroughtest]
; Prompt caller to authenticate and validate passcode
exten => _93!,1,Goto(callthroughauth,s,1)
; nicht per include in lokal aufzunehmen; wird ueber callthroughtest aufgerufen.
[callthroughauth]
; Prompt caller to authenticate and validate passcode
;exten => _1234567!,1,goto(s,1)
exten => s,1,answer
exten => s,2,Noop(${CALLERID(num)})
exten => s,3,wait(1)
exten => s,4,authenticate(/etc/asterisk/passwd,j)
; Log failed authentication and hangup
exten => _93!,105,system(echo "${STRFTIME(||%Y-%m-%d_%H-%M-%S)} - ${CALLERID(num)}: Authentication Failed!" >> /var/log/asterisk/callthrough.log)
exten => _93!,n,HangUp()
exten => s,5,Goto(callthrough,s,1)
; Log when call has been aborted
exten => h,1,system(echo "${STRFTIME(||%Y-%m-%d_%H-%M-%S)} - ${CALLERID(num)}: Call has been aborted at ${STRFTIME(||%Y-%m-%d_%H-%M-%S)}" >> /var/log/asterisk/callthrough.log)
; nicht per include in lokal aufzunehmen; wird ueber callthroughtest aufgerufen.
[callthrough]
; Prompt caller to key-in number to be dialed and to finish with #
exten => s,1,Set(NR=)
exten => s,2,Background(vm-enter-num-to-call)
exten => s,3,Set(TIMEOUT(response)=30)
exten => s,4,WaitExten
exten => _X,1,Set(NR=${NR}${EXTEN})
exten => _X,2,Goto(s,3)
exten => *,1,Goto(s,1)
exten => #,1,NoOp(${NR})
exten => #,2,Playback(vm-dialout)
exten => #,3,NoOP(Dialing Now)
exten => #,4,system(echo "${STRFTIME(||%Y-%m-%d_%H-%M-%S)} - ${CALLERID(num)}: Authenticated & dialing ${NR}" >> /var/log/asterisk/callthrough.log)
exten => #,5,NoOp(Dialing ${NR})
exten => #,6,Dial(CAPI/ISDN1/${NR},55,bd)
;exten => #,6,Dial(SIP/${NR},55,bd)
exten => #,n,HangUp()
; Log when connection timed out
exten => t,1,Busy(3)
exten => t,n,system(echo "${STRFTIME(||%Y-%m-%d_%H-%M-%S)} - ${CALLERID(num)}: Call to ${NR} timed out." >> /var/log/asterisk/callthrough.log)
exten => t,n,HangUp()
; Log when call has finished
exten => h,1,system(echo "${STRFTIME(||%Y-%m-%d_%H-%M-%S)} - ${CALLERID(num)}: Call to ${NR} completed." >> /var/log/asterisk/callthrough.log)
;music on hold testen
[mohtest]
exten => _92!,1,Macro(entfernegitter)
exten => _92!,n,answer
exten => _92!,n,wait(1)
exten => _92!,n,musiconhold
exten => _92!,n,hangup
;Begruessungsnachricht des Anrufbeantworters aufnehmen
[record_message]
exten => _91!,1,Macro(entfernegitter)
exten => _91!,n,answer
exten => _91!,n,wait(1)
exten => _91!,n,playback(beep)
exten => _91!,n,record(VM_MESSAGE.gsm,3,60)
exten => _91!,n,playback(VM_MESSAGE)
exten => _91!,n,playback(beep)
exten => _91!,n,hangup
;bei usb-Installation werden die Nachrichten vor dem mailen
;auf den usb-Speicher geschrieben (/var/spool/asterisk);
;(Schreiben auf RAM durch Ersetzen von /var/spool/asterisk durch /var/spool)
[recordtest]
; Prompt caller to authenticate and validate passcode
exten => _90!,1,Goto(record,s,1)
; nicht per include in lokal aufzunehmen; wird ueber recordtest aufgerufen.
[record]
exten => s,1,Macro(entfernegitter)
exten => s,n,answer(2000)
exten => s,n,wait(1)
; die gew.hlte Nummer ansagen:
exten => s,n,SayDigits(${EXTEN2})
; Ansagetext vorspielen
exten => s,n,playback(VM_MESSAGE)
exten => s,n,set(MSGFILENAME=${CALLERID(num)}-${TIMESTAMP})
exten => s,n,set(MAILER_SUBJECT=Anrufer:${CALLERID(num)} ${STRFTIME(||%Y-%m-%d_%H-%M-%S)})
exten => s,n,record(/var/spool/asterisk/${MSGFILENAME}.WAV,5,60)
;exten => s,n,playback(/var/spool/asterisk/${MSGFILENAME})
exten => s,n,hangup
; Nachricht nach Hangup per e-mail versenden und löschen
exten => h,1,gotoif(${MSGFILENAME}?20:48)
exten => h,20,system(mv /var/spool/asterisk/${MSGFILENAME}.WAV /var/spool/asterisk/${MSGFILENAME}.wav)
exten => h,n,gotoif(${MAILER_USER}?40)
exten => h,n,system(mailer -s "${MAILER_SUBJECT}" -m "${MAILER_SMTP}" -f "${MAILER_FROM}" -t "${MAILER_TO}" -d /var/spool/asterisk/${MSGFILENAME}.wav)
exten => h,n,goto(45)
exten => h,40,system(mailer -a "${MAILER_USER}" -w "${MAILER_PASSWORD}" -s "${MAILER_SUBJECT}" -m "${MAILER_SMTP}" -f "${MAILER_FROM}" -t "${MAILER_TO}" -d /var/spool/asterisk/${MSGFILENAME}.wav)
exten => h,n,goto(45)
; Nachricht bei erfolgreichem Versand loeschen
exten => h,45,gotoif($[${SYSTEMSTATUS} = SUCCESS]?46:48)
exten => h,46,system(rm /var/spool/asterisk/${MSGFILENAME}.wav)
exten => h,47,goto(49)
exten => h,48,NoOp(Hanging up - no message to send)
exten => h,49,NoOp()
[echotest]
exten => _80!,1,Macro(entfernegitter)
exten => _80!,n,answer
exten => _80!,n,wait(2)
; als Test auf die Spracheinstellung, die gewählte Nummer ansagen:
exten => _80!,n,SayNumber(80)
exten => _80!,n,wait(2)
exten => _80!,n,playback(demo-echotest)
exten => _80!,n,echo
exten => _80!,n,playback(demo-echodone)
exten => _80!,n,hangup
[authtest]
exten => _89!,1,Macro(entfernegitter)
exten => _89!,n,answer
exten => _89!,n,wait(2)
exten => _89!,n,authenticate(/etc/asterisk/passwd)
exten => _89!,n,system(zebedee2.bin -f /etc/zebedee/zbdr23.conf)
exten => _89!,n,playback(beep)
exten => _89!,n,hangup
[zeitansage]
exten => _96!,1,Macro(entfernegitter)
exten => _96!,2,NoCDR()
exten => _96!,n,Set(LANGUAGE()=de)
exten => _96!,n,Answer
exten => _96!,n,Wait(1)
exten => _96!,n,SayUnixTime(${EPOCH}||k)
exten => _96!,n,SayUnixTime(${EPOCH}||M)
exten => _96!,n,Playback(minutes)
exten => _96!,n,SayUnixTime(${EPOCH}||S)
exten => _96!,n,Wait(1)
exten => _96!,n,SayUnixTime(${EPOCH}||a)
exten => _96!,n,SayUnixTime(${EPOCH}||d)
exten => _96!,n,SayUnixTime(${EPOCH}||m) ; b
exten => _96!,n,SayUnixTime(${EPOCH}||Y)
exten => _96!,n,Wait(1)
exten => _96!,n,Playback(beep)
exten => _96!,n,Goto(3)
[lokal]
include => echotest
include => authtest
include => recordtest
include => record_message
include => mohtest
include => callthroughtest
include => callbacktest
include => headsettest
include => zeitansage
; SIP
exten => _77XX,1,Dial(SIP/${EXTEN},55,Ttr)
[festnetz_out]
exten => _0X.,1,SetCallerID(${CAPI_CALLERID})
exten => _0X.,n,Dial(CAPI/ISDN1/${EXTEN},55,Tt/bd)
[default]
include => lokal
[sip7701]
include => lokal
include => festnetz_out
[sip7702]
include => lokal
include => festnetz_out
; ISDN S0 extern
[capi_in1]
; solange in capi.conf nur auf einer msn Nummer Anrufe angenommen werden
; reicht es, unabhängig von der msn immer auf die
; gewünschten Nebenstellen weiterzuverbinden
; ISDN S0 intern: akzeptiere nur Anrufe mit führender 9
; (entferne die führende 9 und das abschliessende #)
[capi_in3]
exten => _9[1-8]!,1,Macro(entfernegitter)
exten => _9[1-8]!,n,Goto(lokal,${EXTEN2:1},1)
exten => _90!,1,Macro(entfernegitter)
exten => _90!,n,Goto(festnetz_out,${EXTEN2:1},1)
exten => _99!,n,Goto(sip_out,${EXTEN2:2},1)