Breakdown: cat /etc/asterisk/extensions.conf
[default]
exten => .,1,Hangup() HANGS UP ON ANYTHING THAT COMES IN
5 STEPS
[inbound-schedule]
; #_#_# Phone Number #_#_#
exten => 2242179435,1,Answer ANSWER
exten => 2242179435,n,NoOp(Office-ANI-${EXTEN}) PRINT TO CONSOLE
exten => 2242179435,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}) CUSTOM CDR ENTRY, GET TIME, CALLERID
exten => 2242179435,n,MixMonitor(ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav) CALL RECORDING ON CALL
exten => 2242179435,n,Goto(schedule,${EXTEN},1) SCHEDULE FOR OPEN AND CLOSED HOURS
GOTO(SCHEDULE =WHAT CONTEXT, WHERE ARE WE GOING ${EXTEN},WHAT STEP,1)
exten => .,1,Hangup() HANG UP IF INVALID # DIALED
[schedule]
exten => _NXXNXXXXXX,1,NoOp(Time-of-Day-Routing) MATCH FOR 2242179435
exten => _NXXNXXXXXX,n,GotoIfTime(8:58-17:02,mon-fri,*,*?inbound,${EXTEN},1) OPEN HOURS, OPEN DAYS, ?INBOUND=WHERE DO WE GO,${EXTEN=INBOUND DID},1)
exten => _NXXNXXXXXX,n,Goto(inbound-closed,${EXTEN},1) IF IT DOESN’T MATCH GO TO NEXT STEP
[inbound]
exten => _NXXNXXXXXX,1,NoOp(Office-Open) OFFICE OPEN CONSOLE MESSAGE
exten => _NXXNXXXXXX,n,Set(NUMINVALID=1) SET VARIABLE NUMINVALID LOOP COUNTER ( KICK THEM OUT )
exten => _NXXNXXXXXX,n,Set(TIMEOUT(digit)=3) ; max wait in-between digits seconds
exten => _NXXNXXXXXX,n,Set(TIMEOUT(response)=3) ; max wait for digit entry seconds
exten => _NXXNXXXXXX,n,Ringing PLAY RING
exten => _NXXNXXXXXX,n(menu),Wait(1) IF YOU DO RINGING NEED WAIT
exten => _NXXNXXXXXX,n,Background(custom/open-recording) PLAY CUSTOM/OPEN-RECORDING ** EDIT TO NAME OF CUSTOM RECORDING YOU CREATED**
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Background(custom/open-recording) PLAY CUSTOME/OPEN-RECORDING AGAIN
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Dial(SIP/101,18) Dial extension 101 the receptionist can use (SIP/${EXTEN},18) 18 SECONDS THEN GO TO VOICEMAIL
exten => _NXXNXXXXXX,n,Voicemail(100@default,su) Default voicemail box, and use unavailable message
exten => 0,1,NoOp(Office-Open-Press-Zero)
exten => 0,n,Voicemail(100@default,su)
exten => 2,1,NoOp(Operator-Directory)
exten => 2,n,Directory(default,vm-operator,f) SENDS USER TO COMPANY DIRECTORY
exten => 200,1,NoOp(External-Voicemail-Dial-From-${CALLERID(num)}) UNANNOUNCED OPTION, BACKDOOR TO VOICEMAIL SYSTEM
exten => 200,n,Playback(vm-dialout)
exten => 200,n,Wait(1)
exten => 200,n,VoiceMailMain()
exten => _1XX,1,Macro(local-followme,${EXTEN}) DIAL BY EXTENSION USING LOCAL-FOLLOWME CONTEXT
exten => t,1,Playback(option-is-invalid)
exten => t,n,Hangup()
exten => i,1,Set(NUMINVALID=$[${NUMINVALID}+1]}) HANG UP AFTER 4 OR MORE INVALID OPIIONS
exten => i,n,Playback(option-is-invalid)
exten => i,n,Gotoif($[“${NUMINVALID}” < “4”]?:10) GO TO STEP 10 AFTER 4 INVALID TRIES
exten => i,n,Goto(_NXXNXXXXXX,menu)
exten => i,10,Playback(vm-goodbye) GOODBYE
exten => i,n,Hangup()
[inbound-closed]
exten => _NXXNXXXXXX,1,NoOp(Office-Closed)
exten => _NXXNXXXXXX,n,Set(NUMINVALID=1)
exten => _NXXNXXXXXX,n,Set(TIMEOUT(digit)=3)
exten => _NXXNXXXXXX,n,Set(TIMEOUT(response)=3)
exten => _NXXNXXXXXX,n,Ringing
exten => _NXXNXXXXXX,n(menu),Wait(1)
exten => _NXXNXXXXXX,n,Background(custom/closed-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Background(custom/closed-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Dial(SIP/101,18)
exten => _NXXNXXXXXX,n,Voicemail(100@default,su)
exten => 0,1,NoOp(Office-Open-Press-Zero)
exten => 0,n,Voicemail(100@default,su)
exten => 2,1,NoOp(Operator-Directory)
exten => 2,n,Directory(default,vm-operator,f)
exten => 200,1,NoOp(External-Voicemail-Dial-From-${CALLERID(num)})
exten => 200,n,Playback(vm-dialout)
exten => 200,n,Wait(1)
exten => 200,n,VoiceMailMain()
exten => _1XX,1,Macro(local-followme,${EXTEN})
exten => t,1,Playback(option-is-invalid)
exten => t,n,Hangup()
exten => i,1,Set(NUMINVALID=$[${NUMINVALID}+1]})
exten => i,n,Playback(option-is-invalid)
exten => i,n,Gotoif($[“${NUMINVALID}” < “4”]?:10)
exten => i,n,Goto(_NXXNXXXXXX,menu)
exten => i,10,Playback(vm-goodbye)
exten => i,n,Hangup()
[outbound]
exten => _NXXNXXXXXX,1,Dial(SIP/${EXTEN}@voip-outbound,120,trwW)
exten => _NXXNXXXXXX,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()
[internal]
; #_#_#_#_#_#_#_#_# INTERNAL MAIN CONTEXT #_#_#_#_#_#_#_#_#_#
; Extension to Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
; Call Pickup
exten => _*971XX,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _*971XX,n,Pickup(${EXTEN:2}@PICKUPMARK)
; Voicemail Access
exten => 1000,1,VoiceMailMain(${CALLERID(num)}@default)
exten => 2000,1,VoiceMailMain()
; Outbound Dialing
exten => _NXXXXXX,1,Answer
exten => _NXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}) CUSTOM CDR
exten => _NXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav) RECORD CALL
exten => _NXXXXXX,n,Set(CALLERID(num)=2242179435)
exten => _NXXXXXX,n,Goto(outbound,224${EXTEN},1) HARDCODED AREA CODE
exten => _NXXNXXXXXX,1,Answer
exten => _NXXNXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _NXXNXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=2242179435)
exten => _NXXNXXXXXX,n,Goto(outbound,${EXTEN},1)
exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _1NXXNXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _1NXXNXXXXXX,n,Set(CALLERID(num)=2242179435)
exten => _1NXXNXXXXXX,n,Goto(outbound,${EXTEN:1},1)
exten => t,1,Playback(invalid)
exten => t,n,Hangup()
exten => i,1,Playback(invalid)
exten => i,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()
[macro-local-followme]
exten => s,1,GotoIf($[${DB_EXISTS(followme/${ARG1})}=0]?nofollow)
exten => s,n,GotoIf($[${DB_RESULT:0:1}=0]?nofollow:follow)
exten => s,n(follow),Dial(SIP/${ARG1},20)
exten => s,n,Followme(${ARG1},n) ; Removed sa so no name recording
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(nofollow),Dial(SIP/${ARG1},20)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,1,Voicemail(${ARG1},u) ; I changed b to u. If busy, send to voicemail w/ busy ann
exten => _s-.,1,Goto(s-NOANSWER,1)
[outbound-follow-me]
exten => _NXXNXXXXXX,1,NoOp(follow-me-activated-${EXTEN})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${IF($[ ${LEN(${CALLERID(num)})} = 3]?2242179435:${CALLERID(num)})})
exten => _NXXNXXXXXX,n,Goto(outbound,${EXTEN},1) REDIRECT CALLS TO FOLLOWME EXTENSION
exten => _1NXXNXXXXXX,1,NoOp(follow-me-activated-${EXTEN})
exten => _1NXXNXXXXXX,n,Set(CALLERID(num)=${IF($[ ${LEN(${CALLERID(num)})} = 3]?2242179435:${CALLERID(num)})})
exten => _1NXXNXXXXXX,n,Goto(outbound,${EXTEN:1},1)
exten => _1XX,1,Dial(SIP/${EXTEN},120,t)
exten => _1XX,n,Hangup()
[vm-operator]
exten => o,1,NoOp(operator-zero-out)
exten => o,n,Goto(vm-zero-menu,s,1)
; Direct Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
[vm-zero-menu]
exten => s,1,NoOp(operator-asterisk-out)
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=3)
exten => s,n,Background(custom/vm-operator-recording)
exten => s,n,Wait(3)
exten => s,n,Voicemail(100@default,su)
exten => 0,1,Voicemail(100@default,su)
exten => 1,1,NoOp(Operator-Directory)
exten => 1,n,Directory(default,vm-operator,f)
exten => 2,1,Voicemail(100@default,su)
exten => 3,1,Voicemail(100@default,su)
exten => 4,1,Voicemail(100@default,su)
exten => 5,1,Voicemail(100@default,su)
exten => 6,1,Voicemail(100@default,su)
exten => 7,1,Voicemail(100@default,su)
exten => 8,1,Voicemail(100@default,su)
exten => 9,1,Voicemail(100@default,su)
; Direct Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
exten => t,1,Playback(invalid)
exten => t,n,Hangup()
exten => i,1,Playback(invalid)
exten => i,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()