Back to page

WebSocket Ingress Bus

Raw Markdown & AI/RAG Chunks
Raw Markdown Source 2298 chars
# WebSocket Ingress Bus

To intercept voice signaling states instantly, **Asterisk 2** configures persistent TCP messaging tunnels. The framework reads active Stasis app subscriptions using dedicated **WebSocket client wrappers**.

---

## Multi-Application Subscription Pipeline

The flowchart below maps out how logical event consumers register targets across isolated PBX dialing contexts:

```mermaid
graph LR
    %% Edge Client
    subgraph HostedService["C# Subscription Host"]
        SocketFactory["ClientWebSocket Wrapper<br/>(Configured Keep-Alive: 30s)"]
    end

    %% Target Bus
    subgraph AsteriskKernel["ARI Core Router"]
        AppSwayamvar["app=swayamvar Subscription<br/>(Handles Onboarding Calls)"]
        AppOutbound["app=outbound Subscription<br/>(Handles Scheduled Dials)"]
    end

    %% Storage Proxy
    subgraph DataStaging["Telephony Data Layer"]
        DbStore[("SessionEvents DB Table<br/>(High-Speed Raw Write Buffer)")]
    end

    %% Relations
    SocketFactory ==>|"GET /ari/events?app=swayamvar"| AppSwayamvar
    SocketFactory ==>|"GET /ari/events?app=outbound"| AppOutbound
    AppSwayamvar ==>|"Stream Telemetry"| DbStore
    AppOutbound ==>|"Stream Telemetry"| DbStore

    %% Custom Colored Tokens
    classDef svcClass fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef coreClass fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef storeClass fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class HostedService,SocketFactory svcClass;
    class AsteriskKernel,AppSwayamvar,AppOutbound coreClass;
    class DataStaging,DbStore storeClass;
```

---

## Handshaking direct properties

### 1. Keep-Alive Ping Scheduling
To keep long-lived connections operational across restrictive firewalls, background sockets execute periodic Ping network frames automatically every 30 seconds. Stale links trigger automatic disconnection traps to restart authentication handshakes cleanly.

### 2. Bulk Event Message Buffering
If data storage connections drop temporarily, internal memory ring buffers cache unparsed incoming event messages up to 10,000 distinct items. This completely prevents call tracking updates from dropping out during transient SQL cluster failovers.
AI Chunks (RAG) 3 chunks
Chunk #1 WebSocket Ingress Bus
# WebSocket Ingress Bus

To intercept voice signaling states instantly, **Asterisk 2** configures persistent TCP messaging tunnels. The framework reads active Stasis app subscriptions using dedicated **WebSocket client wrappers**.

---
Chunk #2 Multi-Application Subscription Pipeline
## Multi-Application Subscription Pipeline

The flowchart below maps out how logical event consumers register targets across isolated PBX dialing contexts:

```mermaid
graph LR
    %% Edge Client
    subgraph HostedService["C# Subscription Host"]
        SocketFactory["ClientWebSocket Wrapper<br/>(Configured Keep-Alive: 30s)"]
    end

    %% Target Bus
    subgraph AsteriskKernel["ARI Core Router"]
        AppSwayamvar["app=swayamvar Subscription<br/>(Handles Onboarding Calls)"]
        AppOutbound["app=outbound Subscription<br/>(Handles Scheduled Dials)"]
    end

    %% Storage Proxy
    subgraph DataStaging["Telephony Data Layer"]
        DbStore[("SessionEvents DB Table<br/>(High-Speed Raw Write Buffer)")]
    end

    %% Relations
    SocketFactory ==>|"GET /ari/events?app=swayamvar"| AppSwayamvar
    SocketFactory ==>|"GET /ari/events?app=outbound"| AppOutbound
    AppSwayamvar ==>|"Stream Telemetry"| DbStore
    AppOutbound ==>|"Stream Telemetry"| DbStore

    %% Custom Colored Tokens
    classDef svcClass fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef coreClass fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef storeClass fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class HostedService,SocketFactory svcClass;
    class AsteriskKernel,AppSwayamvar,AppOutbound coreClass;
    class DataStaging,DbStore storeClass;
```

---
Chunk #3 Handshaking direct properties
## Handshaking direct properties

### 1. Keep-Alive Ping Scheduling
To keep long-lived connections operational across restrictive firewalls, background sockets execute periodic Ping network frames automatically every 30 seconds. Stale links trigger automatic disconnection traps to restart authentication handshakes cleanly.

### 2. Bulk Event Message Buffering
If data storage connections drop temporarily, internal memory ring buffers cache unparsed incoming event messages up to 10,000 distinct items. This completely prevents call tracking updates from dropping out during transient SQL cluster failovers.