extMOHSetter

Click here for the code.


When setting custom music on hold (MOH), you’ll likely encounter that the extension will only use the ‘default’ MOH class with no way to alter this via the FreePBX GUI. More specifically, on outbound calls or extension to extension calling/transfers, the default on-hold music is played instead of the custom MOH. Furthermore you can only set up the custom MOH on inbound routes, ring groups, call queues, or conferences.

There is a setting that can be set via the CLI in one of the asterisk configuration files which does allow for custom or alternate MOH classes to be associated with certain/all extensions. We’ve therefore written a CLI tool that helps automate this alteration. The tool is called from the CLI with this command: extMOHSetter i.e.:

 [root@pbx /]# extMOHSetter /tmp/extensionList.txt MOHClassName 

It uses a simple extension list as the first parameter ( extensionList.txt in the above example), and the second parameter is the MOH Class name which is set via the FreePBX Music On Hold Module.