Derive the notation names from one table and refuse an smsIdFormat that is not the pair

This commit is contained in:
2026-08-30 22:45:02 +02:00
parent 8e5b9bb556
commit 696e018b77
12 changed files with 111 additions and 56 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ import type { OnRequest } from './session-options.ts';
import type { PduObject } from './pdu.ts';
import type { Session } from './session.ts';
import type { SmppLog } from './log.ts';
import type { SmsIdFormat } from './sms-id.ts';
import type { SmsIdNotation } from './sms-id.ts';
import { Reassembler, decodeSegments } from './reassembly.ts';
import { bindCommands, defaults } from './session-options.ts';
import { concatInfo } from './udh.ts';
@@ -19,7 +19,7 @@ export type IncomingRequestsOptions = {
maxReassembly?: number | undefined;
onRequest?: OnRequest | undefined;
reassemblyTimeout?: number | undefined;
receiptIdFormat?: SmsIdFormat | undefined;
receiptIdNotation?: SmsIdNotation | undefined;
session: Session;
systemId?: string | undefined;
};
@@ -30,7 +30,7 @@ export class IncomingRequests {
private readonly log: SmppLog;
private readonly onRequest: OnRequest | undefined;
private readonly reassembler: Reassembler;
private readonly receiptIdFormat: SmsIdFormat | undefined;
private readonly receiptIdNotation: SmsIdNotation | undefined;
private readonly session: Session;
private readonly systemId: string;
@@ -44,7 +44,7 @@ export class IncomingRequests {
maxOctets: options.maxOctets,
timeout: options.reassemblyTimeout ?? defaults.reassemblyTimeout,
});
this.receiptIdFormat = options.receiptIdFormat;
this.receiptIdNotation = options.receiptIdNotation;
this.session = options.session;
this.systemId = options.systemId ?? defaults.systemId;
}
@@ -101,7 +101,7 @@ export class IncomingRequests {
/** SMPP carries a mobile-originated message and a delivery receipt on the same command. */
private async onDeliverSm(pduObj: PduObject): Promise<void> {
const dlr = dlrFromPdu(pduObj, this.receiptIdFormat);
const dlr = dlrFromPdu(pduObj, this.receiptIdNotation);
if (!dlr) {
this.onMessage(pduObj);