CID Modifiers Module Documentation
Table of Contents
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Fields Reference
- Source Types
- Action Types
- Common Scenarios & Examples
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
---
1. Module Overview (Technical)
What Are CID Modifiers?
CID Modifiers are Caller ID manipulation rules that transform caller ID number and/or name before the call is routed. They support pattern matching, number normalization, and dynamic lookups from databases or external APIs.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ CID Modifier Processing │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Incoming Call: │
│ ├─ Caller ID Number: 5058881234 │
│ └─ Caller ID Name: WIRELESS CALLER │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ CID Modifier Rules (by priority) │ │
│ │ │ │
│ │ Rule 1 (priority 10): Normalize to E.164 │ │
│ │ Pattern: ^505.* │ │
│ │ Action: prepend + │ │
│ │ Result: +5058881234 │ │
│ │ │ │
│ │ Rule 2 (priority 20): CRM Name Lookup │ │
│ │ Source: HTTP │ │
│ │ URL: https://crm.company.com/lookup?num=[CIDNUM] │ │
│ │ Result: "John Smith" (from CRM) │ │
│ │ │ │
│ │ Rule 3 (priority 30): Add Department Prefix │ │
│ │ Pattern: .* │ │
│ │ Action: prepend "Sales: " to name │ │
│ │ Result: "Sales: John Smith" │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Modified Call: │
│ ├─ Caller ID Number: +5058881234 │
│ └─ Caller ID Name: Sales: John Smith │
│ │
└─────────────────────────────────────────────────────────────────┘
Key Tables
| Table | Purpose |
|---|
public.cid_modifiers | CID modifier rules |
Key Files
| File | Description |
|---|
admin/apps/web/src/modules/cidModifiers/ | Frontend module | |
admin/apps/web/src/i18n/en/cidModifiers.json | Translations |
NOTE
CID modifications are applied during call routing in the main dialplan handlers.
---
2. Module Overview (Commercial/Business)
Business Value
CID Modifiers enable intelligent caller identification:
| Without CID Modifiers | With CID Modifiers |
|---|
| Raw caller ID | Normalized E.164 format | |
| "WIRELESS CALLER" | Customer name from CRM | |
| No context | Department prefix | |
| Inconsistent format | Standardized numbers |
Use Cases
- Number Normalization
- Convert local to E.164 (+15058881234)
- Strip trunk prefixes
- CRM Integration
- Lookup customer name from database
- Display account number
- Department Branding
- Prepend "Sales:" to name
- Add queue identifier
- Outbound CID Control
- Set specific caller ID per route
- Corporate branding
Feature Highlights
| Feature | Benefit |
|---|
| Pattern Matching | Regex condition matching | |
| Multiple Sources | Static, Database, HTTP | |
| Priority Order | Sequential rule processing | |
| Stop On Match | Control rule cascade | |
| E.164 Normalization | Standard number format | |
| HTTP Lookup | External API integration |
---
3. Module Overview (End User/Administrator)
What Can You Do?
- Create CID modification rules
- Set pattern conditions
- Choose action types (prepend, append, replace, etc.)
- Configure priority order
- Set up database or HTTP lookups
- Simulate modifications before saving
Administrator Workflow
┌─────────────────────────────────────────────────────────────────┐
│ Creating a CID Modifier │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Tab: General │
│ ├─ Name: "Add Country Code" │
│ ├─ Source: Static │
│ ├─ Direction: Inbound │
│ ├─ Condition Field: Caller ID Number │
│ ├─ Condition Pattern: ^[2-9][0-9]{9}$ │
│ ├─ Action Type: Prepend │
│ ├─ Action Value: +1 │
│ ├─ Priority: 10 │
│ ├─ Stop on Match: Off │
│ └─ Enabled: ✓ │
│ │
│ Tab: Advanced Settings (for Static source) │
│ ├─ CID Number Settings: │
│ │ ├─ Skip: 0 │
│ │ ├─ Length: 0 (all digits) │
│ │ ├─ Prepend: +1 │
│ │ └─ Append: (empty) │
│ ├─ CID Name Settings: │
│ │ ├─ Prepend: (empty) │
│ │ ├─ Append: (empty) │
│ │ ├─ Replace With: (empty) │
│ │ ├─ Force E.164 Format: Off │
│ │ ├─ Strip Non-Digit Characters: On │
│ │ └─ Block Name if Empty: On │
│ └─ Enabled: ✓ │
│ │
│ Section: Simulation │
│ ├─ Test Number: 5058881234 │
│ ├─ Test Name: WIRELESS CALLER │
│ ├─ [Run Simulation] │
│ ├─ Modified Number: +15058881234 │
│ └─ Modified Name: WIRELESS CALLER │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Tips
TIP
Use Simulation: Test your rules before saving to verify expected output.
TIP
Priority Matters: Lower numbers execute first. Plan your rule order.
CAUTION
Pattern Syntax: Use valid regex patterns or rules won't match.
---
4. Configuration Fields Reference
General Fields
| Field | Description | Example |
|---|
| Name | Rule identifier | Add Country Code | |
| Source | Data source type | Static/Database/HTTP | |
| Direction | Call direction | Inbound/Outbound/Internal | |
| Condition Field | Field to evaluate | caller_id_number | |
| Condition Pattern | Regex pattern | ^[2-9][0-9]{9}$ | |
| Action Type | Modification type | prepend | |
| Action Value | Value to apply | +1 | |
| Priority | Execution order (0-999) | 10 | |
| Stop on Match | Stop further rules | On/Off | |
| Enabled | Rule active | On/Off |
Directions
| Direction | Description |
|---|
| Inbound | External calls coming in | |
| Outbound | Internal calls going out | |
| Internal | Extension to extension |
Condition Fields
| Field | Description |
|---|
| caller_id_number | Caller's phone number | |
| caller_id_name | Caller's name | |
| destination_number | Number being called | |
| source_number | Source number |
---
5. Source Types
Static Source
Manual configuration of transformation rules:
| Setting | Description |
|---|
| Skip | Digits to skip from start | |
| Length | Output length (0 = all) | |
| Prepend | Add before number | |
| Append | Add after number | |
| Force E.164 | Convert to +E.164 format | |
| Strip Non-Digits | Remove non-numeric chars |
Database Source
Lookup caller info from external database:
| Setting | Description |
|---|
| Database | Database name | |
| Host | Server address | |
| Username | Auth username | |
| Password | Auth password | |
| Query | SQL returning cidname, cidnumber |
HTTP Source
Lookup from external API:
| Setting | Description |
|---|
| URL | API endpoint with [CIDNUM]/[CIDNAME] | |
| Auth User | HTTP auth username | |
| Auth Password | HTTP auth password | |
| Timeout | Request timeout (seconds) | |
| Retries | Retry attempts | |
| Failover Behavior | What to do if lookup fails |
---
6. Action Types
Available Actions
| Action | Description | Example |
|---|
| Prepend | Add before value | +1 + 5058881234 = +15058881234 | |
| Append | Add after value | 5058881234 + -ext = 5058881234-ext | |
| Replace | Complete replacement | Replace with custom value | |
| Strip | Remove leading digits | Strip 1 from 15058881234 = 5058881234 | |
| Set Name | Set caller name | "VIP Customer" | |
| Set Number | Set caller number | "+18005551234" | |
| Normalize | Convert to E.164 | 5058881234 → +15058881234 | |
| Custom | Custom transformation | Variable-based |
---
7. Common Scenarios & Examples
Scenario 1: E.164 Normalization
Rule: "Add US Country Code"
| Setting | Value |
|---|
| Direction | Inbound | |
| Condition Pattern | ^[2-9][0-9]{9}$ | |
| Action Type | Prepend | |
| Action Value | +1 | |
| Priority | 10 |
Result: 5058881234 → +15058881234
Scenario 2: CRM Name Lookup
Rule: "CRM Customer Lookup"
| Setting | Value |
|---|
| Source | HTTP | |
| Direction | Inbound | |
| URL | https://crm.example.com/api/caller?num=[CIDNUM] | |
| Timeout | 3 | |
| Failover | Keep Original | |
| Priority | 20 |
Result: "WIRELESS CALLER" → "John Smith"
Scenario 3: Department Prefix
Rule: "Sales Queue Prefix"
| Setting | Value |
|---|
| Direction | Inbound | |
| Action Type | Prepend (to name) | |
| Action Value | "Sales: " | |
| Priority | 30 |
Result: "John Smith" → "Sales: John Smith"
Scenario 4: Strip Trunk Prefix
Rule: "Remove 9 Prefix"
| Setting | Value |
|---|
| Direction | Outbound | |
| Condition Pattern | ^9[0-9]+$ | |
| Action Type | Strip | |
| Action Value | 1 | |
| Priority | 5 |
Result: 915058881234 → 15058881234
---
8. Limitations & Important Notes
Technical Notes
NOTE
Processing Order: Rules execute by priority (lower first).
WARNING
Regex Patterns: Invalid patterns will cause rule to not match.
WARNING
HTTP Timeouts: Consider call setup time when using HTTP lookups.
Best Practices
- Test First: Use simulation before saving
- Order Carefully: Plan priority sequence
- Use Stop on Match: Prevent redundant processing
- Monitor Timeouts: HTTP lookups add latency
- Log Changes: Enable for troubleshooting
---
9. Troubleshooting Tips
Common Issues
| Symptom | Possible Cause | Solution |
|---|
| No modification | Pattern not matching | Test regex pattern | |
| Wrong result | Priority order | Check rule priorities | |
| HTTP timeout | Slow external API | Reduce timeout, add caching | |
| Empty name | Lookup failed | Check failover behavior | |
| Rule skipped | Disabled or invalid | Verify enabled status |
Diagnostic SQL
List CID modifiers:
SELECT id, name, direction, action_type, condition_pattern, priority, enabled
FROM public.cid_modifiers
WHERE domain_id = [domain_id]
ORDER BY priority;
FreeSWITCH Logs
# Check CID processing
grep "effective_caller_id" /var/log/freeswitch/freeswitch.log
grep "caller_id_number" /var/log/freeswitch/freeswitch.log
---
10. Glossary
| Term | Definition |
|---|
| CID | Caller ID - phone number and name | |
| E.164 | International phone number format (+15058881234) | |
| CLID | Caller Line ID (same as CID) | |
| Normalize | Convert to standard format | |
| Prepend | Add to beginning | |
| Append | Add to end | |
| Strip | Remove from beginning |
---
Lua Script Status ℹ️
Configuration Module
| Component | Status |
|---|
| CID Modifiers | ℹ️ Configuration stored in public.cid_modifiers, applied during routing process |
CID modifications are applied at various points in the routing handlers rather than having a dedicated handler. The rules are read from the database and applied to incoming/outgoing calls.
---
Documentation last updated: January 2026