Scripting
Noojee PBX includes a built in Scripting system that allows you to extend the functionally of your Noojee PBX.
The Scripting system allows you to hook into a growing number of interface points within the system.
Current the following hooks are supported:
- Route Step Action Scripts
- Disposition Action Scripts
- Screen Layout Action Scripts
- Utility scripts
- System Startup Action Scripts
- API Action Script
We expect that over time the number of hooks points will expand.
Route Step
Route Steps allow you to extend the way calls are routed into the PBX. Routes Steps are extremely powerful and its worth noting that the entire route logic implemented via Noojee PBX is implemented in Route Steps that you can modify and expand.
There are a large number of Route steps included in the base system. A sample list includes:
- Answer
- Conference Room
- Dial
- Directory
- Hangup
- IVR Menu
- Park
- Play Message
- Queue
- Rewrite
- Set Music On Hold Playlist
- Set Channel Variable
- Start Recording
- Stop Recording
- Voice Mail
- Voice Mail Managment.
The Scripting interface exposes an API that makes it easy to build more scripts including simple interfaces to allow end users to easily configure each script.
To create new Scripts navigate to : Provision | Action Scripts
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 extend your PBX's functionality. In fact all of the Call Routing within your Noojee PBX is done via Route Step Action Scripts, so you have the same level of power and control as the Noojee Developers do.
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.
This page is only meant to be a mini-guide. Full documentation of Action Scripts is on the main Noojee Wiki at 04.1.10 Action Scripts.
What is a script
Essentially a Action Script is a small piece of code written in Java (NOT Javascript) that can be used to extend your Noojee PBX.
There are currently five (5) types of Action Scripts:
- Route Step
- Disposition Action
- Screen Layouts Action
- Utility
- System Startup Action
Each Action Script type allows you to enhance a different aspect of your Noojee PBX.
Why use Action Scripts?
Action Scripts let you extend the core functionality of your Noojee PBX and perhaps more importantly let you connect your Noojee PBX with third party systems.
If you are looking at integration with third party systems you should also look at Noojee's Zapier integration. Zapier allows your Noojee PBX to integrate with over 700 other applications (e.g. Salesforce, Netsuite, Google Docs etc) with any programming.
You might want to validate an account no. captured via an IVR, lookup a customers outstanding balance, send a payment to a Credit Card gateway. The ability of Action Scripts is on limited by your imagination.
Route Steps
Creating your own Route Step Action Scripts allows you to add control to how a call is routed. I might want to request a user to enter a PIN and then use an Action Script to query an external DB to validate that PIN.
A Route Step also you can also provide a mini-UI which is displayed when your Route Step 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 Step at run time.
Disposition Actions
Custom DAs can let you add advanced control logic around how a lead is processed. You might need to consult an external DB to see if a lead should be called again based on data entered by an agent.
Note: Noojee's Zapier integration allows you to trigger external actions as the result of a lead being dispositioned without having to right an Action Script.
Screen Layout Actions
Allow you to extend the Javascript you right in a Screen Layout to call into server side Java code. This can be necessary if you need to securely access a third party system and don't want access tokens exposed to Javascript. It also allows to take advantage of Java's more powerful programming constructs (not to mention the better error handling and compile errors rather than runtime errors).
Utility
A utility Action is a Java Class that can be used by any other Action type. This is really just a place to put common code.
System Startup Action
These actions are called whenever your PBX is restarted and allow you to do any startup processes such as scheduling recurring events.
Api Action Scripts
The Noojee API includes a method to directly call a special type of Action Script called an 'Api Action Script'
By calling an Api Action script you can trigger a route or call any of the exposed Action Script APIs.
The Api Action Script method accepts the name of script to run and a single argument which is passed to the action script as a string.
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.
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. The error system will only ever show the first error in the script so start fixing errors at the top of the file first.