This script is an example to show how to use the Night Switch in any call routing script of any user.
How to install it
- Make sure you have the Persistent Variable extension properly installed
- Open Call Routing Manager of the user you want a Night Switch enabled call routing script for
- Create a new ruleusing the GSE
- Import the file NightSwitchEnabledScript.rse from the download package
- Save the rule and exit the GSE
How to use it
Just call the user. If the night switch is off the call will be connected to the user. If the night switch is on you will end up in his voicemail.
How it works
The persistent variable NightSwitch will be initialized. It's global scope makes sure that it can be accessed from any user. The content of the NightSwitch variable will be passed to the exits of the block. If the content is 0 the default exit will be taken, meaning the night switch is off. If the content is 1 the "1" exit will be taken, meaning the night switch is on.
The default value of the night switch is 0, meaning if the NightSwitch variable hasn't been set by any other script before (i.e. the A.1 - Night Switch Manager script) the night switch is off.
Please note that the value of the persistent value is converted into an integer using CInt before being passed into the UseExit variable. This is just to make sure that regardless of what datatype has been passed into the persistent variable, it is used here in the correct data type.
The above mentioned script to manage the status of the night switch can be found here: A.1 - Night Switch Manager
Hint: the Persistent Variables can be used with ANY SwyxWare version. The inlcuded examples and the GSE Action itself however might be stored with the most recent SwyxWare version of the time the Persistent Variable version was released. This means that you might need to use the latest SwyxWare version to be able to open the included GSE Rules (.rse files) and the GSE Action (.ase file) within your GSE.