Back to page
Dual Database Strategy
Raw Markdown & AI/RAG Chunks
Raw Markdown Source
3457 chars
# Dual Database Strategy
The **Asterisk 2** core data persistence model enforces complete decoupling between standard web operations and real-time Telephony signaling engines. By routing commands across isolated Entity Framework Core contexts, the platform guarantees that network delays or multi-tenant database indexing overhead never block live SIP connection loops.
---
## Entity Framework Context Pipeline
The application physically segregates data access layers across three primary access boundaries:
```mermaid
graph TD
%% Controllers & Core
subgraph DataBroker["Application Data Integration Services"]
DI_Ctx["Entity Framework Core Query Layer"]
end
%% Isolated Database Contexts
subgraph PrimaryAppStore["Multi-Tenant Master Context"]
Ctx_App["ApplicationDbContext"]
Db_App[("AppDb Platform Engine<br/>(SQL Server)")]
Ctx_App <==>|"Read / Write Operations<br/>(Users, RAG Metadata, Branding)"| Db_App
end
subgraph TelephonyStore["Operational Session Context"]
Ctx_Tel["TelephonyDbContext"]
Db_Tel[("Telephony Index Engine<br/>(SQL Server)")]
Ctx_Tel <==>|"Read / Write Operations<br/>(Gateways, SIM Trackers)"| Db_Tel
end
subgraph AstRealtimeProxy["Asterisk Cluster Realtime Proxy"]
Ctx_Ast["AstDbContext<br/>(Read-Only EF Proxy)"]
Db_Ast[("wb_ast Realtime DB<br/>(Direct MySQL/SQL Store)")]
Ctx_Ast -.->|"High-Speed Proxy Queries<br/>(Zero RTT Network Mapping)"| Db_Ast
end
%% Dispatch Path
DI_Ctx --> Ctx_App
DI_Ctx --> Ctx_Tel
DI_Ctx --> Ctx_Ast
%% Styling
classDef storeClass fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
classDef proxyClass fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
class PrimaryAppStore,TelephonyStore,Ctx_App,Ctx_Tel,Db_App,Db_Tel storeClass;
class AstRealtimeProxy,Ctx_Ast,Db_Ast proxyClass;
```
---
## Decoupled Entity Schema Index
### 1. Master Application Ledger (`ApplicationDbContext`)
Serves as the structural brain storing global parameters and tenant options:
- **`Projects`, `Sections`, `Pages`**: Contains complete documentation tree definitions and chunk arrays.
- **`AppSettings`, `ApiKeys`**: Manages master encryption tokens, global RAG scope strings, and application UI styling rules.
- **Identity Storage Engine**: Manages user accounts, claims maps, and password storage structures cleanly segregated from commercial telephony layers.
### 2. Operational Proxy Mapper (`AstDbContext`)
Provides a direct memory-mapped read conduit into the live underlying databases used directly by the active Asterisk PBX nodes:
- **`PsEndpoint`**: Resolves registered PJSIP client parameters and authentication bounds instantly.
- **`Server`**: Monitors individual Asterisk server node status across load balanced clusters.
- **`Cdr` & `Cel`**: Exposes real-time call detail streams and raw channel life-cycles for immediate dashboard visualization.
- **`QueueLog` & `VoicemailMessage`**: Tracks instant channel queues without requiring expensive intermediate sync processes.
---
## Architectural Isolation Principle
To maintain database integrity, modifications to the live `wb_ast` database are restricted strictly to native signaling loops. Application services query this database via read-only tracking modes, completely avoiding distributed table locking risks.
AI Chunks (RAG)
4 chunks
Chunk #1
Dual Database Strategy
# Dual Database Strategy The **Asterisk 2** core data persistence model enforces complete decoupling between standard web operations and real-time Telephony signaling engines. By routing commands across isolated Entity Framework Core contexts, the platform guarantees that network delays or multi-tenant database indexing overhead never block live SIP connection loops. ---
Chunk #2
Entity Framework Context Pipeline
## Entity Framework Context Pipeline
The application physically segregates data access layers across three primary access boundaries:
```mermaid
graph TD
%% Controllers & Core
subgraph DataBroker["Application Data Integration Services"]
DI_Ctx["Entity Framework Core Query Layer"]
end
%% Isolated Database Contexts
subgraph PrimaryAppStore["Multi-Tenant Master Context"]
Ctx_App["ApplicationDbContext"]
Db_App[("AppDb Platform Engine<br/>(SQL Server)")]
Ctx_App <==>|"Read / Write Operations<br/>(Users, RAG Metadata, Branding)"| Db_App
end
subgraph TelephonyStore["Operational Session Context"]
Ctx_Tel["TelephonyDbContext"]
Db_Tel[("Telephony Index Engine<br/>(SQL Server)")]
Ctx_Tel <==>|"Read / Write Operations<br/>(Gateways, SIM Trackers)"| Db_Tel
end
subgraph AstRealtimeProxy["Asterisk Cluster Realtime Proxy"]
Ctx_Ast["AstDbContext<br/>(Read-Only EF Proxy)"]
Db_Ast[("wb_ast Realtime DB<br/>(Direct MySQL/SQL Store)")]
Ctx_Ast -.->|"High-Speed Proxy Queries<br/>(Zero RTT Network Mapping)"| Db_Ast
end
%% Dispatch Path
DI_Ctx --> Ctx_App
DI_Ctx --> Ctx_Tel
DI_Ctx --> Ctx_Ast
%% Styling
classDef storeClass fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
classDef proxyClass fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
class PrimaryAppStore,TelephonyStore,Ctx_App,Ctx_Tel,Db_App,Db_Tel storeClass;
class AstRealtimeProxy,Ctx_Ast,Db_Ast proxyClass;
```
---
Chunk #3
Decoupled Entity Schema Index
## Decoupled Entity Schema Index ### 1. Master Application Ledger (`ApplicationDbContext`) Serves as the structural brain storing global parameters and tenant options: - **`Projects`, `Sections`, `Pages`**: Contains complete documentation tree definitions and chunk arrays. - **`AppSettings`, `ApiKeys`**: Manages master encryption tokens, global RAG scope strings, and application UI styling rules. - **Identity Storage Engine**: Manages user accounts, claims maps, and password storage structures cleanly segregated from commercial telephony layers. ### 2. Operational Proxy Mapper (`AstDbContext`) Provides a direct memory-mapped read conduit into the live underlying databases used directly by the active Asterisk PBX nodes: - **`PsEndpoint`**: Resolves registered PJSIP client parameters and authentication bounds instantly. - **`Server`**: Monitors individual Asterisk server node status across load balanced clusters. - **`Cdr` & `Cel`**: Exposes real-time call detail streams and raw channel life-cycles for immediate dashboard visualization. - **`QueueLog` & `VoicemailMessage`**: Tracks instant channel queues without requiring expensive intermediate sync processes. ---
Chunk #4
Architectural Isolation Principle
## Architectural Isolation Principle To maintain database integrity, modifications to the live `wb_ast` database are restricted strictly to native signaling loops. Application services query this database via read-only tracking modes, completely avoiding distributed table locking risks.