Almuqeet Sigtran Stack

.NET 9 · v1.0

Introduction

SigtranStack is a carrier-grade C#/.NET 9 implementation of the complete SIGTRAN and SS7 protocol stack. It provides native Linux SCTP transport, all five SIGTRAN adaptation layers (M3UA, M2UA, M2PA, SUA, IUA), and the full SS7 upper layer suite (SCCP, TCAP, ISUP, MAP, CAP).

Key Features

Architecture

MAP · CAP · ISUP   (Application Layer)
TCAP   (Transaction Capabilities)
SCCP   (Signalling Connection Control Part)
M3UA · M2UA · M2PA · SUA · IUA   (Adaptation)
SCTP Transport   (Native Linux Kernel)

Stack Initialization Order

// 1. Transport
var transport = new SctpTransport(sctpConfig);

// 2. Adaptation layer (M3UA shown)
var m3ua = new M3uaLayer(m3uaConfig, transport, logger);

// 3. SCCP
var sccp = new SccpLayer(m3ua, loggerFactory);

// 4. TCAP
var tcap = new TcapLayer(sccp, SubsystemNumber.Msc, loggerFactory);

// 5. Application layer (MAP shown)
var map = new MapLayer(tcap, localAddress, loggerFactory);

Quick Start

Connect to a remote STP/SGP and send an SRI-SM query:

using SigtranStack.Configuration;
using SigtranStack.Transport;
using SigtranStack.M3UA;
using SigtranStack.SCCP;
using SigtranStack.TCAP;
using SigtranStack.MAP;

// Transport
var transport = new SctpTransport(new SctpConfig {
    RemoteAddresses = ["10.0.0.1"], RemotePort = 2905,
    LocalAddresses = ["10.0.0.2"], LocalPort = 2905,
    PayloadProtocolId = PayloadProtocolIdentifier.M3UA,
});

// M3UA
var m3ua = new M3uaLayer(new M3uaConfig {
    OperationMode = OperationMode.Asp,
    AutoActivate = true,
    DefaultRoutingContext = 100,
}, transport);

// SCCP + TCAP
var sccp = new SccpLayer(m3ua);
var tcap = new TcapLayer(sccp, SubsystemNumber.Msc);

// MAP
var localAddr = SccpAddress.FromGlobalTitle("441234000001", SubsystemNumber.Msc);
var map = new MapLayer(tcap, localAddr);

// Wire events
map.ResultReceived += (_, e) => {
    var (imsi, msc, _) = SmsUtils.DecodeSriSmResult(e.Parameter);
    Console.WriteLine($"IMSI={imsi}, MSC={msc}");
};

// Start stack and send SRI-SM
await m3ua.StartAsync();
var hlr = SccpAddress.FromGlobalTitle("441234000002", SubsystemNumber.Hlr);
await map.SendRoutingInfoForSmAsync(hlr, "919990206824", "441234000001");

SCTP Transport class

Native Linux kernel SCTP transport using P/Invoke. Supports one-to-one style sockets with multi-homing via sctp_bindx.

Constructor

new SctpTransport(SctpConfig config, ILogger? logger = null, int maxConcurrentSends = 64)

Properties

NameTypeDescription
TransportStateSctpTransportStateCurrent SCTP association state
IsConnectedboolTrue when in Established state
LocalEndPointsIReadOnlyList<IPEndPoint>Local multi-homed endpoints
RemoteEndPointsIReadOnlyList<IPEndPoint>Remote multi-homed endpoints

Methods

SignatureDescription
Task ConnectAsync(CancellationToken ct)Establish SCTP association
Task SendAsync(byte[] data, ushort streamId, uint ppid, CancellationToken ct)Send data on stream with PPID
Task ShutdownAsync(CancellationToken ct)Graceful SHUTDOWN chunk
Task AbortAsync(string? reason, CancellationToken ct)Abort with SO_LINGER

Events

