Making An Applet
Out of the box OpenVBX comes with a set of applets like: dial, hangup, greeting, voicemail, etc. While you can string them together and create some very impressive call flows sometimes you need some custom functionality that you just can’t get out of the pre-existing applets.
Luckily you can write your own applets to extend your version of OpenVBX. This quickstart begins by showing you how to make a simple applet with a prompt and ends with you building a fully functional call screening applet.
If you would like to use the existing applets as reference they can be found in your OpenVBX folder under /plugins/standard/applets
The first step to building your applet is to create a few empty files and directories inside your OpenVBX/plugins/ directory.
You can reuse these files and directories for other applets. So First lets create a directory for the name of your applet inside of the <openvbx>/plugin directory.
mkdir OpenVBX/plugins/hello-monkey
Now we define something about the applet: The applet name, who built it, etc. You define this through a file called plugin.json file.
touch OpenVBX/plugins/hello-monkey/plugin.json
If you’re familiar with json, then this should be a walk through the park, otherwise just copy and paste our example into your favorite text editor.
{
"name" : "Hello Monkey",
"author" : "Mark & Adam",
"description" : "My Favorite Monkey",
"url" : "http://openvbx.org"
}
Since HelloMonkey is an applet we need to add an applets directory.
mkdir -p OpenVBX/plugins/hello-monkey/applets/monkey
Now we’ll create a few files to define the applet: the ui, the twiml and another json file.
touch OpenVBX/plugins/hello-monkey/applets/monkey/ui.php
touch OpenVBX/plugins/hello-monkey/applets/monkey/twiml.php
touch OpenVBX/plugins/hello-monkey/applets/monkey/applet.json
You can download a the code used in this example if you would like: