[general]
static=yes
writeprotect=no
[globals]
VOIPMSN=Zap/g1
TCOM=CAPI
[default]
include => sip2out
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;users ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[macro-user378222]
exten => s,1,SetVar(MYNAME=MSN378222)
exten => s,2,SetVar(MYMSN=378222)
exten => s,3,SetVar(MYSIPGROUP=SIP/11)
exten => s,4,SetVar(MYCALLMACRO=callwithpstn)
exten => s,5,SetVar(MYNUMSIP=1)
exten => s,6,SetVar(MYSIP1=sipgate11)
exten => s,6,SetVar(MYSIP1=unisaarland-intl)
[macro-user378223]
exten => s,1,SetVar(MYNAME=MSN378223)
exten => s,2,SetVar(MYMSN=378223)
exten => s,3,SetVar(MYSIPGROUP=SIP/22)
exten => s,4,SetVar(MYCALLMACRO=callwithpstn)
exten => s,5,SetVar(MYNUMSIP=3)
exten => s,6,SetVar(MYSIP1=sipgate22)
exten => s,7,SetVar(MYSIP2=unisaarland-intl)
exten => s,8,SetVar(MYSIP3=webde22)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; external ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; outgoing calls
[macro-callwithpstn]
; ARG1 = calleridnum
; ARG2 = calleridname
exten => s,1,SetCIDNum(${ARG1})
exten => s,2,SetCIDName(${ARG2})
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,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
exten => _037606110,1,SetVar(EWL=110)
exten => _037606110,2,Macro(callwithpstn,${MYMSN},${MYNAME})
exten => _037606112,1,SetVar(EWL=112)
exten => _037606,2,Macro(callwithpstn,${MYMSN},${MYNAME})
exten => _03760619222,1,SetVar(EWL=19222)
exten => _03760619222,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-01071-cellphones]
exten => _016X.,1,Macro(cbc,01071)
exten => _017X.,1,Macro(cbc,01071)
[cbc-01071-longdistance]
exten => _0ZX.,1,Macro(cbc,01071)
[cbc-01019-local]
exten => _037606X.,1,Macro(cbc,01019)
[cbc-xxl]
exten => _0ZX.,1,Macro(cbc,01033)
[nocbc]
exten => _X.,1,Macro(cbc)
[cbc]
;exten => _037606X.,1,Macro(cbc)
include => cbc-01019-local|*|mon-sat|*|*
include => cbc-01071-international
include => cbc-01071-cellphones
include => cbc-01071-longdistance|*|mon-sat|*|*
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=037606${ARG1})
exten => s,10,SetVar(INTL=+4937606${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 CbX 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)
[macro-call-tk]
exten => s,1,Wait(0.1)
exten => s,2,Macro(user${MACRO_EXTEN})
exten => s,3,SetCIDNum(${CALLERIDNUM})
exten => s,4,Dial(${VOIPMSN}/${MYMSN},60,Ttr)
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,Ttr)
exten => s,105,Busy
[tcom-in]
exten => 378222,1,Macro(call-tk)
exten => 378223,1,Macro(call-tk)
exten => 22222,1,Macro(call-sip)
exten => i,1,Congestion
exten => h,1,NoOp
exten => t,1,Busy
[macro-sip]
exten => s,1,Dial(${VOIPMSN}/${MACRO_EXTEN},60,Ttr)
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] ; or other ínternal contexts which should be call-able
exten => 2109066,1,Macro(sip)
exten => 2109066,2,Hangup
exten => 32,1,Macro(sip)
exten => 32,2,Hangup
exten => h,1,Hangup