Ctrl K
ring2all.com

Authentication 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. Code Management
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Are Authentication Codes?

Authentication Codes are inbound call authentication rules that require callers to enter a valid PIN/code before routing to a destination. If authentication fails, calls are routed to a fail destination.

IMPORTANT
Not to be confused with Authorization Codes!
  • Authentication Codes: PIN-protect inbound calls (caller must enter code)
  • Authorization Codes: Account codes for outbound call billing

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│               Authentication Code Flow                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Inbound Call arrives at Authentication Rule                    │
│       │                                                         │
│       ▼                                                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │           Authentication Handler                         │   │
│  │                                                          │   │
│  │  1. Play prompt: "Please enter your access code"        │   │
│  │  2. Collect DTMF digits                                  │   │
│  │  3. Validate code against public.authentication_codes   │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ├── Valid Code? ─────────────────────────────────────►    │
│       │       Yes → Route to Match Destination                 │
│       │             (e.g., VIP Extension)                      │
│       │                                                         │
│       └── Invalid or Max Attempts ─────────────────────────►    │
│               Route to Fail Destination                         │
│               (e.g., Main IVR, Hangup)                         │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.authentication_rulesAuthentication rule configurations
public.authentication_codesValid codes for each rule

Key Files

FileDescription
admin/apps/web/src/modules/authenticationCodes/Frontend module
admin/apps/web/src/i18n/en/authenticationCodes.jsonTranslations
---

2. Module Overview (Commercial/Business)

Business Value

Authentication Codes enable access-controlled inbound routing:

Without AuthenticationWith Authentication
Open accessPIN-protected
Anyone can reach VIP lineOnly authorized callers
No securityVerified access
No trackingUsage logging

Use Cases

  1. VIP Line Protection
- Partners enter PIN to reach VIP support

- Invalid: routed to public queue

  1. After-Hours Access
- Employees enter code for after-hours access

- Invalid: routed to voicemail

  1. Restricted Services
- PIN to access conference bridge

- Invalid: connection refused

  1. Private Direct Lines
- High-security executives

- PIN-protected access

Feature Highlights

FeatureBenefit
Multiple CodesDifferent codes per rule
Code LabelsTrack who's using which code
Max AttemptsLimit failed attempts
Timeout ControlEntry time limit
Match/Fail RoutingDual destination
CSV ImportBulk code management
Usage TrackingCount per code
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Create authentication rules
  • Add multiple valid codes per rule
  • Set match destination (valid code)
  • Set fail destination (invalid/timeout)
  • Configure timeout and max attempts
  • Import codes from CSV
  • Track code usage

Administrator Workflow

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│           Creating an Authentication Rule                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Tab: Rule                                                      │
│  ├─ Name: "VIP Line Access"                                    │
│  ├─ Description: "PIN access for VIP partners"                 │
│  ├─ Context: auth_vip_line (auto-generated)                    │
│  ├─ Instructions Message: [Select] "enter_access_code.wav"     │
│  ├─ Timeout: 10 seconds                                        │
│  ├─ Max Attempts: 3                                            │
│  └─ Enabled: ✓                                                 │
│                                                                 │
│  Section: Destinations                                          │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ When Match:                                               │  │
│  │ ├─ Destination Type: Extension                            │  │
│  │ └─ Destination: VIP Support (1001)                        │  │
│  └───────────────────────────────────────────────────────────┘  │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ When Fail:                                                │  │
│  │ ├─ Destination Type: IVR                                  │  │
│  │ └─ Destination: Main Menu                                 │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  Tab: Codes                                                     │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Code     │ Label           │ Enabled │ Used          │    │  │
│  ├──────────┼─────────────────┼─────────┼───────────────┤    │  │
│  │ 1234     │ Partner A       │   ✓     │ 47            │    │  │
│  │ 5678     │ Partner B       │   ✓     │ 23            │    │  │
│  │ 9999     │ Internal Test   │   ✗     │ 0             │    │  │
│  └───────────────────────────────────────────────────────────┘  │
│  [Add Code] [Import from CSV]                                   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Use Labels: Add labels to codes to track who's using them.
TIP
CSV Import: Bulk import codes using CSV file.
CAUTION
Unique Codes: Codes must be unique within each rule.

---

4. Configuration Fields Reference

Rule Fields

FieldDescriptionExample
NameRule identifierVIP Line Access
DescriptionOptional notesPIN for partners
ContextDialplan contextauth_vip_line
Instructions MessageAudio promptenter_code.wav
TimeoutEntry timeout (seconds)10
Max AttemptsFailed attempt limit3
EnabledRule activeOn/Off

