[general]
static=yes
writeprotect=no
[globals]
VOIPMSN=Zap/g1
TCOM=CAPI
;Stammrufnummer des Anlagenanschlusses
ROOT=341545
;Anzahl der Ziffern der Stammrufnummer
ROOTNUMCOUNT=6
[default]
include => sip2out
include => isdn2out
include => sip-in
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;users ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[macro-user51]
exten => s,1,SetVar(MYNAME=MSN51)
exten => s,2,SetVar(MYMSN=51)
exten => s,3,SetVar(MYSIPGROUP=SIP/61)
exten => s,4,SetVar(MYCALLMACRO=callwithpstn)
exten => s,5,SetVar(MYNUMSIP=1)
;exten => s,6,SetVar(MYSIP1=1und1-34154599)
exten => s,6,SetVar(MYSIP1=sipgate-089)
exten => s,7,SetVar(MYSIP2=stanaphone-646)
[macro-user99]
exten => s,1,SetVar(MYNAME=MSN99)
exten => s,2,SetVar(MYMSN=99)
exten => s,3,SetVar(MYSIPGROUP=SIP/62)
exten => s,4,SetVar(MYCALLMACRO=callwithpstn)
exten => s,5,SetVar(MYNUMSIP=3)
exten => s,6,SetVar(MYSIP1=sipgate-089)
exten => s,7,SetVar(MYSIP2=stanaphone-646)
exten => s,8,SetVar(MYSIP3=sipgate-030)
[macro-user1959335]
exten => s,1,SetVar(MYNAME=MSN51)
exten => s,2,SetVar(MYMSN=51)
exten => s,3,SetVar(MYSIPGROUP=SIP/61)
exten => s,4,SetVar(MYCALLMACRO=callwithpstn)
exten => s,5,SetVar(MYNUMSIP=1)
;exten => s,6,SetVar(MYSIP1=1und1-34154599)
exten => s,6,SetVar(MYSIP1=sipgate-089)
exten => s,7,SetVar(MYSIP2=stanaphone-646)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; external ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; outgoing calls
[macro-callwithpstn]
; ARG1 = calleridnum
; ARG2 = calleridname
exten => s,1,SetCIDNum(${ARG1})
exten => s,2,SetCIDName(${ARG2})
exten => s,3,Dial(${TCOM}/${ROOT}${MYMSN}:b${CBC}${EWL},60,Tt)
;exten => s,3,Dial(${TCOM}/${CBC}${EWL},60,Tt)
exten => s,104,GotoIf($[${DIALSTATUS} = CONGESTION]?109:110)
;exten => s,105,Dial(${TCOM}/${EWL},60,Tt)
exten => s,105,Dial(${TCOM}/${ROOT}${MYMSN}:b${EWL},60,Tt)
exten => s,106,Playtones(busy);
exten => s,107,Busy
[macro-callwithsip]
; ARG1 = calleridnum
; ARG2 = calleridname
; ARG3 = sipprovider
exten => s,1,SetCIDNum(${ARG1})
exten => s,2,SetCIDName(${ARG2})
exten => s,3,SetVar(NUMBER2DIAL=${EWL})
exten => s,4,GotoIf($[${ARG3:-5} = -intl]?5:6)
exten => s,5,SetVar(NUMBER2DIAL=${INTL})
exten => s,6,Dial(SIP/${NUMBER2DIAL}@${ARG3},60,Tt)
exten => s,107,GotoIf($[${DIALSTATUS} = CONGESTION]?108:109)
exten => s,108,Macro(callwithpstn,${ARG1},${ARG2})
exten => s,109,Playtones(busy);
exten => s,110,Busy
[macro-notallowed]
exten => s,1,Answer
exten => s,2,Wait(0.5)
exten => s,3,Playback(ss-noservice)
exten => s,4,Hangup
[forbidden]
; 019x
exten => _019X.,1,Macro(notallowed)
; 0900
exten => _0900X.,1,Macro(notallowed)
; EMSAT
exten => _0088X.,1,Macro(notallowed)
[emergency]
; re-rewrite emergency call numbers
; Anpassen auf eigene Vorwahl erforderlich
exten => _0991110,1,SetVar(EWL=110)
exten => _0991110,2,Macro(callwithpstn,${MYMSN},${MYNAME})
exten => _0991112,1,SetVar(EWL=112)
exten => _0991112,2,Macro(callwithpstn,${MYMSN},${MYNAME})
exten => _099119222,1,SetVar(EWL=19222)
exten => _099119222,2,Macro(callwithpstn,${MYMSN},${MYNAME})
[preselection]
; dial the following prefixes with a defined method
; university of saarland
; exten => _0681302X.,1,Macro(callwithsip,${MYMSN},${MYNAME},eric-unisaarland-intl)
; freecall
exten => _0800X.,1,Macro(callwithpstn,${MYMSN},${MYNAME})
; user-defined call-by-call
exten => _010X.,1,Macro(callwithpstn,${MYMSN},${MYNAME})
; automatic call-by-call
[macro-cbc]
exten => s,1,SetVar(CBC=${ARG1})
exten => s,2,Macro(${CALLMACRO2USE},${MYMSN},${MYNAME},${SIP2USE})
exten => s,3,Hangup
[cbc-01071-international]
exten => _00ZX.,1,Macro(cbc,01071)
[cbc-01030-cellphones]
exten => _015X.,1,Macro(cbc,01030)
exten => _016X.,1,Macro(cbc,01030)
exten => _017X.,1,Macro(cbc,01030)
[cbc-01071-longdistance]
exten => _0ZX.,1,Macro(cbc,01071)
[cbc-01019-local]
;Anpassen auf eigene Vorwahl erforderlich
exten => _0991X.,1,Macro(cbc,01019)
;[cbc-xxl]
;Nur wenn XXL-Tarif vorhanden
;exten => _0ZX.,1,Macro(cbc,01033)
[nocbc]
exten => _X.,1,Macro(cbc)
[cbc]
;exten => _0991X.,1,Macro(cbc)
;Nur in Verbindung mit Sonntagstarifen wie XXL sinnvoll
;include => cbc-01019-local|*|mon-sat|*|*
include => cbc-01019-local
include => cbc-01071-international
include => cbc-01030-cellphones
;Nur in Verbindung mit Sonntagstarifen wie XXL sinnvoll
;include => cbc-01071-longdistance|*|mon-sat|*|*
include => cbc-01071-longdistance
;Nur in Verbindung mit Sonntagstarifen wie XXL sinnvoll
;include => cbc-xxl|*|sun|*|*
include => nocbc;
[standard]
exten => h,1,NoOp
exten => t,1,Playtones(busy)
exten => t,2,Busy
[number-preselection]
include => emergency
include => forbidden
include => preselection
include => cbc
include => standard
[line-preselection]
include => emergency
include => forbidden
include => cbc
include => standard
[macro-numbers]
; ARG1 number to rewrite
; sets
; EWL (exten with local)
; INTL (international format)
exten => s,1,GotoIf($[${ARG1:0:2} = 00]?2:5)
exten => s,2,SetVar(EWL=${ARG1})
exten => s,3,SetVar(INTL=+${ARG1:2})
exten => s,4,Goto(11)
exten => s,5,GotoIf($[${ARG1:0:1} = 0]?6:9)
exten => s,6,SetVar(EWL=${ARG1})
exten => s,7,SetVar(INTL=+49${ARG1:1})
exten => s,8,Goto(11)
exten => s,9,SetVar(EWL=0991${ARG1})
exten => s,10,SetVar(INTL=+49991${ARG1})
exten => s,11,NoOp
[macro-invalidline]
exten => s,1,Answer
exten => s,2,Wait(0.5)
exten => s,3,Playback(privacy-incorrect)
exten => s,4,Hangup
[callout]
; use pstn line (no sip provider needed)
exten => _1*X.,1,SetVar(CALLMACRO2USE=callwithpstn)
exten => _1*X.,2,Macro(numbers,${EXTEN:2})
exten => _1*X.,3,Goto(line-preselection,${EWL},1)
; use default sipline (MYSIP1)
; forbid CbC over sip
exten => _2*010X.,1,Macro(invalidline)
exten => _2*X.,1,SetVar(CALLMACRO2USE=callwithsip)
exten => _2*X.,2,SetVar(SIP2USE=${MYSIP1})
exten => _2*X.,3,Macro(numbers,${EXTEN:2})
exten => _2*X.,4,Goto(line-preselection,${EWL},1)
; use special sipline (MYSIPx)
;forbid CbC over sip
exten => _2Z*010X.,1,Macro(invalidline)
exten => _2Z*X.,1,SetVar(CALLMACRO2USE=callwithsip)
exten => _2Z*X.,2,GotoIf($[${EXTEN:1:1} <= ${MYNUMSIP}]?3:7)
exten => _2Z*X.,3,SetVar(SIP2USE=${MYSIP${EXTEN:1:1}})
exten => _2Z*X.,4,Macro(numbers,${EXTEN:3})
exten => _2Z*X.,5,Goto(line-preselection,${EWL},1)
exten => _2Z*X.,6,Goto(8)
exten => _2Z*X.,7,Macro(invalidline)
exten => _2Z*X.,8,NoOp
; choose best service by number (fallback is MYCALLMACRO)
exten => _XXX.,1,SetVar(CALLMACRO2USE=${MYCALLMACRO})
exten => _XXX.,2,SetVar(SIP2USE=${MYSIP1})
exten => _XXX.,3,Macro(numbers,${EXTEN})
exten => _XXX.,4,Goto(number-preselection,${EWL},1)
include => sipphones
; if the number does not start with three digits -> invalid
exten => i,1,Macro(invalidline)
[isdn2out]
exten => s,1,Wait(0.1)
exten => s,2,DigitTimeout(2)
exten => s,3,SetLanguage(de)
exten => s,4,Macro(user${PRI_NETWORK_CID})
exten => _X.,1,Wait(0.1)
exten => _X.,2,DigitTimeout(2)
exten => _X.,3,SetLanguage(de)
exten => _X.,4,Macro(user${PRI_NETWORK_CID})
exten => _X.,5,Goto(callout,${EXTEN},1)
[sip2out]
exten => _0X./11,1,Macro(user11111)
exten => _0X./11,2,Goto(callout,${EXTEN:1},1)
exten => _0X./22,1,Macro(user22222)
exten => _0X./22,2,Goto(callout,${EXTEN:1},1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; in-coming calls (isdn,sip)
[macro-call-tk]
exten => s,1,Wait(0.1)
;exten => s,2,Macro(user${MACRO_EXTEN})
exten => s,2,Macro(user${MACRO_EXTEN:${ROOTNUMCOUNT}})
exten => s,3,SetCIDNum(${CALLERIDNUM})
exten => s,4,Dial(${VOIPMSN}/${MYMSN},60,Tt)
exten => s,105,Busy
[macro-call-sip]
exten => s,1,Wait(0.1)
exten => s,2,Macro(user${MACRO_EXTEN})
exten => s,3,SetCIDNum(0${CALLERIDNUM})
exten => s,4,Dial(${MYSIPGROUP},60,Tt)
exten => s,105,Busy
;Ergänzt, ursprünglich in sip.conf mittels context hierher verwiesen, ging aber nicht
[sip-in]
;exten => 1939553,1,Dial(SIP/62,60)
;exten => 1939553,2,Congestion
;exten => 1939553,102,Busy
exten => 1939553,1,Macro(call-sip)
exten => h,1,NoOp
exten => t,1,Busy
[tcom-in]
exten => 34154551,1,Macro(call-tk)
exten => 22222,1,Macro(call-sip)
exten => h,1,NoOp
exten => t,1,Busy
[macro-sip]
exten => s,1,Dial(SIP/${MACRO_EXTEN},60,Tt)
exten => s,2,Goto(s-${DIALSTATUS},1)
exten => s,3,Hangup
exten => s-CANCEL,1,Goto(s,3)
exten => s-ANSWER,1,NoOp
exten => s-NOANSWER,1,Goto(s,3)
exten => s-BUSY,1,Busy
exten => s-BUSY,2,Hangup
exten => s-CONGESTION,1,Congestion
exten => s-CONGESTION,2,Hangup
exten => s-CHANUNAVAIL,1,Playback(vm-theperson)
exten => s-CHANUNAVAIL,2,SayDigits(${MACRO_EXTEN})
exten => s-CHANUNAVAIL,3,Playback(vm-isunavail)
exten => s-CHANUNAVAIL,4,Hangup
[sipphones]
;wichtig diesen include hier zu machen und auf diesen context in sip.conf zu verweisen
;(warum auch immer, wer kann das erklären)
include => sip-in
exten => 61,1,Macro(sip)
exten => 61,2,Hangup
exten => 62,1,Macro(sip)
exten => 62,2,Hangup
exten => h,1,Hangup