Telephony plugins
Telephony plugins allow you to create more complex call routing and IVRs than the Enswitch web allows, using Asterisk's AGI mechanism. To create a plugin:
- Write your plugin code in any language, as an AGI program as though it were invoked directly from Asterisk's extensions.conf using AGI().
- Some extra Asterisk variables are available for Enswitch-related information. These are set by Enswitch prior to invoking your plugin. Enabling "agi set debug on" in the Asterisk console will show these. If the call was routed to the plugin via a feature prefix, the remainder of the called number after the prefix will be available in the ${ENSWITCH-SUBNUMBER} variable.
- By default, Enswitch will hang up the call once your plugin has finished. To prevent this, set ${ENSWITCH-PLUGIN-DTYPE} and ${ENSWITCH-PLUGIN-DNUMBER} before your plugin exits. The values to set are the same as in the call history CSV export. Enswitch will then route the call to the destination you have set.
- Install your plugin on each Asterisk machine in the cluster. /usr/local/bin is a good directory to put custom code in. Make sure your plugin is executable by the "enswitch" user.
- Log in to the Enswitch web interface.
- Under System » Plugins, create a new plugin.
- Enter a name for your plugin that users will see, the command to execute, and optionally the other settings listed.
- Save the plugin.
- Customers can now route calls to the plugin in the same way as any other Enswitch feature.
Web plugins
Web plugins allow you to integrate third party products and custom solutions into the Enswitch interface. To create a plugin for the new web interface:
- Review the example plugins provided in: /opt/enswitch/current/web/src/plugins/
- Create a directory on the web server(s) for your plugin in: /etc/enswitch/<plugin name>
- Put your plugin's Controller.js and template.html in that directory.
- Under System » Menus, create a menu item with "URL path when clicked" value of: /local/<plugin name>