Compare commits

2 Commits

Author SHA1 Message Date
lilleman 21dc674d83 Leave the session's link end alone in incomingOn()
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 32s
Test / test (20) (pull_request) Successful in 32s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 32s
Test / test (26) (pull_request) Successful in 32s
2026-09-28 11:24:08 +02:00
lilleman 0d60b89e08 Answer a message on the session it arrived on 2026-09-28 11:24:08 +02:00
2 changed files with 7 additions and 7 deletions
+7 -5
View File
@@ -89,9 +89,9 @@ export function createSms(input: SmsInput, handlers: SmsHandlers): Sms {
from: input.from,
message: input.message,
pduObjs: input.pduObjs,
sendDlr: status => sendDlr(sms, handlers, status),
sendDlr: status => sendDlr(sms, input.session, handlers, status),
sendResp: options => (input.answeredAs === undefined
? sendResp(sms, answered, options ?? {}, handlers)
? sendResp(sms, input.session, answered, options ?? {}, handlers)
: answeredOnArrival(options ?? {}, handlers)),
session: input.session,
get smsId(): string {
@@ -128,6 +128,7 @@ function answeredOnArrival(
async function sendResp(
sms: Sms,
session: Session,
answered: { smsId: string },
options: SendRespOptions,
handlers: Pick<SmsHandlers, 'lostLink' | 'onAnswered'>,
@@ -149,7 +150,7 @@ async function sendResp(
return { err: new Error('The link this message arrived on is gone, so nothing would correlate the response') };
}
const results = await Promise.all(sms.pduObjs.map((pduObj, index) => sms.session.sendReturn(
const results = await Promise.all(sms.pduObjs.map((pduObj, index) => session.sendReturn(
pduObj,
options.status ?? 'ESME_ROK',
respIdParams(pduObj.cmdName, segmentId(answered.smsId, index, total)),
@@ -210,10 +211,11 @@ function collectReceipt(sent: Result<{ pduObj: PduObject }>[]): SendDlrResult {
async function sendDlr(
sms: Sms,
session: Session,
handlers: Pick<SmsHandlers, 'send'>,
status: MessageState = 'DELIVERED',
): Promise<SendDlrResult> {
if (!sms.session.bindAllows('deliver_sm')) {
if (!session.bindAllows('deliver_sm')) {
return {
err: new Error('A transmitter-bound session does not carry deliver_sm'),
pduObjs: [],
@@ -236,7 +238,7 @@ async function sendDlr(
short_message: receiptText(sms, smsId, status),
source_addr: sms.to,
},
...(sms.session.acceptsOptionalParams() ? { tlvs: receiptTlvs(smsId, status) } : {}),
...(session.acceptsOptionalParams() ? { tlvs: receiptTlvs(smsId, status) } : {}),
});
}));
return collectReceipt(sent);
-2
View File
@@ -102,8 +102,6 @@ function abortAfter(
}
function incomingOn(session: Session, options: Partial<IncomingRequestsOptions> = {}): IncomingRequests {
session.linkEnd = 'smsc';
return new IncomingRequests({
dlrMerger: new DlrMerger({ log: silentLog, max: 10, timeout: 10_000 }),
log: silentLog,