Add protocolid and ucs2 processors
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import SmppSession from "../../../SmppSession";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
|
||||
export default class ProtocolId2DigitProcessor extends Preprocessor {
|
||||
applicableCommands: string[] = ['submit_sm', 'deliver_sm'];
|
||||
|
||||
constructor(type: string) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected doProcess(session: any, pdu: any, entity?: SmppSession | undefined): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
pdu.protocol_id = 16;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import SmppSession from "../../../SmppSession";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
|
||||
export default class ProtocolId3DigitProcessor extends Preprocessor {
|
||||
applicableCommands: string[] = ['submit_sm', 'deliver_sm'];
|
||||
|
||||
constructor(type: string) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected doProcess(session: any, pdu: any, entity?: SmppSession | undefined): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
pdu.protocol_id = 2048;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import SmppSession from "../../../SmppSession";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
import {PDU} from "../../../CommonObjects";
|
||||
|
||||
export default class ProtocolId4DigitProcessor extends Preprocessor {
|
||||
applicableCommands: string[] = ['submit_sm', 'deliver_sm'];
|
||||
|
||||
constructor(type: string) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected doProcess(session: any, pdu: PDU, entity?: SmppSession | undefined): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
pdu.data_coding = 2048;
|
||||
});
|
||||
}
|
||||
}
|
||||
16
src/PDUProcessor/Preprocessor/Client/ProtocolIdProcessor.ts
Normal file
16
src/PDUProcessor/Preprocessor/Client/ProtocolIdProcessor.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import SmppSession from "../../../SmppSession";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
|
||||
export default class ProtocolIdProcessor extends Preprocessor {
|
||||
applicableCommands: string[] = ['submit_sm', 'deliver_sm'];
|
||||
|
||||
constructor(type: string) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected doProcess(session: any, pdu: any, entity?: SmppSession | undefined): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
pdu.protocol_id = 4;
|
||||
});
|
||||
}
|
||||
}
|
||||
17
src/PDUProcessor/Preprocessor/Client/UCS2Preprocessor.ts
Normal file
17
src/PDUProcessor/Preprocessor/Client/UCS2Preprocessor.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import SmppSession from "../../../SmppSession";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
import {PDU} from "../../../CommonObjects";
|
||||
|
||||
export default class UCS2Preprocessor extends Preprocessor {
|
||||
applicableCommands: string[] = ['submit_sm', 'deliver_sm'];
|
||||
|
||||
constructor(type: string) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected doProcess(session: any, pdu: PDU, entity?: SmppSession | undefined): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
pdu.data_coding = 8;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ import DestinationEnumeratorProcessor from "./Preprocessor/Client/DestinationEnu
|
||||
import LongSmsProcessor from "./Preprocessor/Client/LongSmsProcessor";
|
||||
import SourceEnumeratorProcessor from "./Preprocessor/Client/SourceEnumeratorProcessor";
|
||||
import Preprocessor from "./Preprocessor/Preprocessor";
|
||||
import ProtocolIdProcessor from "./Preprocessor/Client/ProtocolIdProcessor";
|
||||
import UCS2Preprocessor from "./Preprocessor/Client/UCS2Preprocessor";
|
||||
import ProtocolId2DigitProcessor from "./Preprocessor/Client/ProtocolId-2Digit-Processor";
|
||||
import ProtocolId3DigitProcessor from "./Preprocessor/Client/ProtocolId-3Digit-Processor";
|
||||
import ProtocolId4DigitProcessor from "./Preprocessor/Client/ProtocolId-4Digit-Processor";
|
||||
|
||||
export default class ProcessorManager {
|
||||
static preprocessors: PduProcessor[];
|
||||
@@ -38,7 +43,18 @@ export default class ProcessorManager {
|
||||
new DestinationEnumeratorProcessor(Center.name),
|
||||
new SourceEnumeratorProcessor(Center.name),
|
||||
new DeliveryReceiptRequestProcessor(Client.name),
|
||||
new LongSmsProcessor(Client.name)
|
||||
new LongSmsProcessor(Client.name),
|
||||
new LongSmsProcessor(Center.name),
|
||||
new ProtocolIdProcessor(Client.name),
|
||||
new ProtocolIdProcessor(Center.name),
|
||||
new UCS2Preprocessor(Client.name),
|
||||
new UCS2Preprocessor(Center.name),
|
||||
new ProtocolId2DigitProcessor(Client.name),
|
||||
new ProtocolId2DigitProcessor(Center.name),
|
||||
new ProtocolId3DigitProcessor(Client.name),
|
||||
new ProtocolId3DigitProcessor(Center.name),
|
||||
new ProtocolId4DigitProcessor(Client.name),
|
||||
new ProtocolId4DigitProcessor(Center.name),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user