Call Flow Script: Set Office hours via Dial codes

IliasL_3CX

Staff member
Joined
Jun 2, 2014
Messages
147
Reaction score
118

Set PBX departments to in-office, out-of-office, break, or holiday with dial codes.​

This script enforces specific hours for all departments in the PBX, replacing the deprecated office/out-of-office dial codes in Version 20. When you dial the assigned code, it sets all departments to in-office, out-of-office, break time, or holi...
Continue reading the Original Blog Post.
 
Is it possible with 3CX V20 Update 5 Final to modify this script so that the scope is limited to the main-department of the caller?
Yes, it is.

If only one department is to change its status, then the code could be shortened further.

But to keep the changes small replace this code:
C#:
//for all departments
ps.GetAll<Group>().Extract(x=>x.AllowCallService)
.Select(x=>

with this code:
C#:
// only for the caller department
string CallerDepartmentNumber = (MyCall.Caller.DN.GroupMembership.Where( x => x.IsPrimary == true)).First().Group.Number;
ps.GetAll<Group>()
.Where(x => x.Number.Equals(CallerDepartmentNumber))
.Extract(x => x.AllowCallService)
.Select(x =>

Please note: with the original script the status is only changed until the end of the day. If you want this to take longer, increase the number in FromDays(1).
 
I would like to override office hours with "Custom (Live Chat - Text - Calls Menu)" (ForceCustomOperator) - how do I to set the possible options in a script?
 
I would like to override office hours with "Custom (Live Chat - Text - Calls Menu)" (ForceCustomOperator) - how do I to set the possible options in a script?
Apparently this override has not the same effect as "in office", "out of office" or "break time", so I do not need it. I do not yet understand when this goes in effect.
 
Apparently this override has not the same effect as "in office", "out of office" or "break time", so I do not need it. I do not yet understand when this goes in effect.
The only difference is the status of extensions with the enabled option "Schedule / Automatically switch status to Available during office hours." These extensions will not switch their status when the department status is changed using such a script.
 
Hello 3CX Staff and 3CX community,
i would like use these script to switch in/out office hours for specific departments, not on a global level and not for only the department of the caller.

i have for example 4 departments: London, Paris, Roma and Oslo.
The super user of the company would like with dial codes to can switch in/out office hours each department independently.

Personnaly i understand that script is built with C# language, but i don't understand where to find the object that specify the departement, i guess to perform my wish, i need to replace this piece of code:
C#:
//for all departments
ps.GetAll<Group>().Extract(x=>x.AllowCallService)
.Select(x=>

by something like "ps.getlondon" or "ps.getparis" or kind of, to specify the department instead to switch all department at same time.
the example above in this post is usefull but has an impact only for the user dialing the code to 1 department, we would like that same user can control many departments

Does someone know how to achieve this goal?
or can you explain me where i can found the department objects?

a big thanks for your help.
BR
Hugo
 
Hello,
i have found the answers to my questions.

to control only a specific dept,
first identify the dept number via the webconsole-> call handling -> identifiy the dept name at the end of the list and take note of the value "GRP000x"

then create a script using the code from the store and replace this piece of code:
C#:
 //for all departments
                ps.GetAll<Group>().Extract(x=>x.AllowCallService)
                .Select(x=>

by

this code
C#:
//for only one department like GRP0003
                ps.GetAll<Group>()
                .Where(x => x.Number.Equals("GRP0003"))
                .Extract(x=>x.AllowCallService)
                .Select(x=>

do not forget to do the same action for each script you need, open, close, break, holidays and reset.

BR
Hugo
 

Forum statistics

Threads
111,954
Messages
589,921
Members
164,852
Latest member
priya