EventArgsDescription
DataReceivedSctpDataReceivedEventArgsData received (Data, StreamId, PayloadProtocolId, Tsn)
AssociationStateChangedSctpAssociationEventArgsState transition (State, Info)
ErrorOccurredSctpErrorEventArgsError (ErrorMessage, Exception)

SCTP Listener class

Server-side SCTP listener for SGP operation. Accepts incoming associations from ASPs.

var listener = new SctpListener(config);
listener.ConnectionAccepted += (_, transport) => { /* handle new ASP */ };
listener.Start();

Multi-Association Transport class

Manages a pool of SCTP associations with configurable load distribution. Supports Round-Robin, Active-Standby, Least-Loaded, and Weighted distribution.

Constructor

new MultiAssociationTransport(ILoggerFactory? loggerFactory,
    LoadDistribution distribution = LoadDistribution.RoundRobin)

Load Distribution Modes

ModeBehavior
RoundRobinCycle sequentially through active associations
ActiveStandbyFirst active only; failover on disconnect
LeastLoadedPick association with fewest in-flight messages
WeightedDistribute based on per-association Weight config

Key Methods

SignatureDescription
SctpAssociation AddAssociation(SctpAssociationConfig config)Add single association to pool
List<SctpAssociation> AddAssociations(int count, string remoteAddr, int port, ...)Bulk add associations
Task ConnectAllAsync(CancellationToken ct)Connect all associations in parallel
Task SendAsync(byte[] data, ushort streamId, uint ppid, CancellationToken ct)Load-distributed send
List<AssociationStatus> GetAllStatus()Snapshot of all associations

SCTP Configuration class

SctpConfig holds all SCTP socket parameters per RFC 4960.

PropertyDefaultDescription
RemoteAddressesRemote host addresses (multi-homing)
RemotePort2905Remote SCTP port
LocalAddressesLocal bind addresses
LocalPort0Local port (0 = ephemeral)
RtoInitialMs3000Initial RTO (retransmission timeout)
RtoMinMs / RtoMaxMs1000 / 60000RTO bounds
MaxRetransmits10Association max retransmits
HeartbeatIntervalMs30000Heartbeat interval
NumOutboundStreams10Number of outbound streams
NumInboundStreams10Number of inbound streams
PayloadProtocolIdM3UA (3)PPID for outbound data

M3UA Layer class

MTP3 User Adaptation Layer per RFC 4666. Handles ASP state machine (Down → Inactive → Active), heartbeats, protocol data transfer, and signalling network management (SSNM).

Constructor

new M3uaLayer(M3uaConfig config, ISctpTransport transport, ILogger? logger = null)

Configuration (M3uaConfig)

PropertyDefaultDescription
OperationModeAspAsp, Sgp, or Ipsp
AutoActivatetrueAuto-send ASP Active after ASP Up Ack
TrafficModeOverrideOverride, Loadshare, or Broadcast
AspIdentifierOptional ASP identifier
DefaultRoutingContextRouting context for traffic
PointCodeFormatITU_NationalPoint code format (ITU 14-bit, ANSI 24-bit)
RoutingKeys[]List of M3uaRoutingKeyConfig entries

Methods

SignatureDescription
Task StartAsync(CancellationToken ct)Connect SCTP and begin ASP Up handshake
Task StopAsync(CancellationToken ct)Graceful shutdown (ASP Down)
Task SendProtocolDataAsync(uint dpc, uint opc, byte si, byte ni, byte sls, byte[] data, ...)Send MTP3 user data (e.g. SCCP)

Events

EventDescription
StateChangedASP state transition (OldState, NewState, Reason)
DataReceivedIncoming protocol data (OPC, DPC, SI, NI, SLS, Data)
ManagementNotificationSSNM events: DUNA, DAVA, SCON, DUPU

M2UA Layer class

MTP2 User Adaptation per RFC 3331. Provides MTP2 backhauling over IP for signalling links.

new M2uaLayer(M2uaConfig config, ISctpTransport transport, ILogger? logger)

Events: LinkEstablished, LinkReleased, LinkStateChanged

M2PA Layer class

