Skip to content

API Reference

Complete reference for TelcoAPI's protocol implementations.

Client Setup

Installation

npm install @telcoapi/client

Basic Configuration

import { TelcoAPI } from '@telcoapi/client';

const client = new TelcoAPI({
  apiKey: 'your-api-key',
  environment: 'production', // or 'sandbox'
  timeout: 30000, // 30 seconds
  retries: 3
});

SS7 API

MTP3 Operations

Configure MTP3

interface MTP3Config {
  pointCode: string;
  networkIndicator: 'international' | 'national' | 'reserved';
  serviceIndicator: 'sccp' | 'isup' | 'tup';
}

await client.ss7.configureMTP3(config: MTP3Config): Promise<void>

Route Management

interface RouteConfig {
  destination: string;
  linkset: string;
  priority: number;
}

await client.ss7.addRoute(config: RouteConfig): Promise<void>
await client.ss7.removeRoute(destination: string): Promise<void>

SCCP Operations

Global Title Translation

interface GTTConfig {
  tt: number;
  np: number;
  nai: number;
  address: string;
  routingIndicator: 'gt' | 'ssn';
}

await client.ss7.configureGTT(config: GTTConfig): Promise<void>

TCAP/MAP Operations

interface TCAPMessage {
  dialogType: 'BEGIN' | 'CONTINUE' | 'END' | 'ABORT';
  components: Array<{
    type: 'invoke' | 'returnResult' | 'returnError' | 'reject';
    operationCode: string | number;
    parameter?: any;
  }>;
}

await client.ss7.sendTCAP(message: TCAPMessage): Promise<TCAPResponse>

Diameter API

Session Management

interface DiameterSession {
  sessionId: string;
  authApplicationId: number;
  originHost: string;
  originRealm: string;
}

await client.diameter.createSession(config: DiameterSession): Promise<Session>

Authentication Requests

interface AuthRequest {
  sessionId: string;
  userName: string;
  authSessionState: number;
  originHost: string;
  originRealm: string;
}

await client.diameter.sendAuthRequest(request: AuthRequest): Promise<AuthAnswer>

Credit Control

interface CCRequest {
  sessionId: string;
  requestType: 'INITIAL' | 'UPDATE' | 'TERMINATE';
  subscriptionId: string;
  requestedAction?: 'DIRECT_DEBITING' | 'REFUND_ACCOUNT';
  serviceIdentifier?: number;
}

await client.diameter.sendCCR(request: CCRequest): Promise<CCAnswer>

SIP API

Registration

interface SIPRegistration {
  username: string;
  password: string;
  realm: string;
  expires?: number;
  contactUri?: string;
}

await client.sip.register(config: SIPRegistration): Promise<void>

Call Control

interface CallOptions {
  to: string;
  from: string;
  mediaOptions: {
    audio: boolean;
    video: boolean;
    codecs?: string[];
  };
}

const call = await client.sip.call(options: CallOptions): Promise<Call>

// Call instance methods
call.answer(mediaOptions?: MediaOptions): Promise<void>
call.reject(code?: number, reason?: string): Promise<void>
call.terminate(): Promise<void>

Messaging

interface MessageOptions {
  to: string;
  content: string;
  contentType?: string;
  headers?: Record<string, string>;
}

await client.sip.sendMessage(options: MessageOptions): Promise<void>

IPX/GRx API

Network Configuration

interface IPXConfig {
  networkId: string;
  services: string[];
  qosClass: string;
  redundancy: boolean;
}

await client.ipx.configure(config: IPXConfig): Promise<void>

QoS Management

interface QoSProfile {
  latency: {
    max: number;
    target: number;
  };
  jitter: {
    max: number;
    target: number;
  };
  packetLoss: {
    max: number;
    target: number;
  };
}

await client.ipx.setQoSProfile(profile: QoSProfile): Promise<void>

Error Handling

Error Codes

Code Description Resolution
AUTH_FAILED Authentication failed Check API key or credentials
NETWORK_ERROR Network connectivity issue Check network connection
INVALID_REQUEST Invalid request parameters Validate request parameters
RESOURCE_NOT_FOUND Requested resource not found Verify resource exists
RATE_LIMITED Too many requests Implement backoff strategy

Error Response Format

interface APIError {
  code: string;
  message: string;
  details?: any;
  requestId?: string;
}

Error Handling Example

try {
  await client.ss7.sendTCAP(message);
} catch (error) {
  if (error.code === 'NETWORK_ERROR') {
    // Implement retry logic
    await retry(() => client.ss7.sendTCAP(message));
  } else {
    // Log error and handle appropriately
    console.error(`Error: ${error.code}`, error.details);
  }
}

Rate Limits

API Rate Limit Period
SS7 1000 per second
Diameter 2000 per second
SIP 500 per second
IPX 5000 per second

Webhooks

Configuration

interface WebhookConfig {
  url: string;
  events: string[];
  secret: string;
}

await client.configureWebhook(config: WebhookConfig): Promise<void>

Event Types

  • ss7.message.received
  • diameter.session.created
  • sip.call.started
  • ipx.qos.alert

Webhook Payload

interface WebhookPayload {
  event: string;
  timestamp: string;
  data: any;
  signature: string;
}

SDK Versions

Language Package Name Latest Version
Node.js @telcoapi/client 2.1.0
Python telcoapi-python 1.8.2
Java com.telcoapi.client 2.0.1
Go github.com/telcoapi/client 1.5.0