Ctrl K
ring2all.com

CDR Settings Module Documentation

Table of Contents

  1. Module Overview (Technical)
  2. Module Overview (Commercial/Business)
  3. Module Overview (End User/Administrator)
  4. Configuration Sections
  5. Settings Reference
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. 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

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│                  CDR Settings Architecture                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Admin Panel                                                    │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        CDR Settings                                      │   │
│  │                                                          │   │
│  │  General Settings:                                       │   │
│  │  ├─ Database Connection                                 │   │
│  │  ├─ Table Name                                          │   │
│  │  ├─ Legs to Log                                         │   │
│  │  └─ Spool Format                                        │   │
│  │                                                          │   │
│  │  CDR Fields:                                             │   │
│  │  ├─ uuid → call_uuid                                    │   │
│  │  ├─ caller_id_number → caller_number                    │   │
│  │  ├─ duration → duration                                 │   │
│  │  └─ (custom fields)                                     │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Generates XML                                          │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        cdr_pg_csv.conf.xml                               │   │
│  │                                                          │   │
│  │  <configuration name="cdr_pg_csv.conf">                  │   │
│  │    <db-info>                                             │   │
│  │      <db-host>127.0.0.1</db-host>                       │   │
│  │      <db-name>r2a_cdr</db-name>                         │   │
│  │    </db-info>                                            │   │
│  │    <field-list>                                          │   │
│  │      <field var="uuid" column="call_uuid"/>              │   │
│  │    </field-list>                                         │   │
│  │  </configuration>                                        │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Used by FreeSWITCH                                     │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        mod_cdr_pg_csv                                    │   │
│  │                                                          │   │
│  │  Call ends → Extract fields → INSERT into PostgreSQL    │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
cdr.cdrCDR records (destination database)

Key Files

FileDescription
modules/cdrSettings/Frontend module
cdr_pg_csv.conf.xmlGenerated configuration
---

2. Module Overview (Commercial/Business)

Business Value

CDR Settings provides configurable CDR export:

Without CDR SettingsWith CDR Settings
Default fields onlyCustom field mapping
Fixed schemaFlexible columns
Manual XML editingWeb interface
No field controlEnable/disable fields

Use Cases

  1. Custom Reporting
- Export specific fields

- Custom column names

  1. Data Integration
- Map to existing schema

- Third-party billing

  1. Storage Optimization
- Export only needed fields

- Reduce database size

  1. Compliance
- Log required fields

- Track specific data

Feature Highlights

FeatureBenefit
Database ConfigPostgreSQL connection
Field MappingVariable to column
Legs SelectionA, B, or both
Spool FallbackCSV/SQL backup
Custom FieldsAdd any variable
XML PreviewVerify 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

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              CDR Settings                                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Configure CDR export to PostgreSQL and manage exported fields. │
│                                                                 │
│  ▼ General Settings                                             │
│                                                                 │
│  Host: [127.0.0.1              ]                               │
│  Port: [5432                    ]                               │
│  Database Name: [r2a_cdr              ]                        │
│  User: [r2a_user               ]                               │
│  Password: [••••••••             ]                             │
│  CDR Table Name: [cdr                   ]                      │
│                                                                 │
│  Connect Timeout (s): [10                ]                     │
│  Additional Options: [sslmode=require     ]                    │
│                                                                 │
│  Legs to Log: [Both Legs ▼]                                    │
│    ├─ Leg A (Caller)                                           │
│    ├─ Leg B (Callee)                                           │
│    └─ Both Legs                                                │
│                                                                 │
│  Spool Format: [CSV ▼]                                         │
│  Rotate on HUP: ✓                                              │
│  Debug Mode: ☐                                                 │
│                                                                 │
│  [Save Settings] [Preview XML] [Apply to Nodes]                 │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

