Ctrl K
ring2all.com

Class of Services 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. Permission System
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Is Class of Service?

Class of Service (CoS) is the central permission system that controls what features and calling capabilities are available to extensions. It aggregates three key components:

  1. Feature Code Category → Which dialpad features (XX) are available
  2. Dial Rule Restrictions → Which numbers can/cannot be dialed
  3. ARS Profile → Which outbound routes are used

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Class of Service System                            │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │               Class of Service                            │  │
│  │               "Executive"                                 │  │
│  ├───────────────────────────────────────────────────────────┤  │
│  │                                                           │  │
│  │  Feature Code Category ─────────► Advanced Features       │  │
│  │  (What *XX can they dial?)        *67, *69, *72, *92...  │  │
│  │                                                           │  │
│  │  Dial Rule Restrictions ─────────► Executive              │  │
│  │  (What numbers can they call?)    Allow international    │  │
│  │                                                           │  │
│  │  ARS Profile ────────────────────► Primary Routing        │  │
│  │  (Which carriers/routes?)         Best rate routing      │  │
│  │                                                           │  │
│  └───────────────────────────────────────────────────────────┘  │
│                          │                                      │
│                          ▼                                      │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │               Extensions                                  │  │
│  │                                                           │  │
│  │   101 (CEO) ─────────────────────────► Executive CoS     │  │
│  │   102 (CFO) ─────────────────────────► Executive CoS     │  │
│  │   200 (Sales Manager) ───────────────► Manager CoS       │  │
│  │   201-220 (Sales Team) ──────────────► Standard CoS      │  │
│  │   300-320 (Support Team) ────────────► Standard CoS      │  │
│  │                                                           │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.class_of_servicesCoS definitions
public.sip_extensionsReferences CoS via class_of_services_id
public.feature_code_categoriesFeature groupings
public.dial_rule_restrictionsDial restrictions
public.ars_profilesOutbound routing

Key Files

FileDescription
admin/apps/web/src/modules/classOfServices/Frontend module
admin/apps/web/src/i18n/en/classOfServices.jsonTranslations
telephony/freeswitch/lua/resources/functions/cos_utils.luaCoS permission checks

Lua Integration

CoS is referenced in 40+ Lua scripts for permission checks:

Lua
-- Example: Check if feature code is allowed
local sql = string.format([[
    SELECT class_of_services_id FROM public.sip_extensions
    WHERE extension = '%s' AND domain_id = %s
]], extension, domain_id)
dbh:query(sql, function(row)
    cos_id = row.class_of_services_id
end)

-- Then check if feature is in allowed category for this CoS

---

2. Module Overview (Commercial/Business)

Business Value

Class of Service enables tiered permission management:

Without CoSWith CoS
Same permissions for allRole-based access
Per-extension configurationTemplate-based configuration
Manual updates everywhereUpdate once, apply everywhere
No feature controlGranular feature access

Use Cases

  1. Role-Based Access
- Executive: Full access

- Manager: Advanced features

- Employee: Standard features

- Lobby/Guest: Basic only

  1. Cost Control
- Block premium numbers by tier

- Limit international to approvers

- Route to cheapest carriers

  1. Compliance
- Restrict call recording by role

- Block spy features to authorized users

- Audit trail per permission level

Feature Highlights

FeatureBenefit
Feature CategoriesControl dialpad features
Dial RestrictionsControl destination access
ARS ProfilesControl carrier routing
Default ClassAuto-assign to new extensions
Enable/DisableSuspend without deletion
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Create permission profiles (CoS)
  • Link Feature Categories for feature access
  • Link Dial Restrictions for call control
  • Link ARS Profiles for routing
  • Set default CoS for new extensions
  • Assign CoS to extensions

Administrator Workflow

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Creating a Class of Service                        │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Step 1: Basic Information                                      │
│  ├─ Name: "Standard Employee"                                  │
│  ├─ Description: "Standard calling permissions for staff"     │
│  └─ Default Class: ✓ (optional - for new extensions)          │
│                                                                 │
│  Step 2: Permissions & Restrictions                             │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Feature Code Category                                     │  │
│  │ └─ "Basic Features" (caller ID, DND, call return)        │  │
│  │                                                           │  │
│  │ Dial Rule Restrictions                                    │  │
│  │ └─ "Standard Restrictions" (block premium/intl)          │  │
│  │                                                           │  │
│  │ ARS Profile                                               │  │
│  │ └─ "Standard Routing" (default carriers)                 │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  Step 3: Save and Enable                                        │
│                                                                 │
│  Step 4: Assign to Extensions                                   │
│  └─ Edit Extensions → Select CoS: "Standard Employee"         │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Default Class: Set one CoS as default for automatic assignment to new extensions.
TIP
Descriptive Names: Use role-based names (Executive, Manager, Standard).
CAUTION
Cascading Changes: Modifying a CoS affects all extensions using it.

---

4. Configuration Fields Reference

CoS Fields

