问题描述
我正在尝试在node.js中使用SMPP发送消息
我在下面编写了发送消息的代码,它告诉我“成功绑定”,但是消息未发送。
有人可以帮我添加或删除的内容吗?
而且,我也想使用SMPP发送批量消息
任何人都可以帮我吗?
此消息所需的绑定应位于以下位置:
服务器IP:-api.xxxxx.com
端口:-2350
用户名:-xxxxxx
密码:-xxxxx
获取链接间隔:-180
来源TON:-0
源NPI:-1
目的地TON:-1
目标NPI:-1
数据编码:-(仅对纯文本消息使用0,对Unicode使用8,仅在特殊情况下使用其他任何值)
谢谢大家!
const session = smpp.connect(given api,2345);
let isConnected = false;
session.on('connect',() => {
isConnected = true;
session.bind_transceiver({
system_id: 'system_id',password: 'system_password',Enquire_interval: 180,source_ton: 0,source_npi: 1,addr_ton: 1,addr_npi: 1,data_code: 8,},(pdu) => {
if (pdu.command_status == 0) {
console.log('Successfully bound');
}
})
})
session.on('close',() => {
console.log('smpp is now disconnected');
if (isConnected) {
session.connect(); //reconnect again
}
})
session.on('error',error => {
console.log('smpp error',error)
isConnected = false;
});
function sendSMS(from,to,text) {
from = `+${from}`;
// this is very important so make sure you have included + sign before ISD code to send sms
to = `+${to}`;
session.submit_sm({
source_addr: from,destination_addr: to,short_message: text
},function(pdu) {
if (pdu.command_status == 0) {
// Message successfully sent
console.log(pdu.message_id);
}
});
}
sendSMS(12345,12345,'Hello');```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)