Initial commit
This commit is contained in:
43
jstester/smppClient.js
Normal file
43
jstester/smppClient.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const smpp = require("smpp");
|
||||
|
||||
let message_id = 0;
|
||||
const session = smpp.connect(
|
||||
{
|
||||
url: "smpp://0.0.0.0:6001",
|
||||
auto_enquire_link_period: 10000,
|
||||
debug: true,
|
||||
},
|
||||
function () {
|
||||
session.bind_transceiver(
|
||||
{
|
||||
system_id: "test",
|
||||
password: "test",
|
||||
},
|
||||
function (pdu) {
|
||||
if (pdu.command_status === 0) {
|
||||
// Successfully bound
|
||||
console.log("sending shit");
|
||||
session.submit_sm(
|
||||
{
|
||||
source_addr: "smpp_test_1",
|
||||
destination_addr: "123123123123",
|
||||
short_message: "Hello!",
|
||||
data_coding: 0xc0,
|
||||
},
|
||||
function (pdu) {
|
||||
if (pdu.command_status === 0) {
|
||||
console.log(pdu.message_id);
|
||||
message_id = pdu.message_id;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
session.on("deliver_sm", function (pdu) {
|
||||
console.log("Got deliver_sm");
|
||||
session.send(pdu.response());
|
||||
});
|
Reference in New Issue
Block a user