In search of user KSDPBX regarding DND override

If there was a way to PM a user I’d do that.
In a previous thread titled “Best way to only allow internal calls, on a schedule / DND Override”

KSDPBX wrote the last comment:

I work for a school district too. We haven’t switched over yet to FreePBX, but we’re gearing up to head that way.

In my time of playing around with FreePBX now, I have this functional by using the config editor. Not sure if it’s the way to do it, but it works - I have a custom from-pstn context and that’s where I start my block to check if it’s school hours, then send the caller to voicemail or let it through. That allows other in-district phones to call them with no issue of being sent to voicemail.

I also utilize the account code field, putting a four-digit number in there (the first three digits correspond to the school, the last digit is a 1 to ignore the schedule (if a teacher wants to get calls during the day from parents), or 0 to force the school hours check).

I also work for a school and my PBX skills are low, too low. I’d love to see what the actual “custom from-pstn context” was in your config to get this working.

I’d be super grateful.
Shooter

1 Like

Hey! Nice to see a fellow techie in education.

I’m still in the same position as when I made that comment. Later this morning I can comment back here with the config I have. Not sure if it’s the most efficient method, but it works. How big is your district? We have I think 17 elementary schools, five middle schools, and three high schools.

Some of our teachers like calls to come through during the school day, while others don’t. I actually just finished making a Python GUI to be able to control the override on the fly, so if a teacher calls in and says, “hey, I’m expecting a call from a parent but my phone didn’t ring,” I can quickly change a flag on their extension to let outside calls ring through.

Most excellent. Thanks for helping me out!
I’m on the other end of the spectrum. We are a one-building rural Michigan school district. We even have an island within our district. https://www.glenlakeschools.org/
Since we are so small a receptionist transferring a call through during teaching hours would be ideal for those needing the call, but voicemail is the real need during that time.

1 Like

Looks like a cool place! I took a look at the map and it’s a beautiful-looking area. Here’s my district: https://www.ksd.org/

It will take a little longer to dig up what I have. I have it in a text file somewhere, I had temporarily removed it from my extensions_custom.conf file when doing other testing. Once I find it, or can recreate it, I’ll comment here with that!

How goes the search? Have a good weekend.

Sorry, got distracted and then our admin building had a "soup"er bowl activity, lots of soup going into the weekend.

Here’s what I found. I haven’t tested it in a while like I said, I’m hoping we get a trunk going again for our FreePBX set up. I know Macro is deprecated coming up soon. I had about four variations of this I think. I first made it back when I was in the experimental first few months of FreePBX, so if I sat down and looked at it further, a better way could probably be found. But hopefully it helps as a stepping stone!

The logic I have here is that each of our schools has a location code. Really just used internally for mainly our student SIS to identify each school in the databases. I found it convenient to use for this purpose, but I add a 0 or 1 to the end. So School A’s location code might be 235 and I’ll add a 1 or 0 at the end per extension at that school, dictating whether external calls to that number will be sent straight to voicemail, or be allowed to ring through. I made a Python GUI so I could toggle that last digit per extension on the fly, if a teacher deals with the public a lot and wants calls from the outside to ring into the classroom phone.

[from-pstn-custom]
exten => _509222XXXX,1,NoOp(Checking school hours...)
same => n,Answer()
same => n,Set(finalexten=${EXTEN:-4})
same => n,Set(CALLER_ACCOUNTCODE=${DB(AMPUSER/${finalexten}/accountcode)})
same => n,GoToIf($[ ${CALLER_ACCOUNTCODE:-1} = 1 ]?allowcall)
same => n,GoSub(loc${CALLER_ACCOUNTCODE})

;set hours for school days
same => n(sethours),Noop(in sethours)
same => n,Set(hours_elem_nonwed=8:40-15:17)
same => n,Set(hours_elem_wed=8:40-14:00)
same => n,Set(hours_midl_nonwed=7:50-14:35)
same => n,Set(hours_midl_wed=7:50-13:00)
same => n,Set(hours_high_nonwed=7:45-14:20)
same => n,Set(hours_high_wed=7:45-13:10)
same => n,Gosub(loc${loccode})