MTP2 Peer-to-Peer Adaptation per RFC 4165. Peer-to-peer MTP2 replacement with proving timers (T1, T2, T3, T4/T4E) per Q.703.

new M2paLayer(M2paConfig config, ISctpTransport transport, ILogger? logger)

SUA Layer class

SCCP User Adaptation per RFC 3868. Provides both connectionless and connection-oriented SCCP services over SCTP.

new SuaLayer(SuaConfig config, ISctpTransport transport, ILogger? logger)

IUA Layer class

ISDN User Adaptation per RFC 4233. Transports Q.921 LAPD frames over SCTP. Supports BRI/PRI interfaces and multiple ISDN variants (EuroISDN, ITU-T, DMS-100, 5ESS, NTT INS-Net).

new IuaLayer(IuaConfig config, ISctpTransport transport, ILogger? logger)

ASP Manager class

Manages Application Servers and their ASPs with traffic distribution per RFC 4666.

Traffic Modes

ModeDescription
Override1:1 — one active ASP per AS; automatic failover
LoadshareN:N — traffic distributed by SLS-based weighted round-robin
Broadcast1:N — all active ASPs receive all traffic

Key Methods

SignatureDescription
void RegisterApplicationServer(ApplicationServer server)Register a new AS
void RegisterAsp(uint routingContext, AspInstance asp)Add ASP to an AS
void TransitionAspState(uint rc, uint aspId, AspState newState)Change ASP state (triggers AS state recalculation)
IReadOnlyList<AspInstance> SelectAspsForTraffic(uint rc)Select ASPs for message delivery
AspInstance? SelectAspBySls(uint rc, byte sls)Select ASP by Signalling Link Selection

SCCP Layer class

Signalling Connection Control Part per ITU-T Q.711-Q.714. Provides connectionless (UDT/XUDT) and connection-oriented (CR/CC/DT1) services with Global Title Translation (GTT).

Constructor

new SccpLayer(M3uaLayer? m3ua, ILoggerFactory? loggerFactory = null)

Properties

PropertyDefaultDescription
LocalPointCodeLocal signalling point code
DefaultHopCounter15XUDT hop counter
GttGlobal Title Translator (add/remove GTT rules)
MaxConnections10000Max concurrent SCCP connections

Methods

SignatureDescription
void RegisterSubsystem(byte ssn, ISccpUser user)Register a local subsystem (TCAP, ISUP, etc.)
Task SendUnitDataAsync(SccpAddress cdPA, SccpAddress cgPA, byte[] data, ...)Send connectionless UDT
Task SendExtendedUnitDataAsync(SccpAddress cdPA, SccpAddress cgPA, byte[] data, ...)Send XUDT with hop counter
Task<uint> ConnectAsync(SccpAddress cdPA, SccpAddress cgPA, ...)Open connection-oriented session
Task SendConnectionDataAsync(uint localRef, byte[] data)Send data on connection
Task ReleaseConnectionAsync(uint localRef, SccpReleaseCause cause)Release connection

GTT (Global Title Translation)

sccp.Gtt.AddRule(new GttRule {
    Name = "HLR",
    DigitPattern = "44123",      // Match GT prefix
    TranslationType = 0,
    DestinationPointCode = 2,
    DestinationSsn = SubsystemNumber.Hlr,
    RouteOnDpcSsn = true,
    Priority = 100,
});

SCCP Addressing class

SccpAddress represents an SCCP Called/Calling Party Address with optional Point Code, SSN, and Global Title.

Factory Methods

// Route on DPC + SSN
var addr = SccpAddress.FromDpcSsn(pointCode: 2, ssn: SubsystemNumber.Hlr);

// Route on Global Title
var addr = SccpAddress.FromGlobalTitle(
    digits: "441234567890",
    ssn: SubsystemNumber.Msc,
    nai: NatureOfAddress.InternationalNumber,
    np: NumberingPlan.IsdnTelephony);

Subsystem Numbers

