...
Action Scripts allow you to write 'mini-programs' that actually chanage change the way your PBX handles calls. In fact all of the Call Routing built into Noojee's PBX is done via Action Scripts.
...
What is a script
Essentially an ActionScript Action Script is a small piece of code written in Java (no NOT JavaScript) that can be used to control how a call is routed. Once you have created an Action Script it becomes part of the PBX's set of Step 'Actions' and can be used in any Route. Not only does the ActionScript allow you to define the routing logic, but you can also provide a mini-UI which is displayed when your Action Script is used in a Route Step. The purpose of the mini-UI is to allow the user to select one or more parameters which are passed to your Action Script at run time.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 Adminsitrator to enter the PIN code that the caller needs to enterextend 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 Scripts 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 you your Script.
You can create a new version of your script at any time by coping the context of your existing Script click the clicking the 'New Script Version' button under 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 in the list of versions under the 'Script' tab and then selecting the 'Make Active' action and clicking the 'Apply' button.
Understanding Action Scripts
Each Route Step Action Script executes in the context of a call. As such you can directly control the Call as it progresses.
...
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.
- Api Action Script
- Disposition Action
- Route Step
- Screen Layout Action
- System Startup Action
- Utility
Api Action Script
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).