; General parameters

[general]
static=yes
writeprotect=yes

; Global Variables
[globals]
outb46932400=trunk-ht1
outb46932424=trunk-ht2
outb46932444=trunk-aar1

[defaults]

[office-ht1]
exten => s,1,Background(/home/thomas/banestroeget)
exten => s,2,DigitTimeout(3)
exten => s,3,WaitExten(3)
exten => s,4,Dial(SIP/1001&SIP/1002&SIP/1003)
exten => s,5,Hangup
exten => i,1,Dial(SIP/1001&SIP/1002&SIP/1003)
exten => i,2,Hangup
include => internal
include => office-main
include => utilities
include => outbound-46932400

[office-ht2]
exten => s,1,Background(/home/thomas/thistedgade)
exten => s,2,DigitTimeout(3)
exten => s,3,WaitExten(3)
exten => s,4,Dial(SIP/1001&SIP/1002&SIP/1003)
exten => s,5,Hangup
exten => i,1,Dial(SIP/1001&SIP/1002&SIP/1003)
exten => i,2,Hangup
include => internal
include => office-main
include => utilities
include => outbound-46932424

[office-aar1]
exten => s,1,Background(/home/thomas/aarhus)
exten => s,2,DigitTimeout(3)
exten => s,3,WaitExten(3)
exten => s,4,Dial(SIP/1201&SIP/1202&SIP/1203)
exten => s,5,Hangup
exten => i,1,Dial(SIP/1201&SIP/1202&SIP/1203)
exten => i,2,Hangup
include => internal
include => office-main
include => utilities
include => outbound-46932444

[office-main]
exten => 1000,1,Dial(SIP/1001&SIP/1002&SIP/1003)
exten => 1000,2,Hangup
exten => 1100,1,Dial(SIP/1101&SIP/1102&SIP/1103)
exten => 1100,2,Hangup
exten => 1200,1,Dial(SIP/1201&SIP/1202&SIP/1203)
exten => 1200,2,Hangup


; H�je T�strup HT1 outbound via musimi
[outbound-46932400]
exten => _XXXXX.,1,Dial(SIP/${EXTEN}@${outb46932400},30)
exten => _XXXXX.,2,Congestion

; H�je T�strup HT2 outbound via musimi
[outbound-46932424]
exten => _XXXXX.,1,Dial(SIP/${EXTEN}@${outb46932424},30)
exten => _XXXXX.,2,Congestion

; �rhus AAR1 outbound via musimi
[outbound-46932444]
exten => _XXXXX.,1,Dial(SIP/${EXTEN}@${outb46932444},30)
exten => _XXXXX.,2,Congestion


[internal]
exten => _ZX[0-8]X,1,DBget(temp=CFIM/${EXTEN})
exten => _ZX[0-8]X,2,Dial(SIP/${temp})
exten => _ZX[0-8]X,3,Dial(SIP/${EXTEN},20)
exten => _ZX[0-8]X,102,Goto(${EXTEN},3)
exten => _ZX[0-8]X,4,VoiceMail(u${EXTEN})
exten => _ZX[0-8]X,104,VoiceMail(b${EXTEN})
exten => _ZX[0-8]X,5,Hangup

[incoming-from-sip]
exten => 1000,1,Goto(office-ht1,s,1)
exten => 1100,1,Goto(office-ht2,s,1)
exten => 1200,1,Goto(office-aar1,s,1)

[utilities]
include => parkedcalls
include => voicemail
include => conference
include => callforwarding
include => saydigits
include => echotest
include => recording

[voicemail]
exten => 1999,1,VoicemailMain(${CALLERIDNUM})
exten => 1999,2,Hangup

[conference]
exten => 1901,1,MeetMe(1901|D)
exten => 1902,1,MeetMe(1902|D)
exten => 1903,1,MeetMe(1903|D)
exten => 1904,1,MeetMe(1904|D)
exten => 1905,1,MeetMe(1905|D)
exten => 1906,1,MeetMe(1906|D)
exten => 1907,1,MeetMe(1907|D)
exten => 1908,1,MeetMe(1908|D)
exten => 1909,1,MeetMe(1909|D)
exten => 1910,1,MeetMe(1910|D)

[callforwarding]
; Unconditional Call Forward
exten => _*21*X.,1,DBput(CFIM/${CALLERIDNUM}=${EXTEN:4})
exten => _*21*X.,2,Hangup

exten => #21#,1,DBdel(CFIM/${CALLERIDNUM})
exten => #21#,2,Hangup

[saydigits]
exten => _*10*,1,SayDigits(${CALLERIDNUM})
exten => _*10*,2,Hangup

[echotest]
exten => _*11*,1,Playback(demo-echotest)
exten => _*11*,2,Echo
exten => _*11*,3,Playback(demo-echodone)
exten => _*11*,4,Hangup

[recording]
exten => _*12*,1,Wait(2)
exten => _*12*,2,Record(/tmp/asterisk-recording:gsm)
exten => _*12*,3,Wait(2)
exten => _*12*,4,Playback(/tmp/asterisk-recording)
exten => _*12*,5,Wait(2)
exten => _*12*,6,Hangup
