DAY NIGHT Swicth manually

Status
Not open for further replies.

florentABC

Free User
Basic Certified
Joined
May 20, 2020
Messages
5
Reaction score
0
Hi their,

3CX decide to remove *64 functionnaly in V20. It is really complicate for custumers to use the web client and manually change. I've seen that 3CX as an API :
https://www.3cx.fr/blog/api-call-control-v20/

And the description indicate that we able able to use the code :

Available in V20 Update 1 or 2.

Input the following to deploy the ForcePBXHours sample:

>scriptdev deployall folder=Scripts/ForcePBXHours

It should say that #60 to #64 have been updated.

You may then log into your Web Client as System Owner and go to Admin>Advanced>Call Flow Apps. You will see 5 more CFDs have been created and registered (Update 1 or 2 required, otherwise they will show as unregistered).

Those dial codes can be called from anyone’s dialer to switch the whole system to specific hours.

In V20 the legacy in office/out of office dial code has been removed. Here is an example of a RoutingPoint which implements its equivalent in a multi department model.

Usage:

  • Dial #60 and hang up to reset all departments to default hours operation.
  • Dial #61 and hang up to force all departments to In-office hours.
  • Dial #62 and hang up to force all departments to Out-of office hours.
  • Dial #63 and hang up to force all departments to Break- time.
  • Dial #64 and hang up to force all departments to Holiday-time.

I've a error in Google Cloud environnement when I've tried to setup this API.
Anybody can help ?

Thank you, Florent.
 
I've succed to install the api. I've just remove the google source list from /etc/apt/sources.list.d

I've now a compîle of this API error visible on 3CX
  • Error CS1061: 'Group' does not contain a definition for 'Now' and no accessible extension method 'Now' accepting a first argument of type 'Group' could be found (are you missing a using directive or an assembly reference?)

  • x.OverrideExpiresAt=x.Now(out var utc, out var timezone, out var groupmode);
Any idea ?
 
We are having the same issue with an automatically deployed v20 instance to AWS LightSail. The API installs, and the 'scriptdev deployall folder=Scripts/ForcePBXHours' command runs without error but inside the 3CX Web Portal (Admin > Advanced > Call Processing Script) the error below appears for the newly created scripts.

Compilation Failed! Check console output below

Console output
:[887..890)E: (26,50)-(26,53): Error CS1061: 'Group' does not contain a definition for 'Now' and no accessible extension method 'Now' accepting a first argument of type 'Group' could be found (are you missing a using directive or an assembly reference?)
x.OverrideExpiresAt=x.Now(out var utc, out var timezone, out var groupmode);
 
We are having the same issue with an automatically deployed v20 instance to AWS LightSail. The API installs, and the 'scriptdev deployall folder=Scripts/ForcePBXHours' command runs without error but inside the 3CX Web Portal (Admin > Advanced > Call Processing Script) the error below appears for the newly created scripts.

Compilation Failed! Check console output below

Console output
:[887..890)E: (26,50)-(26,53): Error CS1061: 'Group' does not contain a definition for 'Now' and no accessible extension method 'Now' accepting a first argument of type 'Group' could be found (are you missing a using directive or an assembly reference?)
x.OverrideExpiresAt=x.Now(out var utc, out var timezone, out var groupmode);
Make sure you're on Update 1 of v20.
 
I wanted to test this in my test environment, but I get the same error, even on Update 1. I did a fresh installation to be sure, but no luck.
Any ideas?

/edit: Does this even work on Update 1 yet? Documentation says "Available in V20 Update 1 or 2." So maybe it's not yet implemented?

@ConceptsWeb Have you tried this yourself? Can you confirm that it should work?
 
I wanted to test this in my test environment, but I get the same error, even on Update 1. I did a fresh installation to be sure, but no luck.
Any ideas?
Interesting. I was able to use those.

@TheodorosG_3CX
 
  • Like
Reactions: TheodorosG_3CX
The script indicate SP1 and not update 1.

I've modified the scrip like this and it't ok :

#nullable disable
using CallFlow;
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using System.Linq;
using CallFlow.CFD;
namespace dummy
{
public class ForcePBXOpenedHours : ScriptBase<ForcePBXOpenedHours>
{
public override async void Start()
{
var scriptCompleted = false;
try
{
await Task.Run(async () =>
{
try
{
PhoneSystem ps = MyCall.PS as PhoneSystem;
//in this example, all groups will be overrides to the end of the day in "global" PBX timezone
var PBXLocalTimeEndOfOverride = DateTime.Now.Date+new TimeSpan(23, 59,59);
ps.GetAll<Group>().Where(x=>x.AllowCallService).Select(x=>
{
//WARNING: time check will be available in v20 SP1+
//This script will not be compilable in earlier versions
DateTime utc = DateTime.UtcNow;
TimeZoneInfo timezone = TimeZoneInfo.Local;
//var groupCurrentTime = x.Now(out var utc, out var timezone, out var groupmode);
x.OverrideExpiresAt = TimeZoneInfo.ConvertTime(PBXLocalTimeEndOfOverride, timezone);
x.CurrentGroupHours = GroupHoursMode.ForceOpened;
MyCall.Info($"{x.Name} reset to '{x.CurrentGroupHours}' until {x.OverrideExpiresAt} @ time:utc={utc}, timezone={timezone}, groupmode=DEFAULT");
return x;
}).OMSave();
var result = await MyCall.AssureMedia().ContinueWith(_ => MyCall.PlayPrompt(null, new[] { "Empty.wav", "ST_AVAILABLE_SET" }, PlayPromptOptions.Blocked), TaskContinuationOptions.OnlyOnRanToCompletion).Unwrap();
MyCall.Return(true);
}
catch
{
MyCall.Error("Unexcpected failure");
scriptCompleted = false;
}
finally
{
MyCall.Return(scriptCompleted);
}
});

}
catch
{
MyCall.Critical("Cannot execute call handler");
MyCall.Return(false);
}
}
}
}
 
I'm not sure but it seams that this script will force opened during minimum 24h.
I need a script that can close or open the office without scheduling.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,952
Messages
589,893
Members
164,843
Latest member
sambannoura