Back to page

Session Memory & Dynamic Variables

Raw Markdown & AI/RAG Chunks
Raw Markdown Source 2308 chars
# Session Memory & Dynamic Variables

To execute stateful logic workflows across live telephone calls, **Asterisk 2** configures short-lived **Session Memory Caches**. The framework scopes key-value properties to individual caller interactions, facilitating dynamic decision branching during complex IVR traversals.

---

## Distributed Session Persistence Topology

The layout below illustrates how caller inputs map directly into multi-layered session variable layers:

```mermaid
graph TD
    %% Caller Ingress
    subgraph TelecomEdge["Active Channel Interfaces"]
        InputTone["Inbound Audio Channel<br/>(Client DTMF Entry: '90210')"]
    end

    %% Engine Dispatcher
    subgraph StagingContext["Scoped Session ledgers"]
        CacheVolatile["In-Memory Call Context<br/>(Attached to Active UUID: ast_channel_a)"]
        CacheDistributed[("Distributed Redis Hash<br/>(Preserves Cross-Call Attributes)")]
    end

    %% Consumption Tier
    subgraph LogicTarget["Evaluating Logic Nodes"]
        EvalJump["Switch Logic Evaluator<br/>(Branch Rule: ZipCode == '90210')"]
    end

    %% Links
    InputTone ==>|"Write Scoped Key"| CacheVolatile
    CacheVolatile <-->|"Sync Critical Tokens"| CacheDistributed
    CacheVolatile ==>|"Resolve Evaluation Variable"| EvalJump

    %% Dark Mode High-Contrast System
    classDef edgeToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef cacheToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef targetToken fill:#065f46,stroke:#10b981,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class TelecomEdge,InputTone edgeToken;
    class StagingContext,CacheVolatile,CacheDistributed cacheToken;
    class LogicTarget,EvalJump targetToken;
```

---

## Memory Framework Rules

### 1. Zero-Leak Memory Bounds
Transient variables attached to volatile call contexts (`ast_channel_a`) are completely restricted to session lifespans. As soon as base telecom connections drop, application contexts clear allocated dictionaries instantaneously.

### 2. Cross-Node Multi-Tenant Isolation
Scoped variables use deterministic key combinations pairing base caller IDs with explicit organization credentials (`org_id:session_id:key`), preventing internal state mix-ups across separate client tenants.
AI Chunks (RAG) 3 chunks
Chunk #1 Session Memory & Dynamic Variables
# Session Memory & Dynamic Variables

To execute stateful logic workflows across live telephone calls, **Asterisk 2** configures short-lived **Session Memory Caches**. The framework scopes key-value properties to individual caller interactions, facilitating dynamic decision branching during complex IVR traversals.

---
Chunk #2 Distributed Session Persistence Topology
## Distributed Session Persistence Topology

The layout below illustrates how caller inputs map directly into multi-layered session variable layers:

```mermaid
graph TD
    %% Caller Ingress
    subgraph TelecomEdge["Active Channel Interfaces"]
        InputTone["Inbound Audio Channel<br/>(Client DTMF Entry: '90210')"]
    end

    %% Engine Dispatcher
    subgraph StagingContext["Scoped Session ledgers"]
        CacheVolatile["In-Memory Call Context<br/>(Attached to Active UUID: ast_channel_a)"]
        CacheDistributed[("Distributed Redis Hash<br/>(Preserves Cross-Call Attributes)")]
    end

    %% Consumption Tier
    subgraph LogicTarget["Evaluating Logic Nodes"]
        EvalJump["Switch Logic Evaluator<br/>(Branch Rule: ZipCode == '90210')"]
    end

    %% Links
    InputTone ==>|"Write Scoped Key"| CacheVolatile
    CacheVolatile <-->|"Sync Critical Tokens"| CacheDistributed
    CacheVolatile ==>|"Resolve Evaluation Variable"| EvalJump

    %% Dark Mode High-Contrast System
    classDef edgeToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef cacheToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef targetToken fill:#065f46,stroke:#10b981,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class TelecomEdge,InputTone edgeToken;
    class StagingContext,CacheVolatile,CacheDistributed cacheToken;
    class LogicTarget,EvalJump targetToken;
```

---
Chunk #3 Memory Framework Rules
## Memory Framework Rules

### 1. Zero-Leak Memory Bounds
Transient variables attached to volatile call contexts (`ast_channel_a`) are completely restricted to session lifespans. As soon as base telecom connections drop, application contexts clear allocated dictionaries instantaneously.

### 2. Cross-Node Multi-Tenant Isolation
Scoped variables use deterministic key combinations pairing base caller IDs with explicit organization credentials (`org_id:session_id:key`), preventing internal state mix-ups across separate client tenants.