Skip to content

SS7 Protocol Examples

This page provides practical examples for common SS7 protocol operations.

Mobile Authentication

Send Authentication Info (SAI)

// Request authentication vectors from HLR
const saiRequest = {
  dialogType: 'BEGIN',
  components: [{
    type: 'invoke',
    operationCode: 'sendAuthenticationInfo',
    parameter: {
      imsi: '123450000000001',
      numberOfRequestedVectors: 5,
      requestingNodeType: 'vlr'
    }
  }]
};

try {
  const response = await client.ss7.sendTCAP(saiRequest);
  const { authenticationSets } = response.components[0].parameter;
  console.log(`Received ${authenticationSets.length} auth vectors`);
} catch (error) {
  console.error('SAI failed:', error);
}

Update Location (UL)

// Update subscriber location in HLR
const ulRequest = {
  dialogType: 'BEGIN',
  components: [{
    type: 'invoke',
    operationCode: 'updateLocation',
    parameter: {
      imsi: '123450000000001',
      mscNumber: '19195550123',
      vlrNumber: '19195550124',
      currentLocation: {
        ageOfLocationInformation: 0,
        locationInformation: {
          cellGlobalId: {
            mcc: '234',
            mnc: '15',
            lac: 1234,
            cellId: 5678
          }
        }
      }
    }
  }]
};

await client.ss7.sendTCAP(ulRequest);

SMS Operations

Mobile Originated SMS

// Send SMS from mobile device
const moSmsRequest = {
  dialogType: 'BEGIN',
  components: [{
    type: 'invoke',
    operationCode: 'mo-forwardSM',
    parameter: {
      sm_RP_DA: {
        serviceCentreAddressDA: '19195550100'
      },
      sm_RP_OA: {
        msisdn: '19195550200'
      },
      sm_RP_UI: {
        protocolId: 0,
        dataCodingScheme: 0,
        userDataLength: 10,
        shortMessage: Buffer.from('Hello World').toString('base64')
      }
    }
  }]
};

const response = await client.ss7.sendTCAP(moSmsRequest);

Mobile Terminated SMS

// Deliver SMS to mobile device
const mtSmsRequest = {
  dialogType: 'BEGIN',
  components: [{
    type: 'invoke',
    operationCode: 'mt-forwardSM',
    parameter: {
      sm_RP_DA: {
        imsi: '123450000000001'
      },
      sm_RP_OA: {
        serviceCentreAddressOA: '19195550100'
      },
      sm_RP_UI: {
        protocolId: 0,
        dataCodingScheme: 0,
        userDataLength: 14,
        shortMessage: Buffer.from('Message received').toString('base64')
      }
    }
  }]
};

await client.ss7.sendTCAP(mtSmsRequest);

ISUP Call Control

Initial Address Message (IAM)

// Initiate a call
const iamRequest = {
  cic: 1,
  natureOfConnectionIndicators: {
    satelliteIndicator: 'no-satellite',
    continuityCheckIndicator: 'not-required',
    echoControlDeviceIndicator: 'not-included'
  },
  forwardCallIndicators: {
    nationalInternationalCallIndicator: 'international',
    endToEndMethodIndicator: 'no-method-available',
    interworkingIndicator: 'no-interworking',
    endToEndInformationIndicator: 'no-end-to-end-information',
    isdnUserPartIndicator: 'isdn-all-the-way',
    isdnUserPartPreferenceIndicator: 'preferred'
  },
  callingPartyCategory: 'ordinary-subscriber',
  transmissionMediumRequirement: 'speech',
  calledPartyNumber: {
    natureOfAddressIndicator: 'international-number',
    numberingPlanIndicator: 'isdn-telephony',
    address: '442071234567'
  },
  callingPartyNumber: {
    natureOfAddressIndicator: 'international-number',
    numberingPlanIndicator: 'isdn-telephony',
    address: '14085550123',
    screeningIndicator: 'network-provided',
    addressPresentationRestricted: false
  }
};

await client.ss7.isup.sendIAM(iamRequest);

Answer Message (ANM)