ConstantValueDescription
SubsystemNumber.Hlr6Home Location Register
SubsystemNumber.Vlr7Visitor Location Register
SubsystemNumber.Msc8Mobile Switching Centre / SMSC
SubsystemNumber.Map5MAP subsystem
SubsystemNumber.Cap146CAMEL Application Part
SubsystemNumber.Isup3ISDN User Part

TCAP Layer class

Transaction Capabilities Application Part per ITU-T Q.771-Q.772. Manages structured dialogues (Begin/Continue/End) with invoke-level timeout tracking.

Constructor

new TcapLayer(SccpLayer? sccp, byte ssn, ILoggerFactory? loggerFactory = null)

Properties

PropertyDefaultDescription
SsnSCCP subsystem number this TCAP is registered on
DefaultInvokeTimeoutMs30000Default timeout for invokes
MaxTransactions100000Max concurrent transactions
TransactionIdleTimeoutMs300000Idle transaction cleanup timeout
ActiveTransactionCountCurrent number of active transactions

Methods

SignatureDescription
Task<uint> BeginDialogueAsync(SccpAddress cdPA, SccpAddress cgPA, List<TcapComponent>? components, byte[]? dialoguePortion)Begin new TCAP dialogue (returns local TID)
Task ContinueDialogueAsync(uint localTid, List<TcapComponent>? components, byte[]? dialoguePortion)Continue existing dialogue
Task EndDialogueAsync(uint localTid, List<TcapComponent>? components, byte[]? dialoguePortion)End dialogue
Task AbortDialogueAsync(uint localTid, TcapAbortCause? cause)Abort dialogue
TcapTransaction? FindTransaction(uint localTid)Lookup transaction by ID

Events

EventDescription
DialogueIndicationNew incoming dialogue (Begin received)
InvokeIndicationInvoke component received
ResultIndicationReturnResult component received
ErrorIndicationReturnError component received
RejectIndicationReject component received
DialogueCloseDialogue ended or aborted

TCAP Component Types

// Invoke
var invoke = new TcapInvoke {
    InvokeId = 1, OperationCode = 45, // SRI-SM
    Parameter = encodedArg, TimeoutMs = 10000,
};

// Return Result
var result = new TcapReturnResult {
    InvokeId = 1, OperationCode = 45,
    Parameter = encodedResult, IsLast = true,
};

// Return Error
var error = new TcapReturnError {
    InvokeId = 1, ErrorCode = 34,
};

ASN.1 BER Utilities static

Asn1Ber provides BER encoding/decoding primitives used throughout the stack.

MethodDescription
byte[] EncodeTlv(byte tag, byte[] value)Encode single-byte tag TLV
byte[] EncodeTlv(byte tag1, byte tag2, byte[] value)Encode two-byte tag TLV (high tag number form)
byte[] EncodeLength(int length)Encode BER definite length
(int, int) DecodeLength(byte[] data, int offset)Decode BER length (value, bytes consumed)
(byte, int, int, int) ParseTlv(byte[] data, int offset)Parse TLV: (Tag, ValueOffset, ValueLength, TotalLength)
byte[] EncodeInteger(long value)Encode BER INTEGER
long DecodeInteger(byte[] data, int offset, int length)Decode BER INTEGER

MAP Layer class

GSM Mobile Application Part per 3GPP TS 29.002. Provides dialogue management, operation encoding, and high-level service methods for all MAP operations.

Constructor

new MapLayer(TcapLayer tcap, SccpAddress localAddress, ILoggerFactory? loggerFactory = null)

Properties

PropertyDefaultDescription
MaxDialogues100000Max concurrent MAP dialogues
DefaultInvokeTimeoutMs30000Default invoke timeout
SriSmTimeoutMs10000SRI-SM specific timeout
MtForwardSmTimeoutMs15000MT-ForwardSM timeout
MoForwardSmTimeoutMs15000MO-ForwardSM timeout
AlertScTimeoutMs10000AlertServiceCentre timeout
UssdTimeoutMs30000USSD operation timeout
ActiveDialogueCountCurrent active dialogues

