Ctrl K
ring2all.com

Time Conditions Module Documentation

Table of Contents

  1. Module Overview (Technical)
  2. Module Overview (Commercial/Business)
  3. Module Overview (End User/Administrator)
  4. Configuration Fields Reference
  5. Status Modes
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Are Time Conditions?

Time Conditions are routing rules that evaluate whether the current time matches a Time Group's schedule. Based on the result, calls are routed to either a "match" destination or a "no-match" destination.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│                  Time Condition Flow                            │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Inbound Route → Time Condition: "Business Hours Check"        │
│       │                                                         │
│       ▼                                                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                time_condition.lua                        │   │
│  │                                                          │   │
│  │  1. Load condition from public.time_conditions           │   │
│  │  2. Check status (default, forced-match, forced-nomatch) │   │
│  │  3. If default: evaluate Time Group schedules            │   │
│  │  4. If forced: use override status                       │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ├── MATCH ──────────────────────────────────────────────► │
│       │   Route to: Main IVR                                   │
│       │                                                         │
│       └── NO MATCH ───────────────────────────────────────────► │
│           Route to: After-Hours Voicemail                      │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Relationship with Time Groups

Plaintext
┌─────────────────────┐     ┌─────────────────────┐
│    Time Group       │     │   Time Condition    │
│  "Business Hours"   │◄────│  "Main Line Hours"  │
│                     │     │                     │
│  Mon-Fri 9:00-17:00 │     │  Match → Main IVR   │
│  Sat 10:00-14:00    │     │  No Match → VM      │
└─────────────────────┘     │  Toggle: *81        │
                            └─────────────────────┘

Key Tables

TablePurpose
public.time_conditionsCondition definitions
public.time_groupsReferenced time groups
public.time_group_schedulesSchedule entries

Key Files

FileDescription
admin/apps/web/src/modules/timeConditions/Frontend module
admin/apps/web/src/i18n/en/timeConditions.jsonTranslations
telephony/freeswitch/lua/main/xml_handlers/time_condition/time_condition.luaMain handler
telephony/freeswitch/lua/main/xml_handlers/routing/time_condition.luaRouting handler
---

2. Module Overview (Commercial/Business)

Business Value

Time Conditions enable smart time-based routing:

Without Time ConditionsWith Time Conditions
Manual route switchingAutomatic time routing
24/7 same experienceBusiness/after-hours
Staff always neededSelf-service after hours
No holiday handlingAutomatic holiday routing

Use Cases

  1. Business/After-Hours
- Business hours → Main menu

- After hours → Voicemail

  1. Holiday Routing
- Holiday → Closed message

- Normal days → Standard routing

  1. Lunch Break
- Lunch hour → Reduced staffing queue

- Normal hours → All agents

  1. Weekend Support
- Weekdays → Full support

- Weekends → On-call only

Feature Highlights

FeatureBenefit
Time Group ReferenceReusable schedules
Match/No-Match RoutingDual destination
Toggle OverrideManual control (code)
BLF IntegrationVisual status on phones
Auth PINProtected toggle
Multiple Destination TypesExtension, IVR, Queue, etc.
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Create time conditions
  • Link to Time Groups
  • Set match destination (during scheduled time)
  • Set no-match destination (outside scheduled time)
  • Configure toggle feature code
  • Set override status
  • Enable BLF indication

Administrator Workflow

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Creating a Time Condition                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Section: General Information                                   │
│  ├─ Condition Name: "Business Hours Check"                     │
│  ├─ Description: "Routes based on business hours"              │
│  ├─ Time Group: Business Hours                                 │
│  ├─ Context: tc_business_hours (auto-generated)                │
│  └─ Enabled: ✓                                                 │
│                                                                 │
│  Section: Routing Configuration                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ On Match Destination (During Schedule):                   │  │
│  │ ├─ Type: IVR                                              │  │
│  │ └─ Value: Main Menu                                       │  │
│  └───────────────────────────────────────────────────────────┘  │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ On No Match Destination (Outside Schedule):               │  │
│  │ ├─ Type: Voicemail                                        │  │
│  │ └─ Value: General Mailbox                                 │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  Section: Override Settings                                     │
│  ├─ Toggle Code: *81                                           │
│  ├─ Auth PIN: 1234 (optional)                                  │
│  ├─ Status: Default (Auto)                                     │
│  └─ BLF Inverted: Off                                          │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Use Descriptive Names: "Business Hours Check" is clearer than "TC1".
TIP
Toggle Code Convention: Use 81, 82, etc. for easy reference.
CAUTION
Always Set Both Destinations: Ensure match AND no-match are configured.

---

4. Configuration Fields Reference

General Fields