// Answer the call
const anmRequest = {
  cic: 1,
  backwardCallIndicators: {
    chargeIndicator: 'charge',
    calledPartyStatusIndicator: 'subscriber-free',
    calledPartyCategoryIndicator: 'ordinary-subscriber',
    endToEndMethodIndicator: 'no-method-available'
  },
  connectedNumber: {
    natureOfAddressIndicator: 'international-number',
    numberingPlanIndicator: 'isdn-telephony',
    address: '442071234567'
  }
};

await client.ss7.isup.sendANM(anmRequest);

SCCP Routing

Global Title Translation

// Configure GTT rules
const gttConfig = {
  selector: 0,
  globalTitleIndicator: '0100',
  rules: [
    {
      prefix: '1919',  // US numbers
      translation: {
        pointCode: '2-2-2',
        subsystemNumber: 8,
        newGlobalTitle: {
          tt: 0,
          np: 1,
          nai: 4,
          address: '1919'
        }
      }
    },
    {
      prefix: '4420',  // UK numbers
      translation: {
        pointCode: '3-3-3',
        subsystemNumber: 8,
        newGlobalTitle: {
          tt: 0,
          np: 1,
          nai: 4,
          address: '4420'
        }
      }
    }
  ]
};

await client.ss7.configureGTT(gttConfig);

Load Balancing

// Configure load balancing for multiple destinations
const loadBalancingConfig = {
  mode: 'weighted-round-robin',
  destinations: [
    {
      pointCode: '2-2-2',
      weight: 2,
      subsystemNumber: 8
    },
    {
      pointCode: '2-2-3',
      weight: 1,
      subsystemNumber: 8
    }
  ],
  failover: {
    enabled: true,
    maxRetries: 3,
    timeout: 2000
  }
};

await client.ss7.configureLoadBalancing(loadBalancingConfig);

Network Management

// Configure SS7 linksets
const linkSetConfig = {
  name: 'primary-linkset',
  adjacentPointCode: '2-2-2',
  links: [
    {
      code: 0,
      slc: 0,
      linkType: 'A',
      priority: 1
    },
    {
      code: 1,
      slc: 1,
      linkType: 'A',
      priority: 1
    }
  ],
  timing: {
    t1: 12000,  // Alignment ready timer
    t2: 11500,  // Not aligned timer
    t3: 11500,  // Aligned timer
    t4: 11500,  // Emergency proving timer
    t5: 800,    // Sending SIB timer
    t7: 1000    // Excessive delay timer
  }
};

await client.ss7.configureLinkSet(linkSetConfig);

Traffic Management

// Configure traffic management
const trafficConfig = {
  congestionControl: {
    levels: [
      { threshold: 70, actions: ['throttle-new-traffic'] },
      { threshold: 85, actions: ['reject-new-traffic'] },
      { threshold: 95, actions: ['reject-all-traffic'] }
    ]
  },
  loadSharing: {
    mode: 'sls-based',
    slsRotation: true
  },
  screening: {
    rules: [
      {
        type: 'dpc-based',
        pattern: '1-1-*',
        action: 'allow'
      },
      {
        type: 'si-based',
        pattern: 'sccp',
        action: 'allow'
      }
    ]
  }
};

await client.ss7.configureTrafficManagement(trafficConfig);

Monitoring and Debugging

Message Tracing

// Enable detailed message tracing
client.ss7.on('message', (msg) => {
  console.log({
    timestamp: new Date().toISOString(),
    direction: msg.direction,
    type: msg.type,
    opc: msg.opc,
    dpc: msg.dpc,
    sls: msg.sls,
    payload: msg.payload
  });
});

Performance Metrics

// Monitor performance metrics
client.ss7.on('metrics', (metrics) => {
  console.log({
    timestamp: new Date().toISOString(),
    messageRate: metrics.messageRate,
    avgResponseTime: metrics.avgResponseTime,
    errorRate: metrics.errorRate,
    congestionLevel: metrics.congestionLevel,
    linksetStatus: metrics.linksetStatus
  });
});