Back to page

Dynamic Multi-Leg Bridge Orchestration

Raw Markdown & AI/RAG Chunks
Raw Markdown Source 2482 chars
# Dynamic Multi-Leg Bridge Orchestration

To connect separate telephone line channels seamlessly, **Asterisk 2** orchestrates high-performance voice bridges. The communication engine groups multiple audio legs into unified **Stasis Mixing Bridges** dynamically.

---

## Multi-Channel Media Bridging Topology

The layout below traces how background commands construct mixing spaces to merge independent phone streams:

```mermaid
graph LR
    %% Control Engine
    subgraph CommandHost["C# Orchestrator Task"]
        ActionCreate["POST /ari/bridges<br/>(Type: mixing, Name: 'ConfRoom')"]
        ActionAdd["POST /ari/bridges/{id}/addChannel<br/>(Injects Audio Legs)"]
    end

    %% Target Bridge Space
    subgraph StasisBridge["Active Media Mixing Module"]
        BridgeNode["Stasis Mixing Bridge<br/>(Unified Audio Domain)"]
    end

    %% Physical Channels
    subgraph MediaLegs["Decoupled Voice Sessions"]
        LegCaller["Inbound Mobile Caller<br/>(Channel ID: ast_channel_a)"]
        LegAgent["Outbound Support Agent<br/>(Channel ID: ast_channel_b)"]
        LegMusic["Music on Hold Generator<br/>(Channel ID: moh_playback)"]
    end

    %% Flow Vectors
    ActionCreate ==>|"Allocate Engine Space"| BridgeNode
    ActionAdd ==>|"Add Leg Membership"| BridgeNode
    
    LegCaller <==>|"Stream Full-Duplex Audio"| BridgeNode
    LegAgent <==>|"Stream Full-Duplex Audio"| BridgeNode
    LegMusic -->|"Stream Unidirectional Audio"| BridgeNode

    %% Curated Visual Tokens
    classDef cmdToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef bridgeToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef legToken fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class CommandHost,ActionCreate,ActionAdd cmdToken;
    class StasisBridge,BridgeNode bridgeToken;
    class MediaLegs,LegCaller,LegAgent,LegMusic legToken;
```

---

## Technical Bridge Engine Rules

### 1. Seamless Channel Handover
Adding independent channels into active mixing bridges suspends normal single-channel execution stacks automatically. Connected media payloads route directly across core bridging paths to minimize voice encoding delays.

### 2. Auto-Dissolve Configuration Traps
To avoid orphaned bridge allocation contexts from taking over PBX memory loops, container generation strings force automated structural dissolution (`auto_dissolve=true`) as soon as primary phone lines disconnect.
AI Chunks (RAG) 3 chunks
Chunk #1 Dynamic Multi-Leg Bridge Orchestration
# Dynamic Multi-Leg Bridge Orchestration

To connect separate telephone line channels seamlessly, **Asterisk 2** orchestrates high-performance voice bridges. The communication engine groups multiple audio legs into unified **Stasis Mixing Bridges** dynamically.

---
Chunk #2 Multi-Channel Media Bridging Topology
## Multi-Channel Media Bridging Topology

The layout below traces how background commands construct mixing spaces to merge independent phone streams:

```mermaid
graph LR
    %% Control Engine
    subgraph CommandHost["C# Orchestrator Task"]
        ActionCreate["POST /ari/bridges<br/>(Type: mixing, Name: 'ConfRoom')"]
        ActionAdd["POST /ari/bridges/{id}/addChannel<br/>(Injects Audio Legs)"]
    end

    %% Target Bridge Space
    subgraph StasisBridge["Active Media Mixing Module"]
        BridgeNode["Stasis Mixing Bridge<br/>(Unified Audio Domain)"]
    end

    %% Physical Channels
    subgraph MediaLegs["Decoupled Voice Sessions"]
        LegCaller["Inbound Mobile Caller<br/>(Channel ID: ast_channel_a)"]
        LegAgent["Outbound Support Agent<br/>(Channel ID: ast_channel_b)"]
        LegMusic["Music on Hold Generator<br/>(Channel ID: moh_playback)"]
    end

    %% Flow Vectors
    ActionCreate ==>|"Allocate Engine Space"| BridgeNode
    ActionAdd ==>|"Add Leg Membership"| BridgeNode
    
    LegCaller <==>|"Stream Full-Duplex Audio"| BridgeNode
    LegAgent <==>|"Stream Full-Duplex Audio"| BridgeNode
    LegMusic -->|"Stream Unidirectional Audio"| BridgeNode

    %% Curated Visual Tokens
    classDef cmdToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef bridgeToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef legToken fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class CommandHost,ActionCreate,ActionAdd cmdToken;
    class StasisBridge,BridgeNode bridgeToken;
    class MediaLegs,LegCaller,LegAgent,LegMusic legToken;
```

---
Chunk #3 Technical Bridge Engine Rules
## Technical Bridge Engine Rules

### 1. Seamless Channel Handover
Adding independent channels into active mixing bridges suspends normal single-channel execution stacks automatically. Connected media payloads route directly across core bridging paths to minimize voice encoding delays.

### 2. Auto-Dissolve Configuration Traps
To avoid orphaned bridge allocation contexts from taking over PBX memory loops, container generation strings force automated structural dissolution (`auto_dissolve=true`) as soon as primary phone lines disconnect.