; ; Extension configuration file ; OSCON 2007 Version ; Brian Capouch ; First general configuration and global variables [general] ; writeprotect=no ; autofallthrough=yes ; clearglobalvars=no ; [globals] ; These are genericized names for stations and peers STA1=SIP/spa3k FXO=SIP/spa3000 STA2=SIP/ata1 STA3=sip/scom2 REMOTE-USER=IAX2/remote-user REMOTE-OFFICE=IAX2/remote-office AVAILABLE=0 ; Define Macro: Note "macro" is a reserved prefix name ; ; Standard behavior for calling an extension [macro-stdexten]; ; ; Standard extension macro: ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well ; ${ARG2} - Device(s) to ring ; -->Note this assumes extension is same as mailbox number ; exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 sec exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavail send to vm unavail exten => s-NOANSWER,n,Goto(default,s,1) ; If press #, return to start exten => s-NOANSWER,n,Hangup exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to vm busy exten => s-BUSY,n,Goto(default,s,1) ; If press #, return to start exten => s-BUSY,n,Hangup exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer exten => a,1,VoicemailMain(${ARG1}) ; If press *, send to VoicemailMain ; ; END MACRO SECTION [from-outside] ; ; Context for RECEIVING inbound calls from the world. . . ; ; Scenario 4: Incoming PSTN call ; Special 's' extension required for POTS calls exten => s,1,Wait(1) exten => s,n,Answer ; Dial multiple phones exten => s,n,Dial(${STA2}&${STA1},23) ; We get here if nobody picks up ; Send them to generic voicemail box exten => s,n,Voicemail(u${ATTENDANT}) ; Expose inside extensions to incoming callers exten => 1001,1,Macro(stdexten,${EXTEN}, ${STA1}) exten => 1002,1,Macro(stdexten,${EXTEN}, ${STA2}) exten => 1003,1,Macro(stdexten,${EXTEN}, ${STA3}) ; Allow outside callers access to road warrior exten => 2001,1,GoTo(remote-user,2001,1) [inside-extens] ; ; Context for use by internal extensions in an office ; ; Record a message and store in file tempmsg.gsm exten => 7,1,Record(tempmsg.gsm) ; Access Voicemail app exten => 8,1,Voicemailmain(default) exten => 8,n,Hangup ; Scenario 1: Play a simple soundfile exten => 123,1,Playback(hello) exten => 123,n,Hangup ; Scenario 2: Allow calling fron one extension to another exten => 1001,1,Macro(stdexten,${EXTEN},${STA1}) exten => 1002,1,Macro(stdexten,${EXTEN},${STA2}) exten => 1003,1,Macro(stdexten,${EXTEN},${STA3}) ; Scenario 3: allow calls to local exchange and LD exten => _655XXXX,1,Dial(${FXO}/1212${EXTEN}) exten => _1XXXXXXXXXX,1,Dial(${FXO}/${EXTEN}) ; Scenario 5: Allow calls to road warrior exten => 2001,1,GoTo(remote-user,2001,1) ; Context used for Realtime SQL dialplan lookups [testcontext] switch => Realtime/@ [remote-user] ; Generic behavior exten => 2001,1,ChanIsAvail(${REMOTE-USER}) exten => 2001,n,NoOp(${AVAILSTATUS}) exten => 2001,n,NoOp(${AVAILABLE}) exten => 2001,n,GoToIf($[${AVAILSTATUS} = ${AVAILABLE}]?dial:fail) ; Call remote user here exten => 2001,n(dial),Dial(${REMOTE-USER}/${EXTEN}) ; This logic taken in case user is unavailable exten => 2001,n(fail),Voicemail(${EXTEN},u) exten => 2001,n,Hangup