Scheduled ring group routing for 3CX phone system
Find a file
2026-05-06 18:11:53 -04:00
.github Add Claude Code review workflow (#9) 2026-05-06 18:11:53 -04:00
config Switch from ring group to queue API for extension 801 2026-04-21 15:11:34 -04:00
src Switch from ring group to queue API for extension 801 2026-04-21 15:11:34 -04:00
.gitignore Fix module import, IAM permissions, and add manual test support 2026-04-03 17:40:58 -04:00
README.md Add README 2026-04-03 17:41:57 -04:00
requirements.txt Update pyyaml requirement from >=6.0 to >=6.0.3 2026-05-02 21:24:32 +00:00
samconfig.toml Switch from ring group to queue API for extension 801 2026-04-21 15:11:34 -04:00
template.yaml Support weekend day shifts (8am-5pm) alongside after-hours 2026-04-07 18:30:39 -04:00

3CX Ring Group Scheduler

AWS Lambda that automatically updates the after-hours and holiday forwarding destinations on a 3CX ring group daily at 8am ET.

How it works

  • Two EventBridge rules fire daily (one for EST, one for EDT) to handle DST
  • Lambda checks if it's actually 8am Eastern — skips if not
  • Reads the weekly schedule from config/schedule.yaml
  • Authenticates to 3CX V20 XAPI via OAuth2
  • Updates the ring group's "office closed" and "holiday" routing

Schedule config

Edit config/schedule.yaml to change the weekly schedule or add exception dates:

ring_group_number: "800"

weekly_schedule:
  Monday: "114"
  Tuesday: "115"
  Wednesday: "114"
  Thursday: "115"
  Friday: "116"
  Saturday: "100"
  Sunday: "100"

exceptions:
  "2026-12-25": "100"

Setup

1. Create 3CX API client

In 3CX Admin Console > Integrations > API, create a new client with XAPI access enabled.

2. Store credentials in SSM

aws ssm put-parameter --name /3cx-scheduler/domain --value "yourcompany.3cx.us" --type SecureString
aws ssm put-parameter --name /3cx-scheduler/client_id --value "your-client-id" --type SecureString
aws ssm put-parameter --name /3cx-scheduler/client_secret --value "your-secret" --type SecureString

3. Deploy

sam build
sam deploy --stack-name ring-scheduler-3cx --resolve-s3 --capabilities CAPABILITY_IAM --parameter-overrides Timezone=America/New_York

Manual invocation

# Run using today's schedule
aws lambda invoke --function-name 3cx-ring-group-scheduler \
  --payload '{"force": true}' \
  --cli-binary-format raw-in-base64-out output.json

# Override to a specific extension
aws lambda invoke --function-name 3cx-ring-group-scheduler \
  --payload '{"force": true, "override_extension": "100"}' \
  --cli-binary-format raw-in-base64-out output.json