SIM Bank & Gateway Handshakes

SIM Bank & Gateway Handshakes

To leverage physical cellular mobile assets securely, Asterisk 2 implements an automated background polling service communicating directly with hardware gateway arrays. This software layer translates physical SIM bank operations into high-level C# data streams managed via TelephonyDbContext.


Hardware Integration Architecture

The following layout maps out the ongoing continuous polling interfaces keeping application logic synchronized with physical rack health states:

graph TD
    %% Hardware Arrays
    subgraph RackHardware["Physical Dinstar Enterprise Racks"]
        GatewayModule["Outbound Multi-Port GSM Gateway"]
        SIMStorage["SIM Storage Bank Array"]
    end

    %% Transport Layer
    subgraph NetworkBus["Internal Control Network"]
        API_Poll["Gateway Controller HTTP Bridge"]
    end

    %% State Orchestration Engine
    subgraph BackendCore["ASP.NET Core Operational Tier"]
        SyncService["GatewayStatusBackgroundService.cs<br/>(Continuous Hardware Sync)"]
        PoolManager["Dynamic Channel Load Allocator"]
    end

    %% Storage Context
    subgraph DataLayer["Relational Telephony Storage"]
        DB_Tel[("TelephonyDbContext<br/>(Active Port Status Arrays)")]
    end

    %% Continuous Loops
    GatewayModule <-->|"Propagate Active SIM"| SIMStorage
    API_Poll -->|"Poll Channel States<br/>(Idle, Busy, Failed)"| GatewayModule
    
    SyncService ==>|"Execute Polling Loop"| API_Poll
    SyncService ==>|"Update Realtime Line Matrices"| DB_Tel
    PoolManager ==>|"Read Healthy Line Matrix"| DB_Tel
    PoolManager ==>|"Assign Outbound Leg Dispatch"| GatewayModule

    %% Modern Dark High-Contrast Tokens
    classDef rackClass fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
    classDef netClass fill:#1e293b,stroke:#a855f7,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 dbClass fill:#065f46,stroke:#10b981,stroke-width:2px,color:#fff,rx:6px,ry:6px;

    class RackHardware,GatewayModule,SIMStorage rackClass;
    class NetworkBus,API_Poll netClass;
    class BackendCore,SyncService,PoolManager coreClass;
    class DataLayer,DB_Tel dbClass;

Operational Handshake Mechanics

1. Persistent Port Health Tracking

The application sync service queries individual hardware units periodically to retrieve operational parameters. Line states are continuously written to the core database context, marking ports with clear real-time indicators:

  • Idle: SIM card is fully registered with carrier networks and available for outbound assignment.
  • Busy: Active audio session in progress. Line locked to prevent crossing calls.
  • Failed: SIM registration timed out or line dropped. Port flagged for immediate administrative review.

2. Dynamic Pool Load Allocation

When an outbound call task triggers, routing services avoid static channel mappings. Instead, load balancing algorithms query TelephonyDbContext to locate an Idle line mapping directly to required carrier networks. This round-robin selection logic spreads out channel usage evenly across hardware modules, preventing premature carrier line blocking.


Implementation Safeties

Engineers updating hardware integration drivers must preserve background thread execution configurations ensuring external polling failures never crash core ASP.NET Core web host processes.