Time Groups Module Documentation
Table of Contents
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Fields Reference
- Time Conditions
- Common Scenarios & Examples
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
---
1. Module Overview (Technical)
What Are Time Groups?
Time Groups define schedules (days and hours) that can be used to control time-based call routing. They are referenced by Time Conditions, which decide where to route calls based on whether the current time matches a Time Group.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Time-Based Routing System │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Time Group: "Business Hours" │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Schedule 1: Mon-Fri, 09:00 - 17:00 │ │
│ │ Schedule 2: Sat, 10:00 - 14:00 │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │ │
│ Referenced by: ▼ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Time Condition: "Main Line Hours" │ │
│ │ │ │
│ │ If MATCH (business hours): │ │
│ │ → Route to Main IVR │ │
│ │ │ │
│ │ If NO MATCH (after hours): │ │
│ │ → Route to After-Hours Voicemail │ │
│ │ │ │
│ │ Override Toggle: *81 │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ time_condition.lua │ │
│ │ │ │
│ │ 1. Get current time │ │
│ │ 2. Query public.time_group_schedules │ │
│ │ 3. Check if current time matches any schedule │ │
│ │ 4. Apply override if set │ │
│ │ 5. Route to match or no-match destination │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Key Tables
| Table | Purpose |
|---|
public.time_groups | Time group definitions | |
public.time_group_schedules | Schedule entries per group | |
public.time_conditions | Routing conditions using groups |
Key Files
| File | Description |
|---|
admin/apps/web/src/modules/timeGroups/ | Frontend module | |
admin/apps/web/src/i18n/en/timeGroups.json | Translations | |
telephony/freeswitch/lua/main/xml_handlers/time_condition/time_condition.lua | Condition handler | |
telephony/freeswitch/lua/main/xml_handlers/routing/time_condition.lua | Routing handler |
---
2. Module Overview (Commercial/Business)
Business Value
Time Groups enable time-based call routing:
| Without Time Groups | With Time Groups |
|---|
| Same routing 24/7 | Business/after-hours | |
| Manual IVR switching | Automatic time routing | |
| No holiday handling | Holiday schedules | |
| Receptionist needed | Self-service navigation |
Use Cases
- Business Hours Routing
- 9-5 → Main IVR
- After hours → Voicemail
- Lunch Break Handling
- 12-1pm → Different queue
- Lunch announcement
- Weekend Routing
- Sat-Sun → On-call extension
- Reduced staffing
- Holiday Schedules
- Closed days → Holiday message
- Specific date ranges
Feature Highlights
| Feature | Benefit |
|---|
| Multiple Schedules | Complex time patterns | |
| Day Selection | Any day combination | |
| Date Ranges | Campaign/holiday limits | |
| Override Toggle | Manual override via code | |
| BLF Integration | Visual status indication | |
| Reusable Groups | Share across conditions |
---
3. Module Overview (End User/Administrator)
What Can You Do?
Time Groups:
- Create named schedule groups
- Add multiple time ranges
- Select days of week
- Set start/end times
- Optional date ranges
Time Conditions:
- Reference Time Groups
- Set match destination
- Set no-match destination
- Configure toggle code
- Manual override
Administrator Workflow
┌─────────────────────────────────────────────────────────────────┐
│ Creating a Time Group │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Section: Time Group Information │
│ ├─ Group Name: "Business Hours" │
│ ├─ Description: "Standard Mon-Fri working hours" │
│ └─ Enabled: ✓ │
│ │
│ Section: Schedules │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Schedule 1 │ │
│ │ ├─ Days: [Mon] [Tue] [Wed] [Thu] [Fri] │ │
│ │ ├─ Start Time: 09:00 │ │
│ │ ├─ End Time: 17:00 │ │
│ │ └─ Date Range: (optional) │ │
│ └───────────────────────────────────────────────────────────┘ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Schedule 2 │ │
│ │ ├─ Days: [Sat] │ │
│ │ ├─ Start Time: 10:00 │ │
│ │ └─ End Time: 14:00 │ │
│ └───────────────────────────────────────────────────────────┘ │
│ [+ Add Schedule] │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Tips
TIP
Multiple Schedules: Use separate schedules for different day/time combos.
TIP
Reuse Groups: One group can be used by multiple conditions.
CAUTION
Time Format: Use 24-hour format (09:00, 17:00).
---
4. Configuration Fields Reference
Time Group Fields
| Field | Description | Example |
|---|
| Group Name | Unique identifier | Business Hours | |
| Description | Optional notes | Mon-Fri 9-5 | |
| Enabled | Group active | On/Off |
Schedule Fields
| Field | Description | Example |
|---|
| Days of Week | Active days | Mon, Tue, Wed... | |
| Start Time | Period begins | 09:00 | |
| End Time | Period ends | 17:00 | |
| Start Date | Optional start | 2026-01-01 | |
| End Date | Optional end | 2026-12-31 |
Day Selection
| Day | Short |
|---|
| Monday | mon | |
| Tuesday | tue | |
| Wednesday | wed | |
| Thursday | thu | |
| Friday | fri | |
| Saturday | sat | |
| Sunday | sun |
---
5. Time Conditions
What Are Time Conditions?
Time Conditions are the routing rules that use Time Groups. They define:
- Which Time Group to evaluate
- Where to route if time matches
- Where to route if time doesn't match
- Optional toggle code for manual override
Time Condition Configuration
| Field | Description |
|---|
| Name | Condition identifier | |
| Time Group | Group to evaluate | |
| Match Destination | Route when time matches | |
| No-Match Destination | Route when time doesn't match | |
| Toggle Code | Feature code for override (81) | |
| Status | Normal / Override On / Override Off |
Override Toggle
Users can dial a feature code to manually override the time condition:
81 → Toggle between override_on and override_off
- override_on: Always routes to match destination
- override_off: Always routes to no-match destination
Normal mode: Routes based on schedule
↓
Dial *81 → Override ON (always match)
↓
Dial *81 → Override OFF (always no-match)
↓
Dial *81 → Normal mode
---
6. Common Scenarios & Examples
Scenario 1: Business Hours
Time Group: "Business Hours"
| Schedule | Days | Time |
|---|
| 1 | Mon-Fri | 09:00 - 17:00 |
Time Condition: "Main Line"
| Setting | Value |
|---|
| Time Group | Business Hours | |
| Match Destination | Main IVR | |
| No-Match Destination | After-Hours Voicemail |
Scenario 2: Extended Weekend Hours
Time Group: "Extended Hours"
| Schedule | Days | Time |
|---|
| 1 | Mon-Fri | 08:00 - 18:00 | |
| 2 | Sat | 10:00 - 14:00 |
Scenario 3: Lunch Break Routing
Time Group: "Lunch Break"
| Schedule | Days | Time |
|---|
| 1 | Mon-Fri | 12:00 - 13:00 |
Time Condition: "Lunch Handling"
| Setting | Value |
|---|
| Time Group | Lunch Break | |
| Match Destination | Lunch Announcement | |
| No-Match Destination | Normal Routing |
Scenario 4: Holiday Closure
Time Group: "Holiday 2026"
| Schedule | Days | Start Date | End Date |
|---|
| 1 | All | 2026-12-24 | 2026-12-26 | |
| 2 | All | 2026-01-01 | 2026-01-01 |
---
7. Limitations & Important Notes
Technical Notes
NOTE
Timezone: Time evaluation uses server timezone.
WARNING
Schedule Overlap: Multiple schedules combine (OR logic).
WARNING
Override Priority: Override status takes precedence over schedules.
Best Practices
- Clear Names: Use descriptive names like "Business Hours"
- Group Reuse: Create generic groups for common patterns
- Test Schedules: Verify time matching works correctly
- Document Holidays: Keep holiday dates updated
- BLF Buttons: Use for quick override indication
---
8. Troubleshooting Tips
Common Issues
| Symptom | Possible Cause | Solution |
|---|
| Wrong routing | Schedule mismatch | Verify time/day settings | |
| Always one route | Override active | Check condition status | |
| Time not matching | Timezone issue | Check server timezone | |
| Group not found | Not enabled | Enable time group |
Diagnostic SQL
List time groups:
SELECT id, name, description, enabled
FROM public.time_groups
WHERE domain_id = [domain_id];
Check schedules:
SELECT g.name, s.day_of_week, s.start_time, s.end_time
FROM public.time_group_schedules s
JOIN public.time_groups g ON s.group_id = g.id
WHERE g.domain_id = [domain_id]
ORDER BY g.name;
Check time conditions:
SELECT name, status, destination_match_value, destination_nomatch_value
FROM public.time_conditions
WHERE domain_id = [domain_id];
FreeSWITCH Logs
# Check time condition evaluation
grep "Time Condition" /var/log/freeswitch/freeswitch.log
grep "time_condition.lua" /var/log/freeswitch/freeswitch.log
---
9. Glossary
| Term | Definition |
|---|
| Time Group | Named collection of schedules | |
| Schedule | Day/time range definition | |
| Time Condition | Routing rule using a time group | |
| Match | Current time within schedule | |
| No-Match | Current time outside schedule | |
| Override | Manual toggle to bypass schedule | |
| Toggle Code | Feature code to switch override |
---
Lua Script Status ✅
Fixed in This Session
| Script | Status |
|---|
time_condition.lua | ✅ Fixed: Changed from core.tenants, core.time_conditions, core.time_group_schedules to public.domains, public.time_conditions, public.time_group_schedules. Also fixed tenant_id to domain_id and update_at to updated_at. |
Lua fixes applied!
---
Documentation last updated: January 2026*