Ctrl K
ring2all.com

Authorization Codes 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. Call Flow / Logic Explanation
  6. Import/Export Feature
  7. Common Scenarios & Examples
  8. Limitations & Important Notes
  9. Troubleshooting Tips
  10. Glossary

---

1. Module Overview (Technical)

What Are Authorization Codes?

Authorization Codes allow users to temporarily elevate their Class of Service (CoS) for a single call. By entering a valid authorization code, users gain access to dial destinations normally restricted by their assigned CoS.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Authorization Code System                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  User dials feature code *79 (Authorization Code)               │
│       │                                                         │
│       ▼                                                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              Feature Code Validation                     │   │
│  │  Check: Is user's CoS allowed to use *79?               │   │
│  │  ├─ NO → "Feature not allowed" → Hangup                 │   │
│  │  └─ YES → Continue                                      │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼                                                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              Code Entry                                  │   │
│  │  Play: "Enter your authorization code"                   │   │
│  │  User enters: 5678#                                      │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼                                                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              Validation                                  │   │
│  │  SELECT cos_id FROM public.authorization_codes           │   │
│  │  WHERE code = '5678' AND active = TRUE                   │   │
│  │                                                          │   │
│  │  ├─ Found → Apply CoS override                          │   │
│  │  └─ Not found → "Invalid code" → Hangup                 │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼                                                         │
│  Set channel variable: override_cos_id = [elevated CoS ID]      │
│  Play: "Authorization successful"                               │
│  Return dial tone for outbound call                             │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.authorization_codesCode definitions with CoS mapping
public.class_of_servicesReferenced CoS for elevation

Key Files

FileDescription
admin/apps/web/src/modules/authorizationCodes/Frontend module
admin/apps/web/src/i18n/en/authorizationCodes.jsonTranslations
telephony/freeswitch/lua/features/authorization_code.luaHandler
---

2. Module Overview (Commercial/Business)

Business Value

Authorization Codes enable controlled access to restricted destinations:

Without Auth CodesWith Auth Codes
Permanent CoS changesTemporary elevation
IT involvement neededUser self-service
No accountabilityCode-based tracking
All or nothing accessPer-call authorization

Use Cases

  1. International Calling
- Normal users have domestic-only CoS

- Managers have international auth codes

- One-time international calls without CoS change

  1. Toll-Free/Premium Bypass
- Default CoS blocks premium numbers

- Auth codes allow approved calls

  1. Guest/Temporary Access
- Contractors with limited CoS

- Auth codes for specific project needs

  1. Audit Trail
- Track who used which code

- CDR includes alias for billing

Feature Highlights

FeatureBenefit
Per-Code CoSDifferent codes = different permissions
Alias in CDRReplaces code in call records
Import/ExportBulk management via CSV
Active ToggleEnable/disable without deletion
Multi-tenantSeparate codes per domain
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Create authorization codes with CoS assignments
  • Set aliases for CDR identification
  • Import/export codes via CSV
  • Enable/disable codes

Administrator Workflow

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Creating an Authorization Code                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Step 1: Code Information                                       │
│  ├─ Authorization Code: 5678                                   │
│  ├─ Alias: "Sales Intl" (appears in CDR)                       │
│  └─ Description: "International for sales team"                │
│                                                                 │
│  Step 2: Class of Service                                       │
│  └─ Select: "International Access" CoS                         │
│                                                                 │
│  Step 3: Enable and Save                                        │
│                                                                 │
│  Result: Users entering 5678 get "International Access" CoS    │
│          for that call only                                    │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

User Workflow (Using Auth Code)

Plaintext
1. User dials *79 (Authorization Code feature)
2. System: "Enter your authorization code"
3. User enters: 5678#
4. System: "Authorization successful"
5. User dials international number
6. Call connects with elevated CoS permissions

Quick Tips

TIP
Use Aliases: Set meaningful aliases for CDR tracking (e.g., "ProjectX", "SalesMgr").
TIP
Code Complexity: Use at least 4 digits for security.
CAUTION
Code Sharing: Shared codes lose individual accountability.

---

4. Configuration Fields Reference

Authorization Code Fields

FieldDescriptionExampleRequired
Authorization CodeThe code users enter5678Yes
AliasCDR replacement textSalesMgrNo
DescriptionAdmin notesFor sales intl callsNo
Class of ServiceCoS to applyInternational AccessYes
ActiveCode enabled statusOn/OffYes

CDR Behavior

When a call uses an authorization code:

  • Without Alias: CDR shows raw code (5678)
  • With Alias: CDR shows alias text (SalesMgr)

---

