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.
Action Scripts allow you to write 'mini-programs' that actually change the way your PBX handles calls. In fact all of the Call Routing built into Noojee's PBX is done via Action Scripts.
BE WARNED: Action 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.
What is a script
Essentially an Action Script is a small piece of code written in Java (no NOT JavaScript) that can be used to extend the functionality of your Noojee PBX.
There are several different types of scripts which are designed to extend the systems functionality in different ways. These are detailed later on this page.
Versions
To make your life easier Noojee PBX supports the concept of having multiple version of a given Action Script, 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 your Script.
You can create a new version of your script at any time by clicking the 'New Script Version' button under the 'Script' tab. 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 in the list of versions under the 'Script' tab and then selecting the 'Make Active' action and clicking the 'Apply' button.
Identifying 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.
Occasionally changes in one script will affect another script (particularly if you are using Utility scripts). In these cases you may need to use the 'Compile All Scripts' Action which is an item in the Action menu at the bottom left hand corner of the Action Script page.
Script types
There are a number of different Action script types which provide different extension points for the PBX.
...
Route Step
...
Action
...
Allows a user of the Noojee API call to initiate an action via a URL call. Api Action Scripts can perform such actions as making a phone call.
Disposition Actions
All of Noojee's built in Disposition Actions are built using Disposition Action scripts. You can extend the set of Disposition Actions by creating an Action Script of this type.
Route Step
The most commonly used Action Script. All of the built in Route Steps are built using a Route Step action. You can create your own Route Steps (including a basic UI) and they will become available for the Route screen as just another Route Step.
Each Route Step Action Script executes in the context of a call. As such you can directly control the Call as it progresses.
For example you may create a Route that requires the caller to enter a PIN code. As part of your Action Script you can create the UI that allows the Administrator to enter the PIN code that the caller needs to enter.
Screen Layout Action
This action allows you to call an action Script from a Campaign Template screen layout. These can be used to build highly functional components that make calls to external systems.
System Startup Action
The System Startup Action is automatically called whenever the PBX is restarted. This is great if you need to schedule a regular background task that must survive restarts of the PBX.
Combining System Start Actions with User Space variables (which are persistent across restarts) can result in some interesting applications.
Utility
Utility Action scripts allow you to implement full Java classes which are reusable from any of the above action scripts.
Any common code should be put into a Utility Action script.
If you are implementing an interface to an external system Utilities allow you to neatly wrap all of the interface code up in a neat set of classes (one per Utility class)Scripts provide a means of extending the set of available Route Steps in your PBX.
Action Scripts are written in Java via a built in IDE (very simple one).
For more details read up on Action Scripts here.