# inextrix/astpp architecture

> Architecture diagram of the GitHub repository inextrix/astpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inextrix/astpp
- Repository: https://github.com/inextrix/astpp

## Overview

ASTPP is a FreeSWITCH-focused VoIP billing platform. Its visible call workflow accepts FreeSWITCH CDR JSON, loads configuration and logging support, processes call data into billing records, and updates balances through the database layer. The README also identifies account/reseller management, routing, rates, DIDs, invoicing, payments, and reporting as product capabilities. Many web modules are listed but not sampled, so those branches are represented without inferred call relationships.

Main entry points: [`freeswitch/fs/cdr.php`](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/cdr.php) (CDR ingress), [`freeswitch/fs/index.php`](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/index.php) (Switch API), [`freeswitch/fs/lib/astpp.db.php`](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.db.php) (Database access), [`freeswitch/fs/lib/astpp.cdr.php`](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.cdr.php) (CDR rating)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_call["Call processing"]
  node_cdr_ingress["CDR ingress<br/>[cdr.php]"]
  node_cdr_rating["CDR rating<br/>[astpp.cdr.php]"]
  node_db_access["Database access<br/>[astpp.db.php]"]
  node_config["Configuration loader<br/>[astpp.lib.php]"]
  node_logger["Call logger<br/>[astpp.logger.php]"]
end

subgraph group_switch["Switch integration"]
  node_switch_api["Switch API<br/>[index.php]"]
  node_switch_xml["Switch XML<br/>[astpp.xml.php]"]
  node_switch_directory["Directory script"]
  node_nibblebill["Nibble billing<br/>[mod_nibblebill.c]"]
end

subgraph group_web["Billing web app"]
  node_common["Billing common<br/>[common.php]"]
  node_accounts["Accounts and resellers<br/>[accounts.php]"]
  node_rates["Rate management<br/>[rates.php]"]
  node_invoices["Invoicing<br/>[invoices.php]"]
  node_reports["Reporting<br/>[reports_form.php]"]
  node_sip_routing["SIP routing<br/>[siprouting.php]"]
  node_did_management["DID management<br/>[did_admin.php]"]
  node_api["Customer API<br/>[API_Controller.php]"]
  node_pdf["PDF generation<br/>[html2pdf.php]"]
end

subgraph group_framework["Web runtime"]
  node_web_entry["Web entry point<br/>[index.php]"]
  node_ci_bootstrap["Framework bootstrap<br/>[CodeIgniter.php]"]
end

node_freeswitch(("FreeSWITCH"))

node_freeswitch -->|"sends CDR"| node_cdr_ingress
node_cdr_ingress -->|"processes calls"| node_cdr_rating
node_cdr_ingress -->|"queries"| node_db_access
node_cdr_ingress -->|"loads settings"| node_config
node_cdr_ingress -->|"logs events"| node_logger
node_cdr_rating -->|"writes billing data"| node_db_access
node_switch_api -->|"includes"| node_switch_xml
node_switch_api -->|"initializes"| node_db_access
node_switch_api -->|"initializes"| node_logger
node_switch_api -->|"loads settings"| node_config
node_web_entry -->|"bootstraps"| node_ci_bootstrap