FieldDescriptionExample
Condition NameUnique identifierBusiness Hours Check
DescriptionOptional notesRoutes during work hours
Time GroupSchedule to evaluateBusiness Hours
ContextDialplan contexttc_business_hours

Routing Fields

FieldDescription
On Match ModuleDestination type when matched
On Match ValueSpecific destination
On No Match ModuleDestination type when not matched
On No Match ValueSpecific destination

Destination Types

TypeDescription
ExtensionRoute to extension
IVRRoute to IVR menu
Ring GroupRoute to ring group
QueueRoute to call queue
VoicemailRoute to voicemail
HangupTerminate call

Override Fields

FieldDescriptionDefault
Toggle CodeFeature code to toggleNone
Auth PINPIN for toggle protectionNone
StatusCurrent override statusDefault
BLF InvertedInvert BLF indicationOff
---

5. Status Modes

Status Options

StatusBehavior
Default (Auto)Evaluate Time Group schedules
Forced MatchAlways route to match destination
Forced No MatchAlways route to no-match destination

Toggle Flow

Plaintext
Status: Default (Auto) ──[Dial *81]──► Forced Match
                                            │
                                      [Dial *81]
                                            │
                                            ▼
                                      Forced No Match
                                            │
                                      [Dial *81]
                                            │
                                            ▼
                                      Default (Auto)

BLF Integration

StatusBLF StateBLF Inverted
DefaultOffOn
Forced MatchOnOff
Forced No MatchOnOff
---

6. Common Scenarios & Examples

Scenario 1: Business Hours Routing

Time Condition: "Main Line Hours"
FieldValue
Time GroupBusiness Hours (Mon-Fri 9-5)
Match DestinationMain IVR
No-Match DestinationAfter-Hours Voicemail
Toggle Code81
Result:
  • 9am-5pm weekdays → Main IVR
  • After hours → After-Hours Voicemail
  • User dials 81 → Override toggle

Scenario 2: Holiday Closure

Time Condition: "Holiday Check"
FieldValue
Time GroupHolidays 2026
Match DestinationHoliday Announcement
No-Match Destination(continue to next TC)

Scenario 3: Emergency Override

Time Condition: "Emergency Open"
FieldValue
Time GroupAlways Closed
Match DestinationHangup
No-Match DestinationEmergency Queue
Toggle Code99
Auth PIN5678
Use case: Toggle 99 to force-open during emergencies.

---

7. Limitations & Important Notes

Technical Notes

NOTE
Timezone: Evaluation uses server timezone.
WARNING
Context Conflict: Ensure context names are unique.
WARNING
Missing Time Group: Condition fails if group is deleted.

Best Practices

  1. Name Clearly: Use descriptive condition names
  2. Set Both Destinations: Always configure match AND no-match
  3. Use Toggle Codes: Enable quick override access
  4. Protect with PIN: Secure important toggles
  5. Test Thoroughly: Verify routing at different times
  6. Document Overrides: Track who has toggle access

---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
Always same routeForced status activeCheck status setting
Time not matchingWrong time groupVerify time group schedules
Toggle not workingWrong toggle codeCheck toggle code format
PIN rejectedWrong PINVerify auth PIN
Condition not foundContext mismatchCheck context registration

Diagnostic SQL

List time conditions:

Sql
SELECT id, name, status, 
       destination_match_module, destination_match_value,
       destination_nomatch_module, destination_nomatch_value
FROM public.time_conditions
WHERE domain_id = [domain_id];

Check condition with time group:

Sql
SELECT tc.name as condition, tg.name as time_group, tc.status
FROM public.time_conditions tc
LEFT JOIN public.time_groups tg ON tc.group_id = tg.id
WHERE tc.domain_id = [domain_id];

FreeSWITCH Logs

Bash
# Check time condition evaluation
grep "Time Condition" /var/log/freeswitch/freeswitch.log
grep "time_condition.lua" /var/log/freeswitch/freeswitch.log

---

9. Glossary

TermDefinition
Time ConditionRouting rule evaluating time groups
MatchCurrent time within schedule
No-MatchCurrent time outside schedule
Toggle CodeFeature code to override status
Forced StatusManual override (match/no-match)
BLFBusy Lamp Field - phone status light
ContextDialplan identifier
---

Lua Script Status ✅

Already Fixed (in Time Groups Task)

ScriptStatus
time_condition.lua✅ Uses public.domains, public.time_conditions, public.time_group_schedules (fixed from core. schema)
No additional Lua fixes needed!

---

Documentation last updated: January 2026
AI Assistant

👋 Hello! I'm your Ring2All documentation assistant. I can help you find information about configuring and using the Ring2All PBX platform.

How can I help you today?