ansible/roles/asterisk/templates/extensions.conf.j2
2024-12-10 15:47:42 -05:00

87 lines
2.4 KiB
Django/Jinja

[incoming]
exten => _X.,1,NoOp()
same = n,Verbose(Inbound call to ${EXTEN} detected)
same = n,Set(DIALGROUP(incoming,add)=PJSIP/100)
same = n,Set(DIALGROUP(incoming,add)=PJSIP/101)
same = n,Set(DIALGROUP(incoming,add)=PJSIP/102)
same = n,Dial(${DIALGROUP(incoming)},15)
same = n,Set(MAILBOXES=${PJSIP_ENDPOINT(pstn,mailboxes)})
same = n,ExecIf($[${LEN(${MAILBOXES})} = 0]?Congestion(10))
same = n,Voicemail(${MAILBOXES},uS)
same = n,Playback(vm-goodbye)
same = n,Hangup()
[from-internal]
; Emergency outbound dialing
exten => 911,1,NoOp()
same = n,Goto(dialout,${EXTEN},1)
; Emergency test outbound dialing
; (Doesn't seem to be supported on Verizon FiOS)
exten => 933,1,NoOp()
same = n,Goto(dialout,${EXTEN},1)
; 7+ digit calls are routed outside via the PSTN
exten => _NXXXXXX.,1,NoOp()
same = n,Goto(dialout,${EXTEN},1)
exten => _1NXXXXXX.,1,NoOp()
same = n,Goto(dialout,${EXTEN},1)
; Landline-related extensions
exten => 436,1,NoOp()
same = n,Verbose(Testing inbound calling?)
same = n,Goto(incoming,${EXTEN},1)
exten => *436,1,Answer()
same = n,Wait(1)
same = n,VoicemailMain(436@sailmaker,s)
same = n,Hangup()
; Dummy extensions
exten => 700,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Wait(1)
same = n,Playback(tt-monkeys)
same = n,Hangup()
; Other extensions
; 3-digit extensions dial their associated devices
exten => 100,hint,PJSIP/100
exten => 101,hint,PJSIP/101
exten => 102,hint,PJSIP/102
exten => 500,hint,PJSIP/homeassistant
exten => 500,1,NoOp()
same => n,Dial(PJSIP/homeassistant)
same => n,Hangup()
exten => _XXX,1,NoOp()
same = n,Dial(PJSIP/${EXTEN}, 15)
same = n,Set(MAILBOXES=${PJSIP_ENDPOINT(${EXTEN},mailboxes)})
same = n,Set(MAILBOXES=${REPLACE(MAILBOXES,\,,&)})
same = n,ExecIf($[${LEN(${MAILBOXES})} = 0]?Congestion(10))
same = n,Voicemail(${MAILBOXES})
same = n,Playback(vm-goodbye)
same = n,Hangup()
; Star plus 3-digit extensions dial their associated mailboxes
exten => _*XXX,1,Answer()
same = n,Wait(1)
same = n,VoiceMailMain(${EXTEN:1}@sailmaker)
same = n,Hangup()
; 3-digit extensions plus star go directly to voicemail
exten => _XXX*,1,Answer()
same = n,Wait(1)
same = n,Voicemail(${EXTEN:0:-1}@sailmaker,u)
same = n,Hangup()
[dialout]
exten => _X!,1,NoOp()
same = n,Verbose(Dialing out to ${EXTEN})
same = n,Dial(PJSIP/${EXTEN}@pstn)
same = n,Hangup()