mirror of
https://github.com/Sea-Haven-Industries/ring-scheduler-3cx.git
synced 2026-05-18 20:20:12 +00:00
Lambda + EventBridge that updates ring group 800 forwarding daily at 8am ET. Uses 3CX V20 XAPI with OAuth2 auth. Dual cron rules for EST/EDT handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
AWSTemplateFormatVersion: "2010-09-09"
|
|
Transform: AWS::Serverless-2016-10-31
|
|
Description: 3CX Ring Group After-Hours Scheduler
|
|
|
|
Parameters:
|
|
Timezone:
|
|
Type: String
|
|
Default: "America/New_York"
|
|
|
|
Globals:
|
|
Function:
|
|
Runtime: python3.12
|
|
Timeout: 30
|
|
MemorySize: 128
|
|
|
|
Resources:
|
|
SchedulerFunction:
|
|
Type: AWS::Serverless::Function
|
|
Properties:
|
|
FunctionName: 3cx-ring-group-scheduler
|
|
Handler: src/handler.handler
|
|
CodeUri: .
|
|
Environment:
|
|
Variables:
|
|
SSM_PREFIX: /3cx-scheduler
|
|
TZ: !Ref Timezone
|
|
Policies:
|
|
- SSMParameterWithSlashPrefixReadPolicy:
|
|
ParameterName: 3cx-scheduler
|
|
Events:
|
|
# EST: 8am ET = 13:00 UTC (Nov-Mar)
|
|
DailyScheduleEST:
|
|
Type: Schedule
|
|
Properties:
|
|
Schedule: cron(0 13 ? * * *)
|
|
Description: "Update 3CX ring group at 8am EST (Nov-Mar)"
|
|
Enabled: true
|
|
# EDT: 8am ET = 12:00 UTC (Mar-Nov)
|
|
DailyScheduleEDT:
|
|
Type: Schedule
|
|
Properties:
|
|
Schedule: cron(0 12 ? * * *)
|
|
Description: "Update 3CX ring group at 8am EDT (Mar-Nov)"
|
|
Enabled: true
|
|
|
|
# SSM Parameters: create these manually via CLI before deploying.
|
|
# See setup instructions in the deploy section below.
|
|
|
|
Outputs:
|
|
FunctionArn:
|
|
Value: !GetAtt SchedulerFunction.Arn
|
|
FunctionName:
|
|
Value: !Ref SchedulerFunction
|