Bind as SMPP 3.4 by default, with interfaceVersion to override it

This commit is contained in:
2026-08-26 15:41:44 +02:00
parent 54b73205ac
commit 694c3a506e
5 changed files with 39 additions and 12 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ describe('our encoder against the reference parser', () => {
const parsed = referenceParse(ourBuffer({
cmdName: 'bind_transceiver',
params: {
interface_version: 0x50,
interface_version: 0x34,
password: 'bar',
system_id: 'foo',
system_type: 'smpp',
@@ -80,7 +80,7 @@ describe('our encoder against the reference parser', () => {
assert.equal(parsed.command, 'bind_transceiver');
assert.equal(parsed.system_id, 'foo');
assert.equal(parsed.password, 'bar');
assert.equal(parsed.interface_version, 0x50);
assert.equal(parsed.interface_version, 0x34);
});
test('a deliver_sm carrying delivery receipt TLVs', () => {
+25
View File
@@ -5,6 +5,7 @@ import type { Session } from '../src/session.ts';
import type { Sms } from '../src/sms.ts';
import type { SmppServer } from '../src/server.ts';
import { client } from '../src/client.ts';
import { isCommand } from '../src/pdu.ts';
import { server } from '../src/server.ts';
async function startServer(options: Parameters<typeof server>[0] = {}): Promise<SmppServer> {
@@ -93,6 +94,30 @@ describe('bind', () => {
assert.equal(await responded, '00000010800000150000000400000001');
await smpp.close();
});
test('declares SMPP 3.4 by default and the version the caller asks for', async () => {
const smpp = await startServer();
const declared: (number | undefined)[] = [];
smpp.on('session', session => {
session.on('incomingPduObj', pduObj => {
if (isCommand(pduObj, 'bind_transceiver')) {
declared.push(pduObj.params.interface_version);
}
});
});
const { session: byDefault } = await connect(smpp);
const { session: asFive } = await connect(smpp, { interfaceVersion: 0x50 });
assert.ok(byDefault);
assert.ok(asFive);
assert.deepEqual(declared, [0x34, 0x50]);
await byDefault.unbind();
await asFive.unbind();
await smpp.close();
});
});
describe('sending', () => {