Comments (11)
@habaongoc Are you testing with GSM or CDMA operator? If it is GSM, then use "message_payload" instead of "short_message". If it is CDMA, you must send multiple messages. Please, refer to this link #4
from node-smpp.
@Sukhrob I tried, It didn't work. I think it's provider's problem.
I solved problem using this answer: #4 (comment)
calculateMessageUHD(sms) {
const info = gsm(sms)
const cref = this.concat_ref
return info.parts.map((part, i) => {
let udh = new Buffer(6)
udh.write(String.fromCharCode(0x5), 0) //Length of UDF
udh.write(String.fromCharCode(0x0), 1) //Indicator for concatenated message
udh.write(String.fromCharCode(0x3), 2) // Subheader Length ( 3 bytes)
udh.write(String.fromCharCode(cref), 3) //Same reference for all concatenated messages
udh.write(String.fromCharCode(info.sms_count), 4) //Number of total messages in the concatenation
udh.write(String.fromCharCode(i + 1), 5) //Sequence number ( used by the mobile to concatenate the split messages)
return {
udh: udh,
message: part,
}
})
}
then while sending submit_sm
:
short_message: {
udh: part.udh,
message: part.message,
},
from node-smpp.
I'm using message_payload
, also setting sm_length
to 0.
Messages are delivered but they're empty, what could be a problem? I'm testing with GSM operator.
from node-smpp.
@notgiorgi Please, try without setting sm_length to 0. If it doesn't work, can you provide an example source code or at least the one that looks like yours?
from node-smpp.
Many thanks to @Sukhrob and @notgiorgi . I sent it successfully by changing short_message to message_payload.
Sorry for my late reply because I didn't work for this project shortly.
from node-smpp.
Besides, I cannot send message for the first time when I start service. The second time and more work well. Here is my code :
var session = smpp.connect('smpp://smppip');
session.bind_transceiver({
system_id: 'xx',
password: 'xx'
}, function(pdu) {
console.log("- bind_transceiver pdu", pdu)
if (pdu.command_status == 0) {
// Successfully bound
console.log("Successful bound!");
}
else{
console.log("Unsucessful Bound!");
res.send({error:pdu.command_status , success: 'Unsucessful Bound'});
}
});
router.get('/sendSMS', function(req, res, next) {
var number = req.query.number;
var message = req.query.message;
console.log("number",number,"message",message)
session.submit_sm({
source_addr: 'ABC',
destination_addr: number,
message_payload : message,
source_addr_ton: 5,
source_addr_npi: 1,
dest_addr_ton: 1,
dest_addr_npi: 1,
}, function(pdu) {
//console.log("- submit_sm pdu:", pdu)
if (pdu.command_status == 0) {
console.log("- submit_sm success",pdu.message_id);
res.send({errorCode:pdu.command_status, errorMessage: 'Send message success'});
}
else{
console.log("- submit_sm fail:", pdu);
res.send({errorCode:pdu.command_status, errorMessage: 'Send message fail'});
}
});
});
Please help me, I don't know why it does not work for the very first request.
from node-smpp.
@habaongoc Can you put this code:
router.get('/sendSMS', function(req, res, next) {
var number = req.query.number;
var message = req.query.message;
console.log("number",number,"message",message)
session.submit_sm({
source_addr: 'ABC',
destination_addr: number,
message_payload : message,
source_addr_ton: 5,
source_addr_npi: 1,
dest_addr_ton: 1,
dest_addr_npi: 1,
}, function(pdu) {
//console.log("- submit_sm pdu:", pdu)
if (pdu.command_status == 0) {
console.log("- submit_sm success",pdu.message_id);
res.send({errorCode:pdu.command_status, errorMessage: 'Send message success'});
}
else{
console.log("- submit_sm fail:", pdu);
res.send({errorCode:pdu.command_status, errorMessage: 'Send message fail'});
}
});
});
after this code and check it again
// Successfully bound
console.log("Successful bound!");
I think you are trying to send an SMS before connecting.
from node-smpp.
Hi @Sukhrob,
It's same as my code (I tried your suggestion) because after log : "Successful bound!" show on the console, I call api "/sendSMS". Both is not work.
My solution now is: send a SMS notify to my number (is it cheating?) after "Successful bound!" - (of course I wont receive it). But I don't think it s good idea
It's like, I need to session.send(..) once, and then everything will smooth later.
from node-smpp.
Suggestion:
var session = smpp.connect('smpp://smppip');
router.get('/sendSMS', function(req, res, next) {
var number = req.query.number;
var message = req.query.message;
console.log("number", number, "message", message);
session.bind_transceiver({
system_id: 'xx',
password: 'xx'
}, function(pdu) {
console.log("- bind_transceiver pdu", pdu)
if (pdu.command_status == 0) {
// Successfully bound
console.log("Successful bound!");
session.submit_sm({
source_addr: 'ABC',
destination_addr: number,
message_payload: message,
source_addr_ton: 5,
source_addr_npi: 1,
dest_addr_ton: 1,
dest_addr_npi: 1,
}, function(pdu) {
//console.log("- submit_sm pdu:", pdu)
if (pdu.command_status == 0) {
console.log("- submit_sm success", pdu.message_id);
res.send({ errorCode: pdu.command_status, errorMessage: 'Send message success' });
} else {
console.log("- submit_sm fail:", pdu);
res.send({ errorCode: pdu.command_status, errorMessage: 'Send message fail' });
}
});
} else {
console.log("Unsucessful Bound!");
res.send({ error: pdu.command_status, success: 'Unsucessful Bound' });
}
});
});
from node-smpp.
My code runs without any errors. It gives response for message sent successfully. But no sms is received on device. Can i know what am i missing? Also i am getting empty message id in PDU response..
from node-smpp.
This issue is too broad and too old, please if help is still needed open a new issue
from node-smpp.
Related Issues (20)
- Node client crash with ECONNRESET HOT 5
- Couldn't recieve SMS from SMSC HOT 7
- Differntiate between incoming message and an incoming message that gets triggered after a message is sent using smpp HOT 2
- Error while connecting to server PDU_STATUS 15 HOT 3
- connection issue when setting up the smpp server. HOT 6
- Getting esm_class === 4 for every sent SMS HOT 2
- [Support] total received DLR and Submit response vs total sent SMS
- message_payload or UDH header HOT 1
- Client Not reciving DLR Report
- Only one message recieved when multiple messages are sent. HOT 5
- couldn't perform submit_sm although there is a binding
- Rebind on reconnecting to smsc is not working
- Support for Session Pooling.
- How to handle bind_transrecivier command status 5 HOT 5
- Session Randomly dropped by the server | ECONNRESET HOT 12
- Client receiving empty message due to encoding conflict. HOT 2
- [IGNORE]
- Multiprocessing HOT 2
- Why this library is too much sensitive ?
- Trying to debug message undefined error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-smpp.