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.
- 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.