[asterisk] Handle inbound and outbound PSTN calls

This commit is contained in:
Correl Roush 2024-11-26 19:30:07 -05:00
parent bb6baa8e0b
commit 196343ba6f
3 changed files with 53 additions and 4 deletions

View file

@ -1,4 +1,45 @@
[incoming]
exten => _.,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] [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() exten => 700,1,Answer()
same = n,Wait(1) same = n,Wait(1)
same = n,Playback(hello-world) same = n,Playback(hello-world)
@ -6,6 +47,7 @@ exten => 700,1,Answer()
same = n,Playback(tt-monkeys) same = n,Playback(tt-monkeys)
same = n,Hangup() same = n,Hangup()
; Other extensions
3-digit extensions dial their associated devices 3-digit extensions dial their associated devices
exten => _XXX,1,Dial(PJSIP/${EXTEN}, 15) exten => _XXX,1,Dial(PJSIP/${EXTEN}, 15)
same = n,Set(MAILBOXES=${PJSIP_ENDPOINT(${EXTEN},mailboxes)}) same = n,Set(MAILBOXES=${PJSIP_ENDPOINT(${EXTEN},mailboxes)})
@ -26,6 +68,8 @@ exten => _XXX*,1,Answer()
same = n,Voicemail(${EXTEN:0:-1}@sailmaker,u) same = n,Voicemail(${EXTEN:0:-1}@sailmaker,u)
same = n,Hangup() same = n,Hangup()
; 7+ digit calls are routed outside via the PSTN [dialout]
exten => _NXXXXXX.,1,Dial(PJSIP/pstn/${EXTEN}) exten => _X!,1,NoOp()
same = n,Verbose(Dialing out to ${EXTEN})
same = n,Dial(PJSIP/${EXTEN}@pstn)
same = n,Hangup() same = n,Hangup()

View file

@ -15,7 +15,7 @@ disallow=all
allow=ulaw allow=ulaw
auth=100 auth=100
aors=100 aors=100
mailboxes=100@sailmaker mailboxes=100@sailmaker,436@sailmaker
[100] [100]
type=auth type=auth
@ -73,11 +73,12 @@ remove_existing=yes
[pstn] [pstn]
type=endpoint type=endpoint
context=from-internal context=incoming
disallow=all disallow=all
allow=ulaw allow=ulaw
auth=pstn auth=pstn
aors=pstn aors=pstn
mailboxes=436@sailmaker
[pstn] [pstn]
type=auth type=auth

View file

@ -588,4 +588,8 @@ european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
;4325 => 2392,Andrew Dufresne,andy@dufresne.info,,imapuser=adufresne|imappassword=rockh@mmer ;4325 => 2392,Andrew Dufresne,andy@dufresne.info,,imapuser=adufresne|imappassword=rockh@mmer
[sailmaker] [sailmaker]
; Primary home mailbox
436 => 436,Weidner Household,
; User mailboxes
100 => 100,Correl Roush, 100 => 100,Correl Roush,