day mode / night mode
Tue, 01/01/2008 - 09:15 | day mode / night mode
Periodically it arrises, a customer asks for a feature to manually set daytime and after hours modes on their PBX instead of using a time based schedule. I noticed that recent versions of Thirdlane PBX have a n unused variable called OFFICE_OPEN_OVERRIDE and an example inbound route 's' to illustrate the best way to utilize it.
But what if you want the receptionist to set this variable as part of her duties. It is likely you wont want to give her administrator access to Thirdlane PBX just for this one task. I created some scripts that allow a designated extension to set and unset the OFFICE_OPEN_OVERRIDE global variable for day/night mode.
In my example I lock this privileged feature down to the defined extension OPERATOR (also defined in globals)
So if OPERATOR is set to 1206 then only that extension can execute these scripts.
Simply assign these scripts to a feature extension and dial that extension from the privileged phone.
openoffice
Script Description: Sets the global OPEN_OFFICE_OVERRIDE variable
exten => s,1,Set(MY_CHAN=${CUT(CHANNEL,/,2)})
exten => s,n,Set(MYEXTENSION=${CUT(MY_CHAN,-,1)})
exten => s,n,NoOp(${MYEXTENSION})
exten => s,n,GotoIf($["${MYEXTENSION}" != "${OPERATOR}"]?noauth)
exten => s,n,NoOp(OPEN_OFFICE_OVERRIDE = ${OPEN_OFFICE_OVERRIDE})
exten => s,n,Set(GLOBAL(OPEN_OFFICE_OVERRIDE)=1)
exten => s,n,NoOp(OPEN_OFFICE_OVERRIDE = ${OPEN_OFFICE_OVERRIDE})
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(ha/phone)
exten => s,n,Playback(ha/system)
exten => s,n,Playback(now)
exten => s,n,Playback(is-set-to)
exten => s,n,Playback(ha/open)
exten => s,n,Wait(2)
exten => s,n,Hangup
exten => s,n(noauth),Answer
exten => s,n,Wait(1)
exten => s,n,Playback(pbx-invalid)
exten => s,n,Wait(2)
exten => s,n,Hangup
closeoffice
Script Description: UnSets the global OPEN_OFFICE_OVERRIDE variable
exten => s,1,Set(MY_CHAN=${CUT(CHANNEL,/,2)})
exten => s,n,Set(MYEXTENSION=${CUT(MY_CHAN,-,1)})
exten => s,n,NoOp(${MYEXTENSION})
exten => s,n,GotoIf($["${MYEXTENSION}" != "${OPERATOR}"]?noauth)
exten => s,n,NoOp(OPEN_OFFICE_OVERRIDE = ${OPEN_OFFICE_OVERRIDE})
exten => s,n,Set(GLOBAL(OPEN_OFFICE_OVERRIDE)=)
exten => s,n,NoOp(OPEN_OFFICE_OVERRIDE = ${OPEN_OFFICE_OVERRIDE})
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(ha/phone)
exten => s,n,Playback(ha/system)
exten => s,n,Playback(now)
exten => s,n,Playback(is-set-to)
exten => s,n,Playback(tonight)
exten => s,n,Wait(2)
exten => s,n,Hangup
exten => s,n(noauth),Answer
exten => s,n,Wait(1)
exten => s,n,Playback(pbx-invalid)
exten => s,n,Wait(2)
exten => s,n,Hangup