FieldDescriptionExampleRequired
Class NameUnique identifierStandard EmployeeYes
DescriptionPurpose notesStaff calling permissionsNo
Feature Code CategoryWhich features allowedBasic FeaturesNo
Dial RestrictionWhich patterns blockedStandard RestrictionsNo
ARS ProfileWhich routes usedStandard RoutingNo
Default ClassAuto-assign to new extOn/OffNo
EnabledCoS active statusOn/OffYes

Field Relationships

FieldNull Behavior
Feature Code Category = NULLAll features allowed
Dial Restriction = NULLNo dial restrictions
ARS Profile = NULLDefault routing
---

5. Permission System

Permission Hierarchy

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│                    Permission Check Flow                        │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  User dials a number/feature code                               │
│       │                                                         │
│       ▼                                                         │
│  1. Get user's Class of Service                                 │
│     SELECT class_of_services_id FROM public.sip_extensions      │
│       │                                                         │
│       ▼                                                         │
│  2. Is it a feature code (*XX)?                                 │
│     ├─ YES: Check Feature Code Category                        │
│     │   └─ Is feature in assigned category?                    │
│     │       ├─ YES → Allow feature                             │
│     │       └─ NO → "Feature not allowed"                      │
│     │                                                           │
│     └─ NO: It's an outbound number                             │
│       │                                                         │
│       ▼                                                         │
│  3. Check Dial Rule Restrictions                                │
│     ├─ Pattern blocked? → Block call                           │
│     ├─ Pattern allowed with limit? → Allow with duration       │
│     └─ Pattern allowed? → Proceed                              │
│       │                                                         │
│       ▼                                                         │
│  4. Get ARS Profile for routing                                 │
│     └─ Select carrier/route based on ARS rules                 │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

---

6. Common Scenarios & Examples

Scenario 1: Corporate Hierarchy

CoSFeature CategoryDial RestrictionsARS Profile
ExecutiveAll FeaturesNo RestrictionsPremium Routing
ManagerAdvancedInternational AllowedStandard Routing
EmployeeBasicDomestic OnlyStandard Routing
LobbyMinimalEmergency OnlyStandard Routing

Scenario 2: Call Center Tiers

CoSFeaturesRestrictionsNotes
Agent Tier 1Basic callingLocal onlyNew agents
Agent Tier 2+ Transfers+ Long distanceExperienced
Supervisor+ Spy modesFull accessTeam leads

Scenario 3: Multi-Location

CoSFeaturesRestrictionsARS Profile
NYC OfficeStandard-NYC Carriers
LA OfficeStandard-LA Carriers
RemoteStandardLimitedVoIP Only
---

7. Limitations & Important Notes

Technical Limitations

WARNING
One CoS Per Extension: Each extension can only have one Class of Service.
WARNING
Cascading Impact: Changes to a CoS affect all assigned extensions.

Best Practices

  1. Plan First: Design CoS structure before creating
  2. Document Purpose: Use clear descriptions
  3. Test Thoroughly: Verify permissions work correctly
  4. Minimize Classes: Use as few as needed
  5. Set Default: Always have a default CoS

Default CoS Rules

IMPORTANT
Only One Default: Only one CoS can be marked as default. Default Must Be Enabled: The default CoS cannot be disabled.

---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
Feature not workingNot in Feature CategoryAdd to category
Call blockedDial Restriction triggeredCheck pattern rules
Wrong carrierARS Profile misconfiguredReview ARS routes
New ext no CoSNo default setSet default CoS

Diagnostic SQL

List CoS with assignments:

Sql
SELECT c.id, c.name, c.enabled, c.is_main,
       fc.name as feature_category,
       dr.name as dial_restriction,
       (SELECT COUNT(*) FROM public.sip_extensions 
        WHERE class_of_services_id = c.id) as extension_count
FROM public.class_of_services c
LEFT JOIN public.feature_code_categories fc ON c.feature_code_cos_id = fc.id
LEFT JOIN public.dial_rule_restrictions dr ON c.dial_rule_restriction_id = dr.id
WHERE c.domain_id = [domain_id];

Check extension CoS:

Sql
SELECT e.extension, e.name, c.name as class_of_service
FROM public.sip_extensions e
LEFT JOIN public.class_of_services c ON e.class_of_services_id = c.id
WHERE e.domain_id = [domain_id]
ORDER BY e.extension;

---

9. Glossary

TermDefinition
Class of Service (CoS)Permission profile assigned to extensions
Feature Code CategoryGroup of allowed dialpad features
Dial Rule RestrictionPattern-based call control
ARS ProfileOutbound route selection rules
Default ClassCoS automatically assigned to new extensions
---

Lua Handler Status

⚡ No Dedicated Handler Required

Class of Services is a configuration module. CoS permissions are checked by individual feature and routing Lua scripts when processing calls. The cos_utils.lua library provides shared functions for permission validation.

Key Lua Files:
  • resources/functions/cos_utils.lua - Permission check utilities
  • resources/helpers/feature_access.lua - Feature code validation

---

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?