;elementary schools
same => n(loc2020),Goto(elemhours)
(the rest of elementary removed because it's basically the same)

;middle schools
same => n(loc2190),Goto(middlehours)
(the rest of middle removed because it's basically the same)

;high schools
same => n(loc2300),Goto(highhours)
(the rest of high removed because it's basically the same)

same => n(elemhours),Noop(in elemhours) ;elementary forwarding check
same => n,GotoIfTime(${hours_elem_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_elem_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(middlehours),Noop(in middlehours) ;middle school forwarding check
same => n,GotoIfTime(${hours_midl_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_midl_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(middlespecial),Noop(in middlespecial) ;middle schools with no Wednesday early release
same => n,GotoIfTime(${hours_midl_nonwed},mon-fri,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(highhours),Noop(in highhours) ;high school forwarding check
same => n,GotoIfTime(${hours_high_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_high_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(loc2020),GoTo(elemhours) ; elementary
(the rest of elementary removed because it's basically the same)

same => n(loc2190),GoTo(middlehours) ; middle
(the rest of middle removed because it's basically the same)

same => n(loc2300),GoTo(highhours) ; high
(the rest of high removed because it's basically the same)

same => n(elemhours),Set(hourscheck=${EXTENSION_STATE(*272@from-internal)})
same => n,GoTo(vmorthrough)

same => n(middlehours),Set(hourscheck=${EXTENSION_STATE(*274@from-internal)})
same => n,GoTo(vmorthrough)

same => n(highhours),Set(hourscheck=${EXTENSION_STATE(*275@from-internal)})
same => n,GoTo(vmorthrough)

same => n(vmorthrough),NoOp(Voicemail or let caller in?)
same => n,GoToIf($[ "${hourscheck}" != "NOT_INUSE" ]?allowcall:gotovm)

same => n(gotovm),Noop(School is in session, send caller to voicemail)
same => n,Voicemail(${finalexten},u)
same => n,Macro(hangupcall,)

same => n(allowcall),Noop(Outside classroom hours, allowing call to ring to classroom)
same => n,GoTo(from-internal,${finalexten},1)
same => n,Hangup()

Actually this may be the latest version I went with:

[from-pstn]
exten => _509222XXXX,1,Noop(Entering user defined context from-pstn in extensions_custom.conf) 
same => n,Set(classext=${EXTEN:-4})
same => n,Set(loccode=${DB(AMPUSER/${classext}/accountcode)})
same => n,Set(ignore=${loccode:-1}) ;ignore flag - if it's 1, ignore (not a classroom); 0 is a classroom
same => n,GotoIf($[ ${ignore} = 1 ]?allowcall:sethours)

;set hours for school days
same => n(sethours),Noop(in sethours)
same => n,Set(hours_elem_nonwed=8:40-15:17)
same => n,Set(hours_elem_wed=8:40-14:00)
same => n,Set(hours_midl_nonwed=7:50-14:35)
same => n,Set(hours_midl_wed=7:50-13:10)
same => n,Set(hours_high_nonwed=7:45-14:20)
same => n,Set(hours_high_wed=7:45-13:10)
same => n,Gosub(loc${loccode})

;elementary schools
same => n(loc2020),Goto(elemhours) ;amistad
same => n(loc2140),Goto(elemhours) ;amon creek
same => n(loc2000),Goto(elemhours) ;canyon view
same => n(loc2040),Goto(elemhours) ;cascade
same => n(loc2050),Goto(elemhours) ;cottonwood
same => n(loc2010),Goto(elemhours) ;eastgate
same => n(loc2030),Goto(elemhours) ;edison
same => n(loc2170),Goto(elemhours) ;fuerza
same => n(loc2070),Goto(elemhours) ;hawthorne
same => n(loc2060),Goto(elemhours) ;lincoln
same => n(loc2150),Goto(elemhours) ;ridge view
same => n(loc2120),Goto(elemhours) ;sage crest
same => n(loc2080),Goto(elemhours) ;southgate
same => n(loc2160),Goto(elemhours) ;sunset view
same => n(loc2090),Goto(elemhours) ;vista
same => n(loc2110),Goto(elemhours) ;washington

;middle schools
same => n(loc2190),Goto(middlehours) ;chinook
same => n(loc2180),Goto(middlehours) ;desert hills
same => n(loc2200),Goto(middlespecial) ;highlands (no Wednesday early release as of 5/5/2022)
same => n(loc2240),Goto(middlehours) ;horse heaven hills
same => n(loc2220),Goto(miedlespecial) ;park (no Wednesday early release as of 5/5/2022)

;high schools
same => n(loc2300),Goto(highhours) ;kamiakin
same => n(loc2350),Goto(highhours) ;kennewick
same => n(loc2310),Goto(highhours) ;southridge

same => n(elemhours),Noop(in elemhours) ;elementary forwarding check
same => n,GotoIfTime(${hours_elem_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_elem_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(middlehours),Noop(in middlehours) ;middle school forwarding check
same => n,GotoIfTime(${hours_midl_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_midl_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(middlespecial),Noop(in middlespecial) ;middle schools with no Wednesday early release
same => n,GotoIfTime(${hours_midl_nonwed},mon-fri,*,*?schoolhours)
same => n,Goto(allowcall)

same => n(highhours),Noop(in highhours) ;high school forwarding check
same => n,GotoIfTime(${hours_high_nonwed},mon&tue&thu&fri,*,*?schoolhours)
same => n,GotoIfTime(${hours_high_wed},wed,*,*?schoolhours)
same => n,Goto(allowcall)

;send the call to voicemail, since it's school hours
same => n(schoolhours),Macro(vm,${classext},BUSY)

;let the call go through to the set, school is out of session or this phone is not a classroom phone
same => n(allowcall),Goto(from-internal,${classext},1)

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.