Destination Fields

FieldDescription
Match Destination TypeModule when code valid
Match Destination DataTarget when code valid
Fail Destination TypeModule when code invalid
Fail Destination DataTarget when code invalid

Destination Types

TypeDescription
ExtensionRoute to extension
VoicemailRoute to voicemail
IVRRoute to IVR menu
ConferenceRoute to conference
QueueRoute to call queue
HangupTerminate call
AnnouncementPlay announcement

Code Fields

FieldDescription
CodePIN to enter
LabelFriendly name
EnabledCode active
Used CountUsage tracking
---

5. Code Management

Adding Codes

  1. Go to Codes tab
  2. Click Add Code
  3. Enter code (PIN) and optional label
  4. Save

CSV Import

Import multiple codes from CSV file:

CSV Format:

Csv
code,label,enabled
1234,Partner A,true
5678,Partner B,true
9999,Internal Test,false

Import Modes:
ModeDescription
Skip ExistingKeep existing codes unchanged
Update ExistingUpdate existing codes with new data
Replace AllDelete all and import fresh

Usage Tracking

Each code tracks usage count to monitor:

  • Which codes are most used
  • Inactive codes to disable
  • Partner usage patterns

---

6. Common Scenarios & Examples

Scenario 1: VIP Partner Access

Rule: "VIP Partner Line"
SettingValue
Prompt"Please enter your partner access code"
Timeout10 seconds
Max Attempts3
Match →VIP Support Extension
Fail →Main IVR
Codes:
CodeLabel
1234Partner ABC
5678Partner XYZ

Scenario 2: After-Hours Employee Access

Rule: "After-Hours Access"
SettingValue
Prompt"Enter your employee PIN"
Timeout8 seconds
Max Attempts2
Match →Night Queue
Fail →Voicemail

Scenario 3: Conference PIN

Rule: "Conference Auth"
SettingValue
Prompt"Enter conference access code"
Timeout15 seconds
Max Attempts3
Match →Conference Bridge
Fail →Hangup
---

7. Limitations & Important Notes

Technical Notes

NOTE
Match First: First matching code wins (order doesn't matter for codes).
WARNING
Timeout Impacts: Too short timeout may cause false failures.
WARNING
Max Attempts: Set reasonably (2-5) to balance security and usability.

Comparison: Authentication vs Authorization Codes

AspectAuthentication CodesAuthorization Codes
DirectionInboundOutbound
PurposeAccess controlBilling/Accounting
Who entersCallerExtension user
WhenBefore routingBefore dialing out
ResultRoute to destinationTag CDR for billing

Best Practices

  1. Clear Prompts: Use clear audio instructions
  2. 3 Attempts: Standard max attempts
  3. 10 Second Timeout: Reasonable entry time
  4. Label Codes: Track usage by label
  5. Disable Unused: Revoke old codes promptly

---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
No promptMissing audio fileUpload prompt recording
Code rejectedDisabled codeEnable code in list
Too few attemptsMax attempts too lowIncrease max attempts
Timeout too fastShort timeoutIncrease timeout seconds
Wrong destinationMisconfigured routingCheck match/fail destinations

Diagnostic SQL

List authentication rules:

Sql
SELECT id, name, context, max_attempts, timeout_seconds, enabled
FROM public.authentication_rules
WHERE domain_id = [domain_id];

List codes for a rule:

Sql
SELECT code, label, enabled, used_count
FROM public.authentication_codes
WHERE rule_id = [rule_id];

FreeSWITCH Logs

Bash
# Check authentication attempts
grep "authentication" /var/log/freeswitch/freeswitch.log
grep "enter_pin" /var/log/freeswitch/freeswitch.log

---

9. Glossary

TermDefinition
AuthenticationVerify caller identity with PIN
CodePIN entered by caller
RuleAuthentication configuration
Max AttemptsFailed tries before fail route
TimeoutTime limit for code entry
Match DestinationWhere to route on valid code
Fail DestinationWhere to route on invalid code
---

Lua Script Status ℹ️

Configuration Module

ComponentStatus
Authentication Rulesℹ️ Configuration stored in public.authentication_rules
Authentication Codesℹ️ Codes stored in public.authentication_codes
Authentication is performed during inbound routing using similar patterns as validate_pin.lua. The rules and codes are read from the database during call processing.

---

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?