rendered paste body;Selective Call forwarding for up to 5 distinct callers
;By: Aaron Wickware
;Date: 07/29/05
;Notes: WaitExten not implemented, be sure to disable autofallthrough
;
[enter-scfe]
exten => *75,1,GotoIf($["${DB(${CALLERIDNUM}/MAINCOUNT)}" = "0"]?100:2) ; If MAINCOUNT=0 goto priority 100
exten => *75,2,GotoIf($["${DB(${CALLERIDNUM}/MAINCOUNT)}" = ""]?101:3) ; If MAINCOUNT=NULL goto priority 101
exten => *75,3,Goto(add-scfe,*75,2)
exten => *75,100,Goto(scfe-count,1,100)
exten => *75,101,Goto(add-scfe,*75,1)
;
;
[add-scfe]
exten => *75,1,Set(DB(${CALLERIDNUM}/MAINCOUNT)=123450) ;Set Total allowed SCFE's in the Database
exten => *75,2,Set(COUNT=${DB(${CALLERIDNUM}/MAINCOUNT)}) ;Set a channel variable to match
exten => *75,3,Background(scfe-add) ;Playback menu like "Please enter selective call forward number now."
exten => *75,4,Set(TIMEOUT(response)=10)
exten => t,1,Playback(vm-gooodbye)
exten => t,2,Hangup()
exten => i,1,Goto(add-scfe,s,3)
exten => _N.,1,Set(DB(SCFE${CALLERIDNUM}/${COUNT:0:1})=${EXTEN}) ; Add unique SCFE to database
exten => _N.,2,Set(DB(${CALLERIDNUM}/MAINCOUNT)=${COUNT:1}) ; Increment (rather decrease) the SCFE total avail count
exten => _N.,3,Goto(scfe-count,s,1) ; Jump to the counter
;
;
[scfe-count]
exten => s,1,Background(scfe-another) ; Another menu prompt asking us if we want to add another number 1=Y 2=N
exten => s,2,Set(TIMEOUT(response)=10)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup()
exten => i,1,Goto(scfe-count,s,1)
exten => 1,1,GotoIf($["${DB(${CALLERIDNUM}/MAINCOUNT)}" = "0"]?100:2)
exten => 1,2,Goto(add-scfe,*75,2) ; If COUNT is not 0 jump back to add-scfe context at priority *75,2
exten => 2,1,Playback(vm-goodbye) ; If 2 (NO) is entered playback goodbye
exten => 2,2,Hangup()
;
;
exten => 1,100,Playback(scfe-count-exceeded) ; playback message indicating you have 5 scf numbers entered
exten => 1,101,Hangup() ; Hangup