Night Mode that automatically switches back to time conditions
Here is a project that was requested and may be of use to other people. They wanted a code to press to change to the after hours IVR for the rest of the day but not have to remember to turn it back on the next day.
What is happening is every time a call comes in to this route it checks if *27 has been dialed in the last 10 hours. If it has, it sends it to your bypass location (your afterhours IVR I would guess). If it hasn't been pressed in the last 10 hours then it just uses the time condition like normal. I picked 10 hours as that should cover most places full business day if needed.
Example: press *27 at 8:00 am and it will reset to the time condition at 6:00pm. Press it at 4:30 pm and it will reset at 2:30 am.
Send the inbound route to a custom app with this
custom-reset-timecondition,s,1
Put this under [from-internal-custom] in extensions_custom.conf
include => custom-timeconditions
Put this in extensions_custom.conf
[custom-timeconditions]
exten => *27,1,Answer()
exten => *27,n,Set(resettime=${DB(tcreset/resettime)})
exten => *27,n,gotoif($[${resettime} > ${EPOCH}]?30:20)
exten => *27,20,Set(DB(tcreset/resettime)=$[${EPOCH} + 36000])
exten => *27,n,Playback(day&reception&disabled)
exten => *27,n,Hangup()
exten => *27,30,Set(DB(tcreset/resettime)=${EPOCH})
exten => *27,n,Playback(day&reception&enabled)
exten => *27,n,Hangup()
[custom-reset-timecondition]
exten => s,1,gotoif($[${DB(tcreset/resettime)} > ${EPOCH}]?ivr-1,s,1:timeconditions,1,1)
Make sure not to wrap the last line if you cut and paste. (dang BBcode...)
Change ivr-1,s,1 to where you want it to go when the time condition is bypassed. (Your after hours destination)
Change timeconditions,1,1 to the normal time condition
If 10 hours doesn't work then you can change the length of time by changing 36000 to 3600 * the number of hours.
I installed this dialplan mod on one of my machines, works perfectly.... liked it so much i even made it tell the receptionist how long my timecondition reset is in effect (60 minutes here, just for her lunch break) by changing extensions_custom.conf to read -
[custom-timeconditions]
exten => *27,1,Answer()
exten => *27,n,Set(resettime=${DB(tcreset/resettime)})
exten => *27,n,gotoif($[${resettime} > ${EPOCH}]?30:20)
exten => *27,20,Set(DB(tcreset/resettime)=$[${EPOCH} + 3600])
exten => *27,n,Playback(day&reception&disabled&digits/4&digits/60&minutes)
exten => *27,n,Hangup()
exten => *27,30,Set(DB(tcreset/resettime)=${EPOCH})
exten => *27,n,Playback(day&reception&enabled)
exten => *27,n,Hangup()
[custom-reset-timecondition]
exten => s,1,gotoif($[${DB(tcreset/resettime)} > ${EPOCH}]?timeconditions,3,1:timeconditions,1,1)
again - do NOT wrap the last line.
Hey, I realize I'm diggin up a fairly old post here, but I need this functionality and am having issues using it.
It seems to work okay, I set mine up a little differently using 2 separate IVR's a day and night one, with no time conditions, I basically just wanted the ability to be able to switch between IVR's using a hotkey on the operator phone. I don't really care about time restraints, However, using this system, the way I have implemented it is that the time condition is always on Night mode and when the Operator comes in in the morning, she hit's a Day-Mode button, and the DAY ivr is active for the workday "9 hours" and then goes back to night afterwards. This way, on holidays etc we don't have to change anything. If there's a better way to do this let me know.
I realise this is easier to do now with newer versions, but I like ast 1.2 and am sticking with it for a while.
I'm trying to use this as a night mode button to switch between IVR's here's how I have the last line in the script set up...
:exten => s,1,gotoif($[${DB(tcreset/resettime)} > ${EPOCH}]?ivr-5,s,1:ivr-3,s,1)
Unfortunately when I'm using this feature it does not detect when a caller hangs up the phone, it continues to play my IVR 3 times and then hangs up, but until then, the line is busy... any reason for this?
Also, I'm still looking for a simpler way to just switch between IVR's by featurecode...
IE.
*27 Switches to night mode IVR until I enter *28 to switch back to Day IVR.
Thanks for any help in advance.


Member Since:
2006-05-31