I’m posting this to consolidate a lot of work done by @longqvo and @lgaetz to avoid interruptions in the classroom from external calls during school hours. In this example, outside calls are routed directly to voicemail during the school year, during school hours. Calls to non-classroom phones are allowed through, and those calls can then be forwarded internally to classroom phones if necessary.
This has been a lifesaver for me implementing my first FreePBX system a few months ago. I’m hoping this will help fellow K-12 admins find and build their own without searching all over. I certainly do not take credit for doing this all myself.
Here’s the thread I initially followed
And here is my extensions_custom.conf
built to fit our needs.
[from-did-direct]
include => hsdaytimevm-custom
include => esdaytimevm-custom
include => ext-findmefollow
include => ext-local
[hsdaytimevm-custom]
exten => _1XXX,1,Answer()
same => n,Set(CALLER_ACCOUNTCODE=${DB(AMPUSER/${EXTEN}/accountcode)})
same => n,Set(summer=${EXTENSION_STATE(*271@from-internal)})
same => n,Set(hs_hours=${EXTENSION_STATE(*272@from-internal)})
same => n,Set(acctcode=${REGEX("classroom" ${CALLER_ACCOUNTCODE})})
same => n,GotoIf($[${acctcode} != 1]?SkipForwardVM)
same => n,GotoIf($[${summer} = NOT_INUSE]?SkipForwardVM)
same => n,GotoIf($[${hs_hours} = INUSE]?SkipForwardVM)
same => n(ForwardVM),Voicemail(${EXTEN},u)
same => n,Macro(hangupcall,)
same => n(SkipForwardVM),Goto(from-did-direct-continue,${EXTEN},1)
same => n,Hangup()
[esdaytimevm-custom]
exten => _3XXX,1,Answer()
same => n,Set(CALLER_ACCOUNTCODE=${DB(AMPUSER/${EXTEN}/accountcode)})
same => n,Set(summer=${EXTENSION_STATE(*271@from-internal)})
same => n,Set(es_hours=${EXTENSION_STATE(*274@from-internal)})
same => n,Set(acctcode=${REGEX("classroom" ${CALLER_ACCOUNTCODE})})
same => n,GotoIf($[${acctcode} != 1]?SkipForwardVM)
same => n,GotoIf($[${summer} = NOT_INUSE]?SkipForwardVM)
same => n,GotoIf($[${es_hours} = INUSE]?SkipForwardVM)
same => n(ForwardVM),Voicemail(${EXTEN},u)
same => n,Macro(hangupcall,)
same => n(SkipForwardVM),Goto(from-did-direct-continue,${EXTEN},1)
same => n,Hangup()
[from-did-direct-continue]
include => ext-findmefollow
include => ext-local
I did all of the work in the FreePBX GUI, using Admin > Config Edit.
I created two custom dial plans, one for our high school (ext starting with 1), and one for our elementary school (ext starting with 3). Classroom telephones have an account code (in the extension Advanced tab) that includes “classroom”. I also have multiple time conditions based on high school hours time group, elementary hours time group, and a summer calendar for when we are out of school. The logic on the time conditions may seem a little backwards (at least they do to me), and that has to do with the default BLF Hint settings in the time conditions.
The reason I specified the starting digit for the extensions is because it was causing the inbound test (7777) to fail. More Here. I took this as an opportunity to use the extension to differentiate between the buildings and set school hours individually. Since I don’t have any extensions that start with a 7, this worked for me. Different time conditions could also be applied by setting different account codes on the extensions.
The time condition codes can easily be found after you create a time condition. It is visible next to the name when you open it for editing. ie. my HS time condition is *272
I hope this is useful in the Education category.