All pastes #22604 Raw Edit

darwin35

public text v1 · immutable
#22604 ·published 2005-09-10 22:05 UTC
rendered paste body
[macro-stdexten] ; still working on issues
;
exten => s,1,GotoIf(${DB(CF/${ARG1})}?2:3)                ;Gets Call Forward Number
exten => s,2,Dial(SIP/${DB(CF/${ARG1})}/n)                ;Dials the Forwarding Number
;
exten => s,4,GotoIf(${DB(SCFE/${ARG1})}?5:6)              ;Get Selective Call Forward Number
exten => s,5,Dial(SIP/${DB(SCFN/${ARG1})}/n)              ;Selective Call Forward
;
exten => s,7,GotoIf(${DB(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,Set(${DB(ACRStatus=ACR/${ARG1})
exten => s,10,GotoIf(${ACRStatus}=YES?11:12)              ;Get Anonymous Call Rejection Status
exten => s,11,Macro(no-callerid)
;
exten => s,12,Set(${DB(DNDStatus=DND/${ARG1})             ;Sets the variable for the Do not disturb responce
exten => s,13,GotoIf($DB({DNDStatus}=YES?18:14)           ;Checks the Database for the status/ responce
;
exten => s,14,Set(${DB(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(${DB(CFNA/${ARG1})}?16:17)           ;Call Forwarding On No Answer
exten => s,17,Dial(SIP/${DB(CFNA/${ARG1})}/n)             ;Dials the No Answer forward Number 

exten => s,18,Set(${DB(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(${DB(CFB/${ARG1})}?117:118)         ;Gets the Call Forwading On Busy status/number 
exten => s,117,Dial(Local/${DB(CFB/${ARG1})}/n)           ;Dials the CallForwarding nmber/exten
;
exten => s,118,Set(${DB(CBBStatus=CBB/${ARG1})
exten => s,119,GotoIf(${CBBStatus}=YES?120:121)           ;Checks to see if call back busy is activated. then if activated it
exten => s,120,Macro(busy-callback)			  ;goes to the busy-call back macro below
;
exten => s,121,Voicemail(b${ARG1})                        ;Goes to the Busy Voicemail 
exten => s,122,Playback(vm-goodbye)			  ;Plays Voicemail Goodbye
exten => s,123,Hangup					  ;Does a hard hangup

;If extension does not exist it gives tritone + number unassigned message to unasigned numbers
exten => i,1,Answer
exten => i,n,Playback(the-number-u-dialed,noanswer)
exten => i,n,SayDigits(${ARG1})
exten => i,n,Playback(not-yet-assigned,noanswer)
exten => i,n,Busy
exten => i,n,Hangup
;
[macro-fastbusy]					  ; I use this to send people I dont want to deal with
exten => s,1,Answer
exten => s,2,Wait 1
exten => s,3,Playback(all-circuits-busy)
exten => s,4,Wait(30)
exten => s,5,Hangup
;
[macro-caller-id] 					   ;Checks the status of inbound CallerID and directs the call.
exten => s,1,System(test "${CALLERIDNAME}" = "O")
exten => s,2,GotoIf($[${CALLERIDNUM} = O]?3:102)
exten => s,3,SetCallerIDName("No Caller ID")
exten => s,4,Macro(no-callerid,s,1)                         ;Sends Callers with no id to no-callerid macro below.
exten => s,102,Macro(stdexten,s,12)                         ;landing point with caller id
;
[macro-no-callerid] ; I use this to send people I dont want to deal with
exten => s,1,Answer
exten => s,n,Playback(no-callerid)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Congestion
exten => s,n,Hangup
;
[macro-busy-callback]
exten => s,1,Answer
exten => s,n,Background(exten-busy-callback)
exten => s,n,Background(pres-star-one-for-callback)
exten => s,n,DigitTimeout,5
exten => s,n,ResponseTimeout,1
;
exten => *1,1,Set(${DB(CALLBACK/${SCB}=1)           ; put 1 into this exten callback to indicate active
exten => *1,n,Set(${DB(CALLBACK2/${SCB}=${SCB2})    ; put who is was that called
exten => *1,n,Playback(conf-muted)               ; play some sound to tell the user callback is active
exten => *1,n,Hangup 
; 
; this checks to see if anyone called then calls them first
; when they pick up me back - you might want to check that it's
; a valid internal exten - otherwise the call to a zap chan would
; be at your cost.
; 
exten => h,1,Set(CB=0)                                     ; Set default value for CB (CB =1 callback active)
exten => h,2,Set(CB=CALLBACK/${CALLERIDNUM})             ; Get CB
exten => h,3,Set(CB2=CALLBACK2/${CALLERIDNUM})           ; Get Who called
exten => h,4,NOOP(${CB})                                   ; Display CB (not really required)
exten => h,5,GotoIf($["${CB}" = "1"]?6:99)                 ; Check if CB=1 if it does to the callback stuff at 6 else jump to 99
exten => h,6,NOOP ;Wait(2)
exten => h,7,Set(${DB(CALLBACK/${CALLERIDNUM}=0)              ; set CB to 0 cos we don;t want a loop.
exten => h,8,System(echo "Channel: Local/${CB2}@sip" >/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ; fill the
exten => h,9,System(echo "Context: sip" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback)             ; call file
exten => h,10,System(echo "Extension: ${CALLERIDNUM}" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ;with data
exten => h,11,System(echo "CallerID: ${CB2}" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback)
exten => h,99,NoOp
; 
; you might want to play with timeouts, and perhaps use waitexten...
; 
exten => s,102,Set(CB=0)                                     ; Set default value for CB (CB =1 callback active)
exten => s,103,Set(CB=CALLBACK/${CALLERIDNUM})               ; Get CB
exten => s,104,GotoIf($["${CB}" = "1"]?99:105)                 ; Check if CB=1 if it does tell them they can't else jump to 99
exten => s,105,ResponseTimeout(3)
exten => s,106,Set(SCB=${ARG2},SCB2=${ARG3}) ;we need to set these because you might exit the macro and we need the values.
exten => s,107,Background(vm-tocallback,,,callback-activate) ; play sound jump to callback-activate if key pressed
;
exten => s,99,Playback(you-cant-do-this-there-is-a-callback-already)
exten => s,100,Hangup
; 
; Catch dross
exten => i,1,goto(h,1)
exten => t,1,goto(h,1)
exten => h,1,NoOP
;