Homepage / Technology / Telecommunications / PBX In A Flash: Custom Dialplans & FreePBX
Google Helpouts – A Help Provider’s Review How Much Water Should I Drink Every Day? Installing Google Wallet on Android Outside the United States Q: Is Spirituality the Opposite of Science? A: Definitely not How to Remove io9’s Space Wasting Sidebar I’d be Leery of Google Keep, Google’s Evernote Competitor FUD and Sensationalism from F-Secure on Android Malware Numbers The Definition of Irony in Web Design Weight Loss Status Update, Day 120 Weight Loss Status Update, Day 60 Weight Loss Status Update, Day 30 Weight Loss & Unconventional Eating Habits Weight Loss Problems Despite Following All the Conventional Wisdom How Strategic Voting Subverts Democracy Response to Vic Toews’ Email re Bill C-30 Privacy Concerns One Million Moms protests sexuality of JC Penny’s new spokesperson Ellen DeGeneres Review: Samsung Sidekick 4G From T-Mobile GoDaddy’s Stance On SOPA Shows Off Their Ignorance In More Ways Than One! Android 472% Malware Increase Scare Is Sensationalist Fix VSFTPD Slow Directory Listings & Timeouts Tablet Computing: Apple Only? Using Linux to Root the Sidekick 4G (Samsung Galaxy Series SGH -T839) Linux Tip: Permanently Disable NumPad Mouse Keys Google Music releases Linux Music Manager! Migrating Openfire Instant Messaging Service PBX In A Flash: Custom Dialplans & FreePBX Android App Review: Remote Desktop For Your Phone! PBX In A Flash: Send Email Using Gmail / Google Apps Android Security Apps Review: Lookout, SeekDroid, Cerberus, Prey & Theft Aware How To Get Amazon’s Free Android Apps From Outside The US Google Music Beta Impressions (vs Subsonic) Swype & SwiftKeyX Android Virtual Keyboards Review Why You Can’t Just Tell Your Computer What You Want It To Do Cellphone Use Is NOT Giving You Cancer Facebook Messages Offering “Unprecedented”? Um, No… Etsy: Great Community Care & Responsiveness! Etsy: Now Worse Than Facebook For Respecting User Privacy? Android: Major Malware Killed Fast & Clean Facebook’s Privacy Breaches And Plans On Exposing More Personal Info Facebook’s New “Like”: Instead Of You, Websites Get To Post Why You Like Them Is Mexico Safe To Visit? Definitely! Cost Of Living In Bucerias CRTC Backpedals On Allowing False News Broadcasting! Facebook: Now With Even Less Social Networking! Pro CRTC Amendment 2010-931 Arguments & Responses How To Install Carrier-Blocked Android Apps Without Rooting Your Phone Take Action On The CRTC’s Amendments To Allow News Broadcasters To Report Opinions Or Lies As Facts Ninjerktsu’s “Carl Sagan and his Fully Armed Spaceship of the Imagination” As A Single Image Puerto Vallarta & Area: Tips For Snowbirds Bucerias: A Snowbird’s Impressions Facebook: Why The Sudden Monetization Push? Facebook Outrage Du Jour: Your Posts Can Be Sold For Ads Handy Android App: FilesAnywhere, A Fax For Your Phone Facebook Apps Can Now Access Your Address & Mobile Number Diaspora – My Impressions Two Months In First Beach Day of 2011, in Bucerias! Handy Android App: Google Voice Callback Free Swype Touchscreen Keyboard For Android Signal Strength Drop – iPhone 4 vs Droid Facebook Privacy & Security Tips Making Google Voice Work After Moving To Canada Implanted Contact Lenses – Best $5000 I *EVER* Spent! Quantum Darwinism! Pantheism, Monotheism, Atheism, And Communication

Technology, Telecommunications

PBX In A Flash: Custom Dialplans & FreePBX

PIAF is a great collection of Asterisk tools, and I'm pretty happy with the fact that someone has collected them all for me and put them together in a decent package.  However if you're wanting to delve a little deeper and get into more complex Asterisk dial plan scripting, it can be a bit of a trial to work out exactly which config files you can safely modify without tanking your existing installation.  The documentation can be hard to find and/or follow, especially since material is often ambiguous as to the version of PIAF.  So I thought I'd share a little of what I've scraped together for those who want to start rolling up their sleeves and tackling their own scripting with Asterisk!

For the record I'm using PIAF based on CentOS 5.6 (32bit), which is based on Asterisk 1.8, and my main self-study material is the incredibly well written Asterisk: The Definitive Guide (May 2011).

The PIAF developers did a good job of leaving hints in the configuration files for people who want to do their own modifications.  Most of the "do not touch!" files have headers like this:

; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make    ;
; custom modifications, details at: http://freepbx.org/configuration_files ;

Most Asterisk references will tell you to edit /etc/asterisk/extensions.conf.  In PIAF, this is a "don't touch" file and gets overwritten by PIAF's FreePBX web interface every time you make a change.  Instead of directly modifying extensions.conf there are a set of secondary files in /etc/asterisk for adding custom modifications that will be appended via the include directive.

For adding my own custom dial plan and context, I edited extensions_custom.conf.  I just scrolled to the bottom, added a new context and started scripting:

[my-test-context] exten => frontEnd,1,Answer()
same => n,Wait(0.5)
same => n,Playback(roc/generic/greeting)
same => n,Hangup()

(I placed my custom recordings in WAV PCM 16bit 8KHz format in the English language default sound directory /var/lib/asterisk/sounds/en/)

For adding custom DID extensions I edited extensions_override_freepbx.conf, which along with extensions_addition.conf specifies your inbound DIDs, SIP/IAX devices and the like.  In extensions_override_freepbx.conf I needed to know both the extension configuration and what should be it's enclosing context.  I determined this by

  • creating an inbound DID,
  • searching for the number in extensions_addition.conf and copying it,
  • scrolling up from the extension to determine it's context,
  • pasting the extension information into extensions_override_freepbx.conf under the same context, and then
  • modifying the copied extension information to suit my needs.

My extensions_override_freepbx.conf looks like this:

[ext-did-0002] ;TEST INBOUND DID
exten => 5556667777,1,Set(__FROM_DID=${EXTEN})
exten => 5556667777,n,Gosub(app-blacklist-check,s,1)
exten => 5556667777,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 5556667777,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 5556667777,n,Set(CALLERPRES()=allowed_not_screened)
exten => 5556667777,n,Set(_RGPREFIX=COG:Carolina OBGYN TEST:)
exten => 5556667777,n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})
exten => 5556667777,n(dest-ext),Goto(my-test-context,frontEnd,1)

I'm sure several of those commands are unnecessary, but I haven't gotten around to playing with those just yet.

And of course you have to reload your configuration files every time you edit them.  I do this from the command line of my box:

$ asterisk -rx "reload"

All that took me a few hours of research, tinkering and experimenting.  I hope this quick summary can save some time for others creating custom dialplans under PBX in a Flash!

Post a Comment

Your email address will not be published. Required fields are marked *