Tue, 01/01/2008 - 18:27 | variable name correction
the variable should be named OFFICE_OPEN_OVERRIDE instead of the mislabeled OPEN_OFFICE_OVERRIDE
Tue, 05/20/2008 - 21:01 | eeman, does this work as
eeman, does this work as written for MTE?
Wed, 05/21/2008 - 02:45 | it *could* with some
it *could* with some modifications, but there is a fundamental issue with MTE that makes it difficult. Variables do not maintain themselves through restart. If you have to restart MTE for any reason, like upgrading asterisk, then suddenly all these channel variables go back to their default. I've talked with Alex in regards to using DB keys instead of 'if variable is set' as an override in the inbound routes. DB keys persist through system restarts. The same caveat exists with single tenant, the difference is a single tenant knows they need to re-set their day/night setting when they restart. Knowing how to handle 1000 tenants is quite a different problem.
Erik Smith
CTO
BluegrassNet Voice
dCAP
Sat, 05/24/2008 - 16:04 | day /night mode
I am revisiting this feature - your feedback would be helpful
1) should the dialplan code check both the variable and astdb for backward compatibility or should we abondon the global variable approach, document this and use db only? I could probably add code to read db and set the variable when the call comes in so the code in the inbound call handlers does not have to change
2) what would be a best way to report that the override is set? if it is not reported people will set it and forget that the override is on. We could have a script and a feature extension to check the status - would that be enough?
3) I think the main question is this. Should PBX Manager not allow changing the name of the variable (I would remove variable name seector from inbound routes screen replacing it with a yes/no selector or a checkmark for allowing (but not setting) the override) and just have it named internally OPEN_OFFICE_OVERRIDE?
My original idea was that you could set a dirferent variable for each action in inbound scripts (and that is why I did not provide a script for setting the variable(s), leaving it to the users). In retrospect I regret this as it makes it harder to manage and I doubt that many people use this flexibility and most will just have one variable indicating the office is open or closed. Is anyone using this beyond simple open/closed?
4) for MTE the variable could be named something like OPEN_OFFICE_OVERRIDE_tenant - again the will work if the name is hardwired
Best regards,
Alex
Sun, 05/25/2008 - 15:00 | day / night / temp
4) couldnt the key be something like TL/TENANT/${tenant}/office_mode ?
One could set this mode to some value. The inbound route management could look like
[checkbox] execute if office_mode key is set to [textbox]
that would allow more than a binary option.. I could have office_mode carry a few values. The most obvious that come to mind are day / night / temp.
ExecIf($["${DB(TL/TENANT/${tenant}/office_mode)}" = "day"]|from-outside-+15025551212-day,+15025551212,1)
ExecIf($["${DB(TL/TENANT/${tenant}/office_mode)}" = "night"]|from-outside-+15025551212-night,+15025551212,1)
ExecIf($["${DB(TL/TENANT/${tenant}/office_mode)}" = "temp"]|from-outside-+15025551212-temp,+15025551212,1)
Erik Smith
CTO
BluegrassNet Voice
dCAP
Sun, 05/25/2008 - 15:52 | we need an edit feature in
we need an edit feature in the forum :) ...
modification to the code
ExecIf($["${DB(TL/TENANT/${tenant}/office_mode)}" = "day"]|Goto,from-outside-+15025551212-day,+15025551212,1)
Erik Smith
CTO
BluegrassNet Voice
dCAP
Mon, 09/08/2008 - 13:53 | Update to this post.
Is there any new information to this post? We have a client that is looking to have a feature code to set the night service. It is a company that may need to set this during the day because they all have stepped out of the office. Our thought was a programmed key on the phone that sends a feature code. (*??) to set or unset.
It looks as if during this discussion there was progress but I am not sure how to implement this in MTE.
Regards,
Fri, 09/19/2008 - 02:21 | Sorry - did not have time to follow-up
Guys,
Sorry for dropping the ball - I will look at this again when I have a free moment.
Best regards,
Alex
Wed, 10/08/2008 - 21:26 | I am looking forward to see
I am looking forward to see the "temp" implemented.
Any chance for a quick hack for now?
I have a customer who wants to set the route as he pleases.
(No regular lunchtimes)
The I am able to create a feature code so he could dial say *999# and set it on or off
Ofcourse password protected.
Sun, 10/19/2008 - 18:43 | Problems when setting OFFICE_OPEN_OVERRIDE
I'm trying to implement this so what I did is set my main inbound route with 2 actions/time-based handlers. The first says if the office is closed run script tl-menu and go to IVR "Company-Closed", except if OFFICE_OPEN_OVERRIDE is set. The second action says if the office is open, run script tl-menu and go to IVR "Company-Open". When OFFICE_OPEN_OVERRIDE IS NOT set, everything works. When it IS set, I get this error:
Timeout, but no rule 't' in context 'from-outside-redir'
It seems to me that the dialplan logic is wrong in the file inbound.include. This is what I have:
exten => 2402153479,3,GotoIf($["${OFFICE_OPEN_OVERRIDE}" != ""]?7)
...
...
exten => 2402153479,7,NoOp(${EXTEN})
exten => 2402153479,8,GotoIfTime(9:00-17:00,mon-fri,*,*?from-outside-2402153479-vbs-open-hours,${EXTEN},1)
So lets say in the case that it is a Sunday and I have OFFICE_OPEN_OVERRIDE=1, I then jump to the code above. It should fail then. Or am I wrong?
Sun, 01/04/2009 - 05:57 | What would be the best way
What would be the best way to implement such idea using a soft key on the phone if want to change day/ night/ temp status on a polycom phone basically when the assigned key is pressed it should either go to next mode if there only 2 schedules or should ask what mode u want (as call forward button it asks you always, busy, no answer, some idea like that)
I will play around with it soon just want to check if any body tried it already
Or any thoughts
Thanks
Sun, 01/04/2009 - 20:03 | latest polycom firmware lets
latest polycom firmware lets you program softkeys, you would just program the softkey to dial an extension. The admin guide doesnt correctly disclose how to do this, I had to create a ticket with polycom. Below is an example of dialing *8 for call-pickup using a softkey...
efk.version="2"
efk.efklist.1.mname="callpickup"
efk.efklist.1.status="1"
efk.efklist.1.label="Call Pickup"
efk.efklist.1.action.string="*8"
softkey.1.label="Pickup"
softkey.1.action="!callpickup"
softkey.1.enable="1"
softkey.1.precede="0"
softkey.1.use.idle="1"
softkey.1.use.hold="1"
Erik Smith
CTO
BluegrassNet Voice
dCAP