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

  1. Write your plugin code in any language, as an AGI program as though it were invoked directly from Asterisk's extensions.conf using AGI().
  2. 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.
  3. 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.
  4. 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.
  5. Log in to the Enswitch web interface.
  6. Under System » Plugins, create a new plugin.
  7. Enter a name for your plugin that users will see, the command to execute, and optionally the other settings listed.
  8. Save the plugin.
  9. Customers can now route calls to the plugin in the same way as any other Enswitch feature.