CDR Settings Module Documentation
Table of Contents
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Sections
- Settings Reference
- Common Scenarios & Examples
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
---
1. Module Overview (Technical)
What Is CDR Settings?
CDR Settings is a FreeSWITCH mod_cdr_pg_csv configuration module that manages Call Detail Record export to PostgreSQL. It configures database connection, field mappings, and export options for real-time CDR storage.
Architecture
Key Tables
| Table | Purpose |
|---|---|
cdr.cdr | CDR records (destination database) |
Key Files
| File | Description | |
|---|---|---|
modules/cdrSettings/ | Frontend module | |
| cdr_pg_csv.conf.xml | Generated configuration |
2. Module Overview (Commercial/Business)
Business Value
CDR Settings provides configurable CDR export:
| Without CDR Settings | With CDR Settings | |
|---|---|---|
| Default fields only | Custom field mapping | |
| Fixed schema | Flexible columns | |
| Manual XML editing | Web interface | |
| No field control | Enable/disable fields |
Use Cases
- Custom Reporting
- Custom column names
- Data Integration
- Third-party billing
- Storage Optimization
- Reduce database size
- Compliance
- Track specific data
Feature Highlights
| Feature | Benefit | |
|---|---|---|
| Database Config | PostgreSQL connection | |
| Field Mapping | Variable to column | |
| Legs Selection | A, B, or both | |
| Spool Fallback | CSV/SQL backup | |
| Custom Fields | Add any variable | |
| XML Preview | Verify before deploy |
3. Module Overview (End User/Administrator)
What Can You Do?
- Configure PostgreSQL connection
- Map FreeSWITCH variables to columns
- Select which call legs to log
- Enable/disable individual fields
- Set column aliases
- Configure spool fallback format
- Preview generated XML
CDR Settings Interface
CDR Fields Section
Quick Tips
TIP
Quote Text Fields: Enable Quote for string/text values.TIP
Disable Unused: Turn off fields you don't need.NOTE
System Fields: Some fields are required and cannot be removed.---
4. Configuration Sections
General Settings
| Field | Description | |
|---|---|---|
| Host | PostgreSQL server address | |
| Port | PostgreSQL port (5432) | |
| Database Name | Target database | |
| User | Database username | |
| Password | Database password | |
| CDR Table Name | Destination table | |
| Connect Timeout | Connection timeout (seconds) | |
| Additional Options | Extra connection parameters |
Export Options
| Field | Description | |
|---|---|---|
| Legs to Log | Leg A, Leg B, or Both | |
| Spool Format | CSV or SQL fallback | |
| Rotate on HUP | Reload on signal | |
| Debug Mode | Verbose logging |
CDR Fields
| Field | Description | |
|---|---|---|
| Variable Name | FreeSWITCH channel variable | |
| Alias | Database column name | |
| Quote | Wrap value in quotes | |
| Enabled | Include in export | |
| Order | Column order in schema |
5. Settings Reference
Common CDR Variables
| Variable | Description | |
|---|---|---|
| uuid | Call unique ID | |
| caller_id_number | Caller's number | |
| caller_id_name | Caller's name | |
| destination_number | Called number | |
| start_stamp | Call start time | |
| answer_stamp | Call answer time | |
| end_stamp | Call end time | |
| duration | Total duration (seconds) | |
| billsec | Billable seconds | |
| hangup_cause | Hangup reason | |
| accountcode | Account code |
Legs Options
| Option | Description | |
|---|---|---|
| Leg A | Caller/originating leg | |
| Leg B | Callee/terminating leg | |
| Both | Both legs recorded |
Spool Formats
| Format | Use Case | |
|---|---|---|
| CSV | Comma-separated fallback | |
| SQL | SQL INSERT statements |
6. Common Scenarios & Examples
Scenario 1: Basic CDR Export
- Configure database connection
- Set table name = cdr
- Enable default fields
- Legs = Both Legs
- Save and apply
Scenario 2: Custom Billing Fields
- Add field: accountcode → account_code
- Add field: billsec → billable_seconds
- Add field: rate → billing_rate
- Enable Quote for text fields
- Save
Scenario 3: Minimal CDR
- Disable non-essential fields
- Keep: uuid, caller, destination, duration, hangup_cause
- Save (reduces storage)
Scenario 4: SSL Connection
- Set Additional Options = sslmode=require
- Configure database connection
- Save and apply
---
7. Limitations & Important Notes
Technical Notes
NOTE
mod_cdr_pg_csv: Uses FreeSWITCH PostgreSQL CDR module.NOTE
Spool Fallback: If database unavailable, records spool to file.WARNING
Schema Match: Field aliases must match database columns.Best Practices
- Test Connection: Verify database connectivity
- Match Schema: Ensure aliases match table columns
- Quote Text: Use Quote for string fields
- Enable Essentials: Always log uuid, duration, hangup_cause
- Monitor Spool: Check for spooled files
Required Fields
| Field | Why Required | |
|---|---|---|
| uuid | Unique call identifier | |
| start_stamp | Call timing | |
| end_stamp | Call timing | |
| hangup_cause | Call result |
8. Troubleshooting Tips
Common Issues
| Symptom | Possible Cause | Solution | |
|---|---|---|---|
| No CDR records | Connection failed | Check database settings | |
| Column mismatch | Wrong alias | Match alias to column | |
| Spool files growing | DB unavailable | Fix database connection | |
| Null values | Quoting issue | Check Quote setting | |
| Missing field | Not enabled | Enable field |
Test Database Connection
Check Spooled Files
Verify Configuration
Use "Preview XML" to verify generated configuration before applying.
---
9. Glossary
| Term | Definition | |
|---|---|---|
| CDR | Call Detail Record | |
| mod_cdr_pg_csv | FreeSWITCH PostgreSQL CDR module | |
| Leg A | Caller/originating leg | |
| Leg B | Callee/terminating leg | |
| Spool | File-based fallback storage | |
| Alias | Database column name | |
| Quote | Text value quoting |
Lua Script Status ℹ️
Configuration Module
| Component | Status |
|---|---|
| CDR Settings | ℹ️ Configuration module - generates cdr_pg_csv.conf.xml |
---
Documentation last updated: January 2026