Working commit
This commit is contained in:
30
src/PDUProcessor/Postprocessor/Center/EchoPduProcessor.ts
Normal file
30
src/PDUProcessor/Postprocessor/Center/EchoPduProcessor.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Center} from "../../../Center/Center";
|
||||
import {PDU} from "../../../CommonObjects";
|
||||
import Postprocessor from "../Postprocessor";
|
||||
|
||||
const smpp = require("smpp");
|
||||
|
||||
export class EchoPduProcessor extends Postprocessor {
|
||||
serverSessionType: string = Center.name;
|
||||
|
||||
processPdu(session: any, pdu: PDU, ...args: any[]): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
let promises = [];
|
||||
if (pdu.response) {
|
||||
let replyPromise = session.send(pdu.response());
|
||||
let sendPromise = session.send(new smpp.PDU('deliver_sm', {
|
||||
source_addr: pdu.destination_addr,
|
||||
destination_addr: pdu.source_addr,
|
||||
short_message: pdu.short_message
|
||||
}));
|
||||
promises.push(replyPromise);
|
||||
promises.push(sendPromise);
|
||||
}
|
||||
Promise.all(promises).then((replyPdus: any) => {
|
||||
resolve(replyPdus);
|
||||
}).catch((error: any) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user