====== FreePBX Custom Applications ======
http://www.freepbx.org/support/documentation/module-documentation/custom-extension-and-destinations
**Part 1**: http://mbrevda.blogspot.com/2008/10/miscellaneouscustom-applicationextensio.html
**Part 2**: http://mbrevda.blogspot.com/2008/10/miscellaneouscustom-applicationextensio_16.html
:!: Verify the ''Custom Applications'' and ''Misc Applications'' modules are installed.
When adding custom apps, you can take one of two paths:
* Simply add lines to ''/etc/asterisk/extensions_custom.conf''
* Use the context ''[from-internal-custom]''
* Probably best only for very small apps
* Create a new context, then include it in ''[from-internal-custom]''
* Probably the best method for larger apps
* This is what is shown here
:!: The following example creates an extension to play music on hold.
===== Three Basic Steps =====
^Command Variation ^Comment ^
|MusicOnHold() |Play 'default' class of MoH |
|MusicOnHold(blues) |Play the 'blues' class of MoH |
|MusicOnHold(blues,30)|Play the 'blues' class of MoH for 30 seconds |
First, we need to manually add your new custom context into ''/etc/asterisk/extensions_custom.conf''. To do that, we use the OS console or SSH into the PBX:
ssh -l root pbx
nano /etc/asterisk/extensions_custom.conf
[from-internal-custom]
include => play-moh-blues ; play moh class (blues)
include => play-moh-latin ; play moh class (latin)
; play-moh-blues,s,1 can be used as a custom application
[play-moh-blues]
exten => s,1,Answer
exten => s,2,MusicOnHold(blues)
exten => s,3,Hangup
:!: See ''/etc/asterisk/extensions_custom.conf.sample'' or Google for ideas:
more /etc/asterisk/extensions_custom.conf.sample
Second, we create a Custom Destination for our custom app to make the context available in other menus.
**Admin -> Custom Destinations**
^Field ^Context,Extension,Priority ^
|Custom Destination |play-moh-blues,s,1 |
|Description |Play MoH - Blues |
Finally, we create a Miscellaneous Application:
**Applications -> Misc Applications**
^Description ^Number to Dial ^Destination ^
|Play MoH - Blues |300 |Custom Destinations (Play MoH - Blues) |
:!: Don't forget to click ''Apply'' to reload the Asterisk configuration.
:!: The new custom app will now appear on the ''Feature Code Admin'' page.
===== Exclude an Extension from FreePBX =====
:!: Note that if you follow the above procedure, this is not necessary.
There are times when you will want to reserve an extension from FreePBX to prevent FreePBX from duplicating an extension that you already assigned manually. For that, we use the ''Custom Extension'' module:
**Admin -> Custom Extensions**
^Field ^Content ^
|Custom Extension |Extension number to reserve |
|Description |Description of extension number |
|Notes |Custom App
===== Recordings =====
If you need to play custom sounds or greetings, you need to record them first:
**Admin -> System Recordings**
Recorded announcements are stored here:
/var/lib/asterisk/sounds/custom/
and can be referenced in custom apps like this:
./custom/announcement-name.wav
===== Test IVR =====
**Applications -> Misc Applications**
===== CLI Examples =====
List extensions:
rasterisk -x 'sip show peers'|egrep "^1[0-9]*.*OK.*"|cut -d '/' -f1