Events

EventArgs TypeDescription
OperationReceivedMapOperationEventArgsIncoming MAP operation (DialogueId, InvokeId, OperationCode, Parameter, UserState)
ResultReceivedMapResultEventArgsOperation result received
ErrorReceivedMapErrorEventArgsMAP error received (ErrorCode, Parameter)
TimeoutReceivedMapTimeoutEventArgsInvoke timeout (TimeoutMs)
DialogueOpenedMapDialogueEventArgsNew dialogue opened by remote
DialogueClosedMapDialogueEventArgsDialogue closed

MAP Service Methods

High-level async methods that build parameters, open dialogues, and send MAP operations. All return the dialogue ID (uint) for correlation.

MethodDescription
SendRoutingInfoForSmAsync(hlrAddr, msisdn, scAddr, userState?)SRI-SM — query HLR for subscriber routing info
MtForwardSmAsync(mscAddr, imsi, smscAddr, tpdu, userState?)MT-ForwardSM — deliver SMS to MSC
MoForwardSmAsync(smscAddr, smscGt, senderMsisdn, tpdu, userState?)MO-ForwardSM — submit SMS from subscriber
ReportSmDeliveryStatusAsync(hlrAddr, msisdn, scAddr, outcome, userState?)Report SMS delivery status to HLR
AlertServiceCentreAsync(smscAddr, msisdn, scAddr, userState?)Alert SMSC that subscriber is reachable
UpdateLocationAsync(hlrAddr, imsi, mscNumber, vlrNumber, userState?)Update subscriber location at HLR
SendAuthenticationInfoAsync(hlrAddr, imsi, numVectors, userState?)Request authentication vectors
SendRoutingInfoAsync(hlrAddr, msisdn, gmscAddr?, userState?)SRI — routing info for voice call
ProcessUssdRequestAsync(hlrAddr, ussdString, msisdn?, userState?)USSD request (e.g. *123#)
AnyTimeInterrogationAsync(hlrAddr, msisdn, gsmScfAddr, userState?)ATI — query subscriber location/state
CheckImeiAsync(eirAddr, imei, userState?)Check IMEI against EIR

Responding to Incoming Operations

map.OperationReceived += async (_, e) => {
    if (e.OperationCode == MapOperationCode.SendRoutingInfoForSM) {
        var (msisdn, _, _) = SmsUtils.DecodeSriSmArg(e.Parameter);
        var result = SmsUtils.BuildSriSmResult(imsi, mscAddress);
        await map.SendResultAndCloseAsync(
            e.DialogueId, e.InvokeId,
            MapOperationCode.SendRoutingInfoForSM, result);
    }
};

SMS Utilities static

SmsUtils provides encoding and decoding for SMS TPDUs, MAP SMS parameters, and GSM 7-bit packing.

SRI-SM (Send Routing Info for SM)

MethodDescription
(string? Msisdn, bool SmRpPri, string? ScAddress) DecodeSriSmArg(byte[] data)Decode SRI-SM argument
(string? Imsi, string? MscAddress, string? Lmsi) DecodeSriSmResult(byte[] data)Decode SRI-SM result
byte[] BuildSriSmResult(string imsi, string mscAddress)Build SRI-SM result (for responding)

SMS TPDU Building

MethodDescription
byte[] BuildSmsDeliverTpdu(string originator, string text)Build SMS-DELIVER TPDU (MT direction)
byte[] BuildSmsSubmitTpdu(string destination, string text)Build SMS-SUBMIT TPDU (MO direction)
List<byte[]> BuildConcatenatedSmsDeliverTpdus(string originator, string text)Build multi-part SMS with UDH concatenation

SMS TPDU Decoding

MethodDescription
(string? Text, string? Originator, byte Dcs) DecodeSmsDeliverTpdu(byte[] tpdu)Decode SMS-DELIVER
(string? Text, string? DestNumber, byte Dcs) DecodeSmsSubmitTpdu(byte[] tpdu)Decode SMS-SUBMIT

MT/MO ForwardSM

MethodDescription
(string?, string?, byte[]?) DecodeMtForwardSmArg(byte[] data)Decode MT-ForwardSM (IMSI, SMSC, TPDU)
(string?, string?, byte[]?) DecodeMoForwardSmArg(byte[] data)Decode MO-ForwardSM (DestAddr, SenderMsisdn, TPDU)

Other

MethodDescription
(string?, string?) DecodeAlertServiceCentreArg(byte[] data)Decode AlertServiceCentre (Msisdn, ScAddress)
string GetMapErrorName(int errorCode)Human-readable MAP error name
byte[] PackGsm7Bit(string text)Pack text in GSM 7-bit encoding
bool NeedsUcs2(string text)Check if text requires UCS-2

SMS Home Router class

Intercepts SRI-SM requests, queries the HLR for real subscriber data, stores IMSI-to-MSC mappings, and relays MT-Forward-SM to the real MSC. Provides carrier-grade SMS home routing with congestion control and retry logic.

Architecture

Foreign SMSC ──SRI-SM──> [Home Router] ──SRI-SM──> HLR
                              │
                         stores IMSI→MSC mapping
                         returns local MSC address
                              │
Foreign SMSC ──MT-FSM──> [Home Router] ──MT-FSM──> Real MSC

Configuration

var config = new SmsHomeRouterConfig {
    LocalMscAddress = "441234000001",
    HlrAddress = SccpAddress.FromGlobalTitle("441234000002", 6),
    MappingTtl = TimeSpan.FromMinutes(5),
    MaxStoredMappings = 500_000,
    HlrQueryTimeoutMs = 10_000,
    MtForwardTimeoutMs = 15_000,
    MaxRetries = 2,
    RetryDelayMs = 500,
    HomeImsiPrefixes = new HashSet<string> { "23415", "23410" },
    RemoveMappingOnDelivery = false,
    Enabled = true,
};

Usage

var hr = new SmsHomeRouter(mapLayer, config, congestionController, loggerFactory);
hr.SriSmInterceptedEvent += (_, e) =>
    Console.WriteLine($"Intercepted: MSISDN={e.Msisdn} IMSI={e.Imsi}");
hr.Start();

// Query stats
var stats = hr.GetStats();
Console.WriteLine($"Intercepted: {stats.SriSmIntercepted}, Active: {stats.MappingsActive}");

// Lookup a mapping
var entry = hr.LookupMapping("234150123456789");

// Shutdown
hr.Stop();
hr.Dispose();

Public API

Method / PropertyDescription
void Start()Start intercepting SRI-SM and MT-Forward operations
void Stop()Stop and cancel pending operations
bool IsRunningWhether the home router is active
int ActiveMappingsCount of stored IMSI mappings
SmsHomeRouterStats GetStats()Snapshot of all counters
void ResetStats()Reset all counters to zero
ImsiMappingEntry? LookupMapping(string imsi)Lookup mapping by IMSI
int PurgeMappings()Remove all mappings
int PurgeExpiredMappings()Remove expired mappings only

Events

EventDescription
SriSmInterceptedEventSRI-SM successfully intercepted (MSISDN, IMSI, MscAddress)
MtForwardRelayedEventMT-Forward-SM relayed to real MSC
OperationFailedEventAny operation failure (with detail string)

ISUP Layer class

ISDN User Part per ITU-T Q.761-Q.764. Manages circuit-switched call setup/release with timer supervision.

Constructor

new IsupLayer(M3uaLayer? m3ua, ILoggerFactory? loggerFactory = null)

Call Control Methods

MethodDescription
Task<ushort> SetupCallAsync(PointCode destPc, IsupNumber called, IsupNumber? calling, byte category)Initiate call (sends IAM), returns CIC
Task SendAcmAsync(ushort cic, ushort bci)Send Address Complete (ACM)
Task SendAnmAsync(ushort cic)Send Answer (ANM)
Task ReleaseCallAsync(ushort cic, byte causeValue)Release call (sends REL)
Task BlockCircuitAsync(ushort cic)Block circuit (BLO)
Task UnblockCircuitAsync(ushort cic)Unblock circuit (UBL)
Task ResetCircuitAsync(ushort cic)Reset circuit (RSC)

Events

EventDescription
IncomingCallIAM received (CIC, CalledNumber, CallingNumber)
CallAlertingACM received (ringing)
CallConnectedANM received (answered)
CallReleasedREL/RLC received (with Q.850 cause)

ISUP Number Encoding

var called = new IsupNumber {
    Digits = "441234567890",
    NatureOfAddress = 0x04,  // International
    NumberingPlan = 0x01,    // ISDN/E.164
};
byte[] encoded = called.EncodeCalledParty();

CAP / CAMEL Layer class

CAMEL Application Part per 3GPP TS 29.078. Supports CAMEL Phase 1-4 for call control, SMS control, and GPRS control from Service Control Functions (SCF).

Constructor

new CapLayer(TcapLayer tcap, SccpAddress localAddress,
    CapLayerConfig? config = null, ILoggerFactory? loggerFactory = null)

Call Control Methods (gsmSCF → gsmSSF)

MethodDescription
InitialDPAsync(scfAddr, serviceKey, calledParty, callingParty?, imsi?, userState?)Initial Detection Point
SendConnectAsync(dialogueId, destinationRoutingAddress)Connect to destination
SendContinueAsync(dialogueId)Continue call processing
SendReleaseCallAsync(dialogueId, causeValue)Release call (Q.850 cause)
SendRequestReportBCSMEventAsync(dialogueId, events...)Request BCSM event reports
SendApplyChargingAsync(dialogueId, maxDuration, releaseIfExceeded, leg)Apply charging
SendActivityTestAsync(dialogueId)Activity test (keepalive)
SendResetTimerAsync(dialogueId, timerValue)Reset TSSF timer

SMS Control Methods

MethodDescription
InitialDPSMSAsync(scfAddr, serviceKey, calledParty, ...)Initial DP for SMS
SendConnectSMSAsync(dialogueId, destAddr?, smscAddr?)Connect SMS to destination
SendContinueSMSAsync(dialogueId)Continue SMS processing
SendReleaseSMSAsync(dialogueId, rpCause)Release SMS (RP cause)

BCSM Event Types

EventValueDescription
CollectedInfo2Digits collected
RouteSelectFailure4Route selection failed
OAnswer7Originating side answered
ODisconnect9Originating side disconnected
TAnswer15Terminating side answered
TDisconnect17Terminating side disconnected

Application Contexts

ContextPhase
CapApplicationContext.GsmSsfToScf_v1CAMEL Phase 1
CapApplicationContext.GsmSsfToScf_v2CAMEL Phase 2
CapApplicationContext.GsmSsfToScf_v3CAMEL Phase 3 (UMTS)
CapApplicationContext.GsmSsfToScf_v4CAMEL Phase 4 (Enhanced)
CapApplicationContext.GsmSsfToScfSms_v3SMS CAMEL Phase 3
CapApplicationContext.GprsSsfToScf_v3GPRS CAMEL Phase 3

Congestion Controller class

Adaptive sliding-window congestion controller with rate control. Adjusts window size and inter-send delay based on success/failure/timeout signals.

Constructor

new CongestionController(
    maxConcurrent: 50,
    minConcurrent: 5,
    initialDelayMs: 50,
    minDelayMs: 10,
    maxDelayMs: 2000)

Usage Pattern

if (await cc.AcquireSlot(ct)) {
    try {
        await SendOperation();
        cc.OnSuccess();
    } catch (TimeoutException) {
        cc.OnTimeout();
    } catch {
        cc.OnError();
    } finally {
        cc.ReleaseSlot();
    }
}

Signal Methods

MethodEffect
OnSuccess()Count toward recovery; widen window after threshold
OnCongestion(string reason)Halve window, increase delay
OnTimeout()Decrease window, increase delay
OnError()Count error (no window change)
Task<bool> AcquireSlot(CancellationToken ct)Wait for available slot in window
void ReleaseSlot()Return slot after response
CongestionSnapshot GetSnapshot()Immutable state snapshot

Rate Limiter class

Token bucket rate limiter for inbound message protection.

TokenBucketRateLimiter

var limiter = new TokenBucketRateLimiter(maxTokens: 1000, refillPerSecond: 100.0);
if (limiter.TryConsume()) { /* process message */ }

PerPeerRateLimiter

var limiter = new PerPeerRateLimiter(maxTokensPerPeer: 100, refillPerSecond: 50.0);
if (limiter.TryConsume(peerId: originatingPointCode)) { /* allow */ }

Point Code class

SS7 Point Code supporting ITU (14-bit: 3-8-3) and ANSI (24-bit: 8-8-8) formats.

Factory Methods

var itu = PointCode.CreateItuInternational(zone: 3, area: 8, spId: 3);
var nat = PointCode.CreateItuNational(1234);
var ansi = PointCode.CreateAnsi(network: 10, cluster: 20, member: 30);
var generic = PointCode.FromValue(1234, PointCodeFormat.ITU_National);

SIGTRAN Message class

Common SIGTRAN message format (8-byte header + TLV parameters) per RFC 4666 Section 3.1. Used by all adaptation layers.

var msg = new SigtranMessage(MessageClass.Transfer, M3uaMessageType.DATA);
msg.AddParameter(new TlvParameter(ParameterTag.ProtocolData, protocolData));
byte[] wire = msg.Encode();

// Decode
var decoded = SigtranMessage.Decode(wire);
var pd = decoded.FindParameter(ParameterTag.ProtocolData);

Enumerations Reference

AspState

DownInactiveActivePendingActivePendingInactivePendingDown

OperationMode

Asp — Application Server ProcessSgp — Signalling Gateway ProcessIpsp — IP Signalling Point (peer-to-peer)

TrafficMode

Override (1) — 1:1 failoverLoadshare (2) — N:N distributedBroadcast (3) — 1:N replicated

ServiceIndicator

SNM (0)SCCP (3)TUP (4)ISUP (5)

NetworkIndicator

International (0)National (2)

PointCodeFormat

ITU_International — 3-8-3 (14-bit)ITU_National — 14-bitANSI — 8-8-8 (24-bit)

Constants Reference

Payload Protocol Identifiers

ProtocolPPID
IUA1
M2UA2
M3UA3
SUA4
M2PA5

Default SCTP Ports

ProtocolPort
M3UA2905
M2UA2904
M2PA3565
SUA14001
IUA9900

MAP Operation Codes

OperationCode
UpdateLocation2
CancelLocation3
SendRoutingInfo22
SendRoutingInfoForSM45
MoForwardSM46
MtForwardSM44
ReportSMDeliveryStatus47
SendAuthenticationInfo56
ProcessUnstructuredSSRequest59
AlertServiceCentre64
AnyTimeInterrogation71

CAP Operation Codes

OperationCode
InitialDP0
Connect20
ReleaseCall22
RequestReportBCSMEvent23
EventReportBCSM24
Continue31
ApplyCharging35
ApplyChargingReport36
ActivityTest55
InitialDPSMS60
ConnectSMS62
ContinueSMS65
ReleaseSMS66

Q.850 Cause Values

CauseValue
UnallocatedNumber1
NormalCallClearing16
UserBusy17
NoAnswerFromUser19
CallRejected21
TemporaryFailure41
NormalUnspecified31

Almuqeet Sigtran Stack Documentation

RFC references: 4960 (SCTP), 4666 (M3UA), 3331 (M2UA), 4165 (M2PA), 3868 (SUA), 4233 (IUA)

ITU-T: Q.711-714 (SCCP), Q.771-772 (TCAP), Q.761-764 (ISUP), Q.850 (Causes)

3GPP: TS 29.002 (MAP), TS 29.078 (CAP), TS 23.040 (SMS)