Dial Rule Restrictions Module Documentation
Table of Contents
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Fields Reference
- Pattern Matching
- Common Scenarios & Examples
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
---
1. Module Overview (Technical)
What Are Dial Rule Restrictions?
Dial Rule Restrictions provide pattern-based call control for both outbound and internal calls. Administrators can create restriction profiles with rules that allow or block calls based on dial patterns, optionally requiring passwords, limiting duration, or playing announcements.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Dial Rule Restrictions System │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Call initiated (outbound or internal) │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Load Class of Service Restriction │ │
│ │ (CoS has dial_rule_restriction_id assigned) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Evaluate Rules (by priority) │ │
│ │ │ │
│ │ Rule 1: Pattern 011* | Allowed: NO │ │
│ │ └─ Match international → BLOCK │ │
│ │ │ │
│ │ Rule 2: Pattern 1900* | Allowed: NO + Announcement │ │
│ │ └─ Match premium → BLOCK + Play message │ │
│ │ │ │
│ │ Rule 3: Pattern 1* | Allowed: YES | Max: 1800 sec │ │
│ │ └─ Match long distance → ALLOW with 30 min limit │ │
│ │ │ │
│ │ Rule 4: Pattern _X. | Allowed: YES │ │
│ │ └─ Fallback → ALLOW all others │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Apply result: ALLOW (with limits) or BLOCK (with message) │
│ │
└─────────────────────────────────────────────────────────────────┘
Key Tables
| Table | Purpose |
|---|
public.dial_rule_restrictions | Restriction profile definitions | |
public.dial_rule_restriction_rules | Individual rules within profiles | |
public.class_of_services | References restriction via dial_rule_restriction_id |
Key Files
| File | Description |
|---|
admin/apps/web/src/modules/dialRuleRestrictions/ | Frontend module | |
admin/apps/web/src/i18n/en/dialRuleRestrictions.json | Translations |
---
2. Module Overview (Commercial/Business)
Business Value
Dial Rule Restrictions enable granular call control:
| Without Dial Rule Restrictions | With Dial Rule Restrictions |
|---|
| All-or-nothing CoS permissions | Pattern-specific control | |
| No call duration limits | Enforce time limits | |
| Silent blocking | Play announcements | |
| No password protection | Require password for patterns |
Use Cases
- Block Premium/900 Numbers
- Block 1-900- patterns
- Play "This number is restricted" message
- International Call Control
- Block all international (011)
- Allow specific countries with password
- Call Duration Limits
- Allow long distance up to 30 minutes
- Play warning before timeout
- Internal Extension Control
- Block certain internal ranges
- Restrict after-hours internal calls
Feature Highlights
| Feature | Benefit |
|---|
| Pattern Matching | FreeSWITCH wildcards | |
| Allow/Block | Permit or deny per pattern | |
| Announcements | Custom audio for blocked calls | |
| Duration Limits | Max call time per pattern | |
| Password Requirement | PIN to bypass restriction | |
| Priority Ordering | Control rule evaluation | |
| Direction Type | Separate outbound vs internal |
---
3. Module Overview (End User/Administrator)
What Can You Do?
- Create restriction profiles with multiple rules
- Allow or block specific dial patterns
- Set maximum call durations
- Require passwords for certain patterns
- Play custom announcements
- Assign profiles to Class of Service
Administrator Workflow
┌─────────────────────────────────────────────────────────────────┐
│ Creating a Dial Rule Restriction │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Profile Information │
│ ├─ Name: "Standard Restrictions" │
│ ├─ Description: "Block premium, limit long distance" │
│ └─ Enabled: ✓ │
│ │
│ Step 2: Add Rules │
│ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Rule 1 (Priority 1) - Block Premium │ │
│ │ ├─ Type: Outbound │ │
│ │ ├─ Pattern: 1900* │ │
│ │ ├─ Allowed: ✗ │ │
│ │ └─ Announcement: premium_blocked.wav │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Rule 2 (Priority 2) - Block International │ │
│ │ ├─ Type: Outbound │ │
│ │ ├─ Pattern: 011* │ │
│ │ ├─ Allowed: ✗ │ │
│ │ └─ Announcement: international_blocked.wav │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Rule 3 (Priority 3) - Limit Long Distance │ │
│ │ ├─ Type: Outbound │ │
│ │ ├─ Pattern: 1* │ │
│ │ ├─ Allowed: ✓ │ │
│ │ ├─ Max Duration: 1800 seconds (30 min) │ │
│ │ └─ Play Max Duration: ✓ │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Rule 4 (Priority 4) - Allow Everything Else │ │
│ │ ├─ Type: Outbound │ │
│ │ ├─ Pattern: _X. │ │
│ │ └─ Allowed: ✓ │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
│ Step 3: Save and Assign to Class of Service │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Tips
TIP
Priority Order: Rules are evaluated top-to-bottom—put specific patterns before wildcards.
TIP
Always Add Fallback: Include a catch-all rule at the end.
CAUTION
Pattern Overlap: More specific patterns should have higher priority (lower number).
---
4. Configuration Fields Reference
Profile Fields
| Field | Description | Example | Required |
|---|
| Name | Profile identifier | Standard Restrictions | Yes | |
| Description | Purpose notes | Block premium | No | |
| Enabled | Profile active status | On/Off | Yes |
Rule Fields
| Field | Description | Example |
|---|
| Type | Call direction | Outbound, Internal | |
| Pattern | Dial pattern to match | 1900, 011, _X. | |
| Allowed | Allow or block | On = Allow, Off = Block | |
| Announcement | Audio for blocked calls | premium_blocked.wav | |
| Play Max Duration | Announce duration limit | On/Off | |
| Max Duration (sec) | Time limit in seconds | 1800 | |
| Require Password | PIN to proceed | On/Off | |
| Priority | Rule evaluation order | 1, 2, 3... | |
| Enabled | Rule active status | On/Off |
---
5. Pattern Matching
FreeSWITCH Pattern Syntax
| Pattern | Matches | Example |
|---|
| Zero or more characters | 1900 matches 1-900-xxx-xxxx | |
_X. | Any digit, one or more | Matches any number | |
_X | Any single digit | 0-9 | |
_Z | Digits 1-9 | Not 0 | |
_N | Digits 2-9 | Not 0 or 1 | |
[list] | Character set | [0-9] |
Common Patterns
| Purpose | Pattern |
|---|
| International (011) | 011 | |
| Premium (1-900) | 1900 | |
| Toll-free (1-800) | 1800, 1888, 1877 | |
| Long distance (1+) | 1 | |
| Local (7/10 digit) | _NXXXXXX, _NXXNXXXXXX | |
| All calls | _X. | |
| Internal 3-digit | _XXX | |
| Internal 4-digit | _XXXX |
---
6. Common Scenarios & Examples
Scenario 1: Block Premium and International
Profile: "Standard Employee"
| Priority | Pattern | Allowed | Description |
|---|
| 1 | 1900 | No | Block premium | |
| 2 | 1976 | No | Block expensive | |
| 3 | 011 | No | Block international | |
| 4 | _X. | Yes | Allow all else |
Scenario 2: International with Password
Profile: "International with Override"
| Priority | Pattern | Allowed | Password | Description |
|---|
| 1 | 1900 | No | - | Block premium always | |
| 2 | 011 | Yes | ✓ | International with PIN | |
| 3 | _X. | Yes | - | Allow all else |
Scenario 3: Call Duration Limits
Profile: "Time-Limited"
| Priority | Pattern | Allowed | Max Duration | Description |
|---|
| 1 | 1 | Yes | 1800 sec | 30 min long distance | |
| 2 | 011 | Yes | 600 sec | 10 min international | |
| 3 | _X. | Yes | - | Unlimited local |
Scenario 4: Internal Extension Controls
Profile: "Lobby Phone"
| Priority | Type | Pattern | Allowed | Description |
|---|
| 1 | Internal | 1 | Yes | Allow 1xx extensions | |
| 2 | Internal | _X. | No | Block other internal | |
| 3 | Outbound | 911 | Yes | Allow emergency | |
| 4 | Outbound | _X. | No | Block all external |
---
7. Limitations & Important Notes
Technical Limitations
WARNING
First Match Wins: Only the first matching rule is applied.
WARNING
Profile Assignment: Restrictions must be assigned to Class of Service.
Best Practices
- Priority Order: Specific patterns first, wildcards last
- Fallback Rule: Always include catch-all at end
- Test Patterns: Verify pattern matching before production
- Document Rules: Use descriptions for clarity
- Announce Blocks: Play message instead of silent hangup
Rule Evaluation
IMPORTANT
Rules are evaluated by priority (1 = first). The first matching rule determines the action.
---
8. Troubleshooting Tips
Common Issues
| Symptom | Possible Cause | Solution |
|---|
| Calls always blocked | Wrong priority order | Put allow rules before block wildcards | |
| Calls not limited | Duration not enabled | Check Play Max Duration toggle | |
| Wrong pattern matched | Pattern overlap | Adjust priorities | |
| No announcement | Audio file missing | Verify file exists |
Diagnostic SQL
List restrictions:
SELECT r.id, r.name, r.enabled,
(SELECT COUNT(*) FROM public.dial_rule_restriction_rules
WHERE dial_rule_restriction_id = r.id) as rule_count
FROM public.dial_rule_restrictions r
WHERE r.domain_id = [domain_id];
Check rules:
SELECT direction, pattern, allowed,
max_duration_seconds, require_password, priority
FROM public.dial_rule_restriction_rules
WHERE dial_rule_restriction_id = [restriction_id]
ORDER BY priority;
---
9. Glossary
| Term | Definition |
|---|
| Dial Rule Restriction | Profile containing pattern-based rules | |
| Pattern | Dial string match using FreeSWITCH wildcards | |
| Priority | Order in which rules are evaluated | |
| Max Duration | Time limit for calls matching pattern | |
| Announcement | Audio played when call is blocked | |
| Password Requirement | PIN needed to bypass restriction | |
| Direction | Outbound (external) or Internal |
---
Lua Handler Status
⚡ No Dedicated Handler Required
Dial Rule Restrictions is a configuration module. The restriction rules are consumed by the main routing engine during call processing. No dedicated Lua handler exists—the routing engine evaluates rules based on the caller's Class of Service assignment.
---
Documentation last updated: January 2026