;--------------------------------------------------------------------
;Standard dialing macro with function checking.
;--------------------------------------------------------------------
[macro-stdexten] ;
;
exten => s,1,GotoIf(${ODBCget(CF/${ARG1})}?2:3) ;Gets Call Forward Number
exten => s,2,Dial(SIP/${ODBC(CF/${ARG1})}/n) ;Dials the Forwarding Number
;
exten => s,3,ODBCget(SCFE/${ARG1})=${CALLERIDNUM}) ;Sets the nmbr that if they call in it gets forwarded to another nmbr/exten
exten => s,4,GotoIf(${ODBC(SCFE/${ARG1})}?5:6) ;Get Selective Call Forward Number
exten => s,5,Dial(SIP/${ODBCget(SCFN/${ARG1})}/n) ;Selective Call Forward
;
exten => s,6,ODBCget(SCRN/${ARG1})=${CALLERIDNUM}) ;Reads the Database for for nmbrs it should not allow threw.
exten => s,7,GotoIf(${ODBC(SCRN/${ARG1})}?8:9) ;Get Selective Call Rejection Status
exten => s,8,Hangup ;Sends Rejected calls to a all extensions are busy macro.
;
exten => s,9,ODBCget(ACRStatus=ACR/${ARG1})
exten => s,10,GotoIf($ODBC({ACRStatus}=YES?11:12) ;Get Anonymous Call Rejection Status
exten => s,11,Macro(no-callerid)
;
exten => s,12,ODBCget(DNDStatus=DND/${ARG1}) ;Sets the variable for the Do not disturb responce
exten => s,13,GotoIf($ODBC({DNDStatus}=YES?18:14) ;Checks the Database for the status/ responce
;
exten => s,14,ODBCget(LASTCALL/${ARG1})=${CALLERIDNUM}) ;Places Current caller ID into the Database
exten => s,15,Dial(SIP/${ARG1}|${ARG2}|r) ;Dials the extension and waits for the time out
;
exten => s,16,GotoIf(${ODBCget(CFNA/${ARG1})}?16:17) ;Call Forwarding On No Answer
exten => s,17,Dial(SIP/${ODBC(CFNA/${ARG1})}/n) ;Dials the No Answer forward Number
exten => s,18,ODBCget(VMStatus=VM/${ARG1}) ; Checks to see if user has voice mail active or disabled.
exten => s,19,GotoIf(${VMStatus}=YES?20:118) ; If active it goes to voice mail. If not active it goes to busy- call checking macro.
exten => s,20,Voicemail(u${ARG1}) ;Goes to the unavaible Voicemail
exten => s,21,Playback(vm-goodbye) ;Plays Voicemail Goodbye
exten => s,22,Hangup ;Does a hard hangup
;
exten => s,116,GotoIf(${ODBCget(CFB/${ARG1})}?117:118) ;Gets the Call Forwading On Busy status/number
exten => s,117,Dial(Local/${ODBC(CFB/${ARG1})}/n) ;Dials the CallForwarding nmber/exten
;
exten => s,118,Voicemail(b${ARG1}) ;Goes to the Busy Voicemail
exten => s,119,Playback(vm-goodbye) ;Plays Voicemail Goodbye
exten => s,120,Hangup ;Does a hard hangup