click node_cdr_ingress "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/cdr.php"
click node_cdr_rating "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.cdr.php"
click node_db_access "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.db.php"
click node_config "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.lib.php"
click node_logger "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.logger.php"
click node_switch_api "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/index.php"
click node_switch_xml "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.xml.php"
click node_switch_directory "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/scripts/astpp.directory.php"
click node_nibblebill "https://github.com/inextrix/astpp/blob/V6.0/freeswitch/mod/mod_nibblebill.c"
click node_web_entry "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/index.php"
click node_ci_bootstrap "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/system/core/CodeIgniter.php"
click node_common "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/libraries/astpp/common.php"
click node_accounts "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/accounts/controllers/accounts.php"
click node_rates "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/rates/controllers/rates.php"
click node_invoices "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/invoices/controllers/invoices.php"
click node_reports "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/reports/libraries/reports_form.php"
click node_sip_routing "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/siprouting/web_interface/astpp/application/modules/siprouting/controllers/siprouting.php"
click node_did_management "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/api/web_interface/astpp/application/controllers/admin/did_admin.php"
click node_api "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/api/web_interface/astpp/application/libraries/API_Controller.php"
click node_pdf "https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/libraries/html2pdf/html2pdf.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cdr_ingress,node_cdr_rating,node_db_access,node_config,node_logger toneBlue
class node_switch_api,node_switch_xml,node_switch_directory,node_nibblebill toneAmber
class node_common,node_accounts,node_rates,node_invoices,node_reports,node_sip_routing,node_did_management,node_api,node_pdf toneMint
class node_web_entry,node_ci_bootstrap toneRose
class node_freeswitch toneIndigo
```

## Components

### Call processing

- [CDR ingress](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/cdr.php): `freeswitch/fs/cdr.php`
- [CDR rating](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.cdr.php): `freeswitch/fs/lib/astpp.cdr.php`
- [Database access](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.db.php): `freeswitch/fs/lib/astpp.db.php`
- [Configuration loader](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.lib.php): `freeswitch/fs/lib/astpp.lib.php`
- [Call logger](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.logger.php): `freeswitch/fs/lib/astpp.logger.php`

### Switch integration

- [Switch API](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/index.php): `freeswitch/fs/index.php`
- [Switch XML](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/lib/astpp.xml.php): `freeswitch/fs/lib/astpp.xml.php`
- [Directory script](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/fs/scripts/astpp.directory.php): `freeswitch/fs/scripts/astpp.directory.php`
- [Nibble billing](https://github.com/inextrix/astpp/blob/V6.0/freeswitch/mod/mod_nibblebill.c): `freeswitch/mod/mod_nibblebill.c`

### Billing web app

- [Billing common](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/libraries/astpp/common.php): `web_interface/astpp/application/libraries/astpp/common.php`
- [Accounts and resellers](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/accounts/controllers/accounts.php): `web_interface/astpp/application/modules/accounts/controllers/accounts.php`
- [Rate management](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/rates/controllers/rates.php): `web_interface/astpp/application/modules/rates/controllers/rates.php`
- [Invoicing](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/invoices/controllers/invoices.php): `web_interface/astpp/application/modules/invoices/controllers/invoices.php`
- [Reporting](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/modules/reports/libraries/reports_form.php): `web_interface/astpp/application/modules/reports/libraries/reports_form.php`
- [SIP routing](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/siprouting/web_interface/astpp/application/modules/siprouting/controllers/siprouting.php): `web_interface/astpp/addons/Community/siprouting/web_interface/astpp/application/modules/siprouting/controllers/siprouting.php`
- [DID management](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/api/web_interface/astpp/application/controllers/admin/did_admin.php): `web_interface/astpp/addons/Community/api/web_interface/astpp/application/controllers/admin/did_admin.php`
- [Customer API](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/addons/Community/api/web_interface/astpp/application/libraries/API_Controller.php): `web_interface/astpp/addons/Community/api/web_interface/astpp/application/libraries/API_Controller.php`
- [PDF generation](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/application/libraries/html2pdf/html2pdf.php): `web_interface/astpp/application/libraries/html2pdf/html2pdf.php`

### Web runtime

- [Web entry point](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/index.php): `web_interface/astpp/index.php`
- [Framework bootstrap](https://github.com/inextrix/astpp/blob/V6.0/web_interface/astpp/system/core/CodeIgniter.php): `web_interface/astpp/system/core/CodeIgniter.php`

### Other components

- **FreeSWITCH**

## Connections

- FreeSWITCH → CDR ingress: sends CDR
- CDR ingress → CDR rating: processes calls (evidence: `freeswitch/fs/cdr.php`)
- CDR ingress → Database access: queries (evidence: `freeswitch/fs/cdr.php`)
- CDR ingress → Configuration loader: loads settings (evidence: `freeswitch/fs/cdr.php`)
- CDR ingress → Call logger: logs events (evidence: `freeswitch/fs/cdr.php`)
- CDR rating → Database access: writes billing data (evidence: `freeswitch/fs/lib/astpp.cdr.php`)
- Switch API → Switch XML: includes (evidence: `freeswitch/fs/index.php`)
- Switch API → Database access: initializes (evidence: `freeswitch/fs/index.php`)
- Switch API → Call logger: initializes (evidence: `freeswitch/fs/index.php`)
- Switch API → Configuration loader: loads settings (evidence: `freeswitch/fs/index.php`)
- Web entry point → Framework bootstrap: bootstraps (evidence: `web_interface/astpp/index.php`)
