; External VOIP callers
; =====================
[from-voip-external]
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
; Telasip DID
exten => 5037152055,1,NoOp(SIP call to 5037152055 (Telasip DID) from Exten: ${EXTEN})
exten => 5037152055,n,Set(ORIGEXTEN=${EXTEN})
exten => 5037152055,n,Goto(InboundCalls,1)
; Stanaphone DID
exten => 3475342712,1,NoOp(SIP call to 3475342712 (Stanaphone DID) from Exten: ${EXTEN})
exten => 3475342712,n,Set(ORIGEXTEN=${EXTEN})
exten => 3475342712,n,Goto(InboundCalls,1)
; Teliax DID
exten => 5039463658,1,NoOp(IAX call to 5039463658 (Teliax DID) from Exten: ${EXTEN})
exten => 5039463658,n,Set(ORIGEXTEN=${EXTEN})
exten => 5039463658,n,Goto(InboundCalls,1)
; For hangups, we hang up.
exten => h,1,Hangup()
; Although we matched on numbers for extensions, the value of $EXTEN here seems to be different??
; I'm confused. Ah, but stashing it this way in a channel variable DOES work. Good.
; This is cute: it reads all the digits of the originating Caller ID.
;exten => s,n,SayDigits(${ORIGEXTEN})
; Start monitoring of call, in mux'ed high-quality WAV format
exten => InboundCalls,1,Set(CALLFILENAME=${EXTEN:1}-${TIMESTAMP})
exten => InboundCalls,2,Monitor(wav,${CALLFILENAME},m)
; Usually for an inbound call, we want it to go to all the SIP phones in the house
exten => InboundCalls,3,Dial(${SIPPHONES},18,r)
; Voicemail if timeout
exten => InboundCalls,4,VoiceMail(u100@default)
; Voicemail if unavailable
exten => InboundCalls,104,VoiceMail(u100@default)
; I don't think this is needed, but I'll keep it for now
exten => InboundCalls,n,Hangup()
; Outbound domestic calls.
; NXX-XXX-XXXX calls in the US.
[outbound-domestic]
exten => _NXXNXXXXXX,1,NoOp(Outbound domestic call to ${EXTEN})
exten => _NXXNXXXXXX,2,SetCallerId(${HOMENUMBER})
; Record call
exten => _NXXNXXXXXX,3,Macro(record-call)
; Dial the call
exten => _NXXNXXXXXX,4,Dial(${OUTBOUNDDOMESTICTRUNK}/${EXTEN},,r)
; Once call is over, fast busy
exten => _NXXNXXXXXX,5,Congestion()
; If call fails (5+101 = 106), monkeys
exten => _NXXNXXXXXX,105,Playback(tt-monkeys)