Change destinations for Day/Night toggles without using the Web Interface

Hey all,

I had a customer that needed to set different cell phones numbers for their on-call night rings. This is how I set it up.

;This block of code allows you to change the number that the night line uses
;Put it in the from-internal-custom.
;You will need to set up a Misc Destination in FreePBX for each Day/Night
;toggle that you use. Then point the night portion of the Day/Night switch
;to that Misc Destination. In my case, since the Day/Night switches are
;*280 through *289, I created Misc Destinations 281 through 289.
;If you dial *280 then a 10-digit number, it will write a database key called
;"DAYNIGHT/N0 and enter the 10 digit number in it. That is what the first block
;code does.
;The second block of code is processed when the night mode of a particular
;Day/Night switch is set to the appropriate Misc Destination. If you set the
;night destination of Day/Night *280 to extension 280, the second block of code
;is executed. If you need steering digits, set the second line, “prefixd” to
;your prefix.
;This will allow your customer to set the cell phone number that night
;calls go to without giving them access to the Web Interface.

exten => _*28XNXXNXXXXXX,1,noop(Sets the day night phone number)
exten => _*28XNXXNXXXXXX,n,Set(index=${EXTEN:3:1})
exten => _*28XNXXNXXXXXX,n,Set(DB(DAYNIGHT/N${index})=${EXTEN:4})
exten => _*28XNXXNXXXXXX,n,Flite(You have set night number ${index} to )
exten => _*28XNXXNXXXXXX,n,saydigits(${DB(DAYNIGHT/N${index})})
exten => _*28XNXXNXXXXXX,n,Flite(You should dial star 2 8 ${index} to activate the night ring.)
exten => _*28XNXXNXXXXXX,n,hangup()

exten => _28X,1,Set(index=${EXTEN:2})
exten => _28X,n,Set(prefixd=91)
exten => _28X,n,Set(dialnumb=${prefixd}${DB(DAYNIGHT/N${index}))
exten => _28X,n,goto(from-internal,${dialnumb},1)
exten => _28X,n,hangup()