5. Call Flow / Logic Explanation

Authorization Code Flow

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│                 Authorization Code Flow                         │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  1. User dials *79                                              │
│     │                                                           │
│     ▼                                                           │
│  2. Check if *79 is allowed for user's CoS                      │
│     ├─ Allowed → Continue                                      │
│     └─ Not allowed → "Feature not allowed" → Hangup            │
│     │                                                           │
│     ▼                                                           │
│  3. Prompt for authorization code                               │
│     │                                                           │
│     ▼                                                           │
│  4. User enters code (e.g., 5678#)                              │
│     │                                                           │
│     ▼                                                           │
│  5. Validate code against database                              │
│     SELECT cos_id FROM public.authorization_codes              │
│     WHERE code = '5678' AND active = TRUE                      │
│     │                                                           │
│     ├─ Found → Continue                                        │
│     └─ Not found → "Invalid code" → Hangup                     │
│     │                                                           │
│     ▼                                                           │
│  6. Set channel variable: override_cos_id                       │
│     │                                                           │
│     ▼                                                           │
│  7. Play success confirmation                                   │
│     │                                                           │
│     ▼                                                           │
│  8. User dials destination number                               │
│     │                                                           │
│     ▼                                                           │
│  9. Outbound routing uses override_cos_id                       │
│     (elevated permissions for this call only)                  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Channel Variables

VariableDescription
override_cos_idTemporary CoS ID applied to call
---

6. Import/Export Feature

CSV Export

Purpose: Backup codes or migrate to another system. Format:

Csv
code,alias,description,classOfService,active
5678,SalesMgr,For sales international calls,International Access,true
1234,Guest,Guest access code,Standard,true
9012,Emergency,Emergency bypass,Full Access,true

CSV Import

Import Modes:
ModeBehavior
Skip existingKeep current codes, skip duplicates
Update existingUpdate alias/description/active if code exists
Replace allDelete all and import fresh
Required Columns:
  • code - The authorization code
  • alias - CDR replacement text
  • description - Admin notes
  • classOfService - CoS name (must exist)
  • active - true/false

---

7. Common Scenarios & Examples

Scenario 1: International Access for Managers

Setup:
CodeAliasCoS
8888MgrIntlInternational Access
Usage: Manager dials 79 → enters 8888 → dials +44...

Scenario 2: Project-Based Codes

Setup:
CodeAliasCoSDescription
1001ProjectAlphaLong DistanceAlpha team
1002ProjectBetaLong DistanceBeta team
Tracking: CDR shows "ProjectAlpha" or "ProjectBeta" for billing.

Scenario 3: Emergency Override

Setup:
CodeAliasCoS
9999EmergencyOverrideFull Access
Usage: In emergencies, users can dial any number.

---

8. Limitations & Important Notes

Technical Limitations

WARNING
Single Call Only: Authorization applies to the next call only, not permanent.
WARNING
Feature Code Required: Users must dial
79 first—cannot be automatic.

Best Practices

  1. Unique Codes: Assign unique codes per user/purpose
  2. Meaningful Aliases: Use aliases for CDR clarity
  3. Regular Audits: Review code usage periodically
  4. Strong Codes: Use 4+ digits, avoid patterns
  5. Disable vs. Delete: Disable for temporary revocation

Security Considerations

CAUTION
Code Secrecy: Treat authorization codes like passwords.

---

9. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
"Feature not allowed"79 not in user's CoSEnable 79 in feature codes
"Invalid code"Code not found/disabledCheck code exists and is active
Still restrictedoverride_cos_id not honoredCheck routing respects override
No prompt heardAudio file missingCheck enter_auth_code.wav

Diagnostic SQL

List authorization codes:

Sql
SELECT ac.code, ac.alias, ac.active,
       cos.name as class_of_service
FROM public.authorization_codes ac
JOIN public.class_of_services cos ON ac.cos_id = cos.id
WHERE ac.domain_id = [domain_id];

Check code usage (if logged):

Sql
-- Check CDR for authorization code usage
SELECT * FROM public.cdr
WHERE authorization_code IS NOT NULL
ORDER BY call_start DESC
LIMIT 50;

---

10. Glossary

TermDefinition
Authorization CodeNumeric code that temporarily elevates CoS
CoS ElevationTemporarily granting higher permissions
override_cos_idChannel variable with elevated CoS ID
AliasText that replaces code in CDR
Feature Code79 - the dialpad code to invoke authorization
---

Lua Script Status ✅

Integration Module

ComponentStatusLocation
Auth Codes Handler✅ Activeapp/authorization_codes/auth_codes.lua
---

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?