Back to page

Scoped Variable Storage Contexts

Raw Markdown & AI/RAG Chunks
Raw Markdown Source 1972 chars
# Scoped Variable Storage Contexts

To avoid memory saturation during concurrent voice sessions, **Asterisk 2** splits runtime storage allocations into distinct lifecycle tiers. The AppFlow Engine manages isolated execution contexts for clean session state operations.

---

## Runtime Memory Hierarchy Map

The flowchart below maps out how variable parameters partition across isolated execution lifecycles:

```mermaid
graph LR
    %% Global Domain
    subgraph GlobalLedger["Tenant Application Scope"]
        VarGlobal["System Global Scope<br/>(e.g., DefaultOutboundTrunk)"]
    end

    %% Call Domain
    subgraph SessionLedger["Active Call Session Scope"]
        VarSession["Session Isolation Tier<br/>(e.g., CallerPhoneNumber, ActiveLang)"]
    end

    %% Node Domain
    subgraph ModuleLedger["Node Execution Scope"]
        VarLocal["Transient Scope<br/>(e.g., IterationIndex, LastInputError)"]
    end

    %% Paths
    VarGlobal -->|"Inject Constant Base"| VarSession
    VarSession ==>|"Provide Shared Scope"| VarLocal

    %% Color Theming System
    classDef globToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef sessToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef modToken fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class GlobalLedger,VarGlobal globToken;
    class SessionLedger,VarSession sessToken;
    class ModuleLedger,VarLocal modToken;
```

---

## Storage Lifecycle Properties

### 1. `TenantGlobal` Parameters
Loaded securely into local worker application cache rows during startup routines. These keys persist across all connected enterprise calls indefinitely to provide fast base routing routes.

### 2. `CallSession` Parameters
Instantiated automatically inside concurrent memory stores during initial `StasisStart` events. These retain real-time variable strings until end-of-call triggers fire explicit execution teardowns.
AI Chunks (RAG) 3 chunks
Chunk #1 Scoped Variable Storage Contexts
# Scoped Variable Storage Contexts

To avoid memory saturation during concurrent voice sessions, **Asterisk 2** splits runtime storage allocations into distinct lifecycle tiers. The AppFlow Engine manages isolated execution contexts for clean session state operations.

---
Chunk #2 Runtime Memory Hierarchy Map
## Runtime Memory Hierarchy Map

The flowchart below maps out how variable parameters partition across isolated execution lifecycles:

```mermaid
graph LR
    %% Global Domain
    subgraph GlobalLedger["Tenant Application Scope"]
        VarGlobal["System Global Scope<br/>(e.g., DefaultOutboundTrunk)"]
    end

    %% Call Domain
    subgraph SessionLedger["Active Call Session Scope"]
        VarSession["Session Isolation Tier<br/>(e.g., CallerPhoneNumber, ActiveLang)"]
    end

    %% Node Domain
    subgraph ModuleLedger["Node Execution Scope"]
        VarLocal["Transient Scope<br/>(e.g., IterationIndex, LastInputError)"]
    end

    %% Paths
    VarGlobal -->|"Inject Constant Base"| VarSession
    VarSession ==>|"Provide Shared Scope"| VarLocal

    %% Color Theming System
    classDef globToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef sessToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef modToken fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class GlobalLedger,VarGlobal globToken;
    class SessionLedger,VarSession sessToken;
    class ModuleLedger,VarLocal modToken;
```

---
Chunk #3 Storage Lifecycle Properties
## Storage Lifecycle Properties

### 1. `TenantGlobal` Parameters
Loaded securely into local worker application cache rows during startup routines. These keys persist across all connected enterprise calls indefinitely to provide fast base routing routes.

### 2. `CallSession` Parameters
Instantiated automatically inside concurrent memory stores during initial `StasisStart` events. These retain real-time variable strings until end-of-call triggers fire explicit execution teardowns.