CDR Fields Section

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              CDR Settings - Fields                              │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ▼ CDR Fields                                                   │
│                                                                 │
│  [+ Add Field]                                                  │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │ Order │ Variable Name      │ Alias          │ Quote │ On  ││
│  ├───────┼────────────────────┼────────────────┼───────┼─────┤│
│  │ 1     │ uuid               │ call_uuid      │ ✓     │ ✓   ││
│  │ 2     │ caller_id_number   │ caller_number  │ ✓     │ ✓   ││
│  │ 3     │ destination_number │ called_number  │ ✓     │ ✓   ││
│  │ 4     │ start_stamp        │ start_time     │ ✓     │ ✓   ││
│  │ 5     │ answer_stamp       │ answer_time    │ ✓     │ ✓   ││
│  │ 6     │ end_stamp          │ end_time       │ ✓     │ ✓   ││
│  │ 7     │ duration           │ duration       │ ☐     │ ✓   ││
│  │ 8     │ billsec            │ billsec        │ ☐     │ ✓   ││
│  │ 9     │ hangup_cause       │ hangup_cause   │ ✓     │ ✓   ││
│  │ 10    │ accountcode        │ account_code   │ ✓     │ ☐   ││
│  └─────────────────────────────────────────────────────────────┘│
│                                                                 │
│  [Save Fields]                                                  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

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

FieldDescription
HostPostgreSQL server address
PortPostgreSQL port (5432)
Database NameTarget database
UserDatabase username
PasswordDatabase password
CDR Table NameDestination table
Connect TimeoutConnection timeout (seconds)
Additional OptionsExtra connection parameters

Export Options

FieldDescription
Legs to LogLeg A, Leg B, or Both
Spool FormatCSV or SQL fallback
Rotate on HUPReload on signal
Debug ModeVerbose logging

CDR Fields

FieldDescription
Variable NameFreeSWITCH channel variable
AliasDatabase column name
QuoteWrap value in quotes
EnabledInclude in export
OrderColumn order in schema
---

5. Settings Reference

Common CDR Variables

VariableDescription
uuidCall unique ID
caller_id_numberCaller's number
caller_id_nameCaller's name
destination_numberCalled number
start_stampCall start time
answer_stampCall answer time
end_stampCall end time
durationTotal duration (seconds)
billsecBillable seconds
hangup_causeHangup reason
accountcodeAccount code

Legs Options

OptionDescription
Leg ACaller/originating leg
Leg BCallee/terminating leg
BothBoth legs recorded

Spool Formats

FormatUse Case
CSVComma-separated fallback
SQLSQL INSERT statements
---

6. Common Scenarios & Examples

Scenario 1: Basic CDR Export

  1. Configure database connection
  2. Set table name = cdr
  3. Enable default fields
  4. Legs = Both Legs
  5. Save and apply

Scenario 2: Custom Billing Fields

  1. Add field: accountcode → account_code
  2. Add field: billsec → billable_seconds
  3. Add field: rate → billing_rate
  4. Enable Quote for text fields
  5. Save

Scenario 3: Minimal CDR

  1. Disable non-essential fields
  2. Keep: uuid, caller, destination, duration, hangup_cause
  3. Save (reduces storage)

Scenario 4: SSL Connection

  1. Set Additional Options = sslmode=require
  2. Configure database connection
  3. 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

  1. Test Connection: Verify database connectivity
  2. Match Schema: Ensure aliases match table columns
  3. Quote Text: Use Quote for string fields
  4. Enable Essentials: Always log uuid, duration, hangup_cause
  5. Monitor Spool: Check for spooled files

Required Fields

FieldWhy Required
uuidUnique call identifier
start_stampCall timing
end_stampCall timing
hangup_causeCall result
---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
No CDR recordsConnection failedCheck database settings
Column mismatchWrong aliasMatch alias to column
Spool files growingDB unavailableFix database connection
Null valuesQuoting issueCheck Quote setting
Missing fieldNot enabledEnable field

Test Database Connection

Bash
# Test PostgreSQL connection
psql -h <host> -p <port> -U <user> -d <database>

# Check CDR table
SELECT * FROM cdr ORDER BY start_stamp DESC LIMIT 10;

Check Spooled Files

Bash
# Check for spooled CDR files
ls -la /var/log/freeswitch/cdr-csv/
ls -la /var/log/freeswitch/cdr-pg-csv/

Verify Configuration

Use "Preview XML" to verify generated configuration before applying.

---

9. Glossary

TermDefinition
CDRCall Detail Record
mod_cdr_pg_csvFreeSWITCH PostgreSQL CDR module
Leg ACaller/originating leg
Leg BCallee/terminating leg
SpoolFile-based fallback storage
AliasDatabase column name
QuoteText value quoting
---

Lua Script Status ℹ️

Configuration Module

ComponentStatus
CDR Settingsℹ️ Configuration module - generates cdr_pg_csv.conf.xml
CDR Settings is a configuration module. Settings are stored and used to generate FreeSWITCH CDR export configuration. No Lua handlers are used - mod_cdr_pg_csv handles export.

---

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?