Overview
If you are not a programmer or at least a budding programmer you should now look the other way and pretend you never saw this page.
On the other hand if you think you are a dab hand at programming and want to do some really groovy stuff with your PBX then you have come to the right place.
Route Scripts allow you to write 'mini-programs' that actually chanage the way your PBX handles calls. In fact all of the Call Routing built into Noojee's PBX is done via Route Scripts.
BE WARNED: Route Scripts are extremely powerful and can easily cause your WHOLE PBX TO CRASH.
So don't say you were not warned!
Hopefully you have packed an extra pair of undies, because you are going to need them. So lets get into it.
This page is only meant to be a mini-guide. Full documenation of Routing Scripts is on the main Noojee Wiki.
What is a script
Essentially a Route Script is a small piece of code written in Groovy (a java scripting language) that can be used to control how a call is routed. Once you have created a Route Script it becomes part of the PBX's set of Step 'Actions' and can be used in any Call Route. Not only does the Route Script allow you to define the routing logic, but you can also provide a mini-UI which is displayed when your Route Script is used in a Call Route Step. The purpose of the mini-UI is to allow the user to select one or more parameters which are passed to your Route Script at run time.
For example you may create a Route that requires the caller to enter a PIN code. As part of your Route Script you can create the UI that allows the Adminsitrator to enter the PIN code that the caller needs to enter.
Versions
To make your life easier Noojee PBX supports the concept of having multiple version of a given Route Scripts only one of which is designated as the 'Active' script. This allows you to start working on a script without affecting how your PBX is operating until you are ready to deploy the new version of you Script.
You can create a new version of your script at any time by coping the context of your existing Script click the 'New' button under the 'Script' tab and paste the original script. You can then start making changes which are saved to the new Script version.
Once you are happy with your Script you can make it active by selecting the version if the list of versions under the 'Script' tab and then selecting the 'Make Active' action and clicking the 'Apply' button.
Idenfifying and Fixing errors
As you code your Script the system will automatically compile the script in the background. Any errors will be marked on the applicable line in the left hand margin. Hover you mouse over the error indicator to see the details of the error. Once you fix the problem the error indicator will disappear. The error system will only ever show the first error in the script so start fixing errors